How to open D:\a\r1\a\ on Azure? - azure

I'm running Cypress in one of my release stages and it gives me this output:
Finished processing: D:\a\r1\a\_ClientWeb-Build-CI\ShellArtifact\tests\integration\cypress\videos\onboarding.spec.js.mp4 (0 seconds)
I have 2 questions:
Is the path name relative to the app service? If I have a app service called randomname and run the Cypress Stage on that randomname app service should I be able to find tCypresshe output in randomname.scm.azurewebsites.net.
If I go into the scm debug console and I do cd D:\a\ I get:
cd : Cannot find path 'D:\a\' because it does not exist.
So how do I actually access my Cypress test results?
I've also tried archiving the files into a zip file:
In the output of the task step I see:
Creating archive: d:\home\testing\somefile.zip
But when I try to access the D:/home/testing folder on my appname.scm.azurewebsites.net I get:
cd : Cannot find path 'D:\home\testing' because it does not exist.

The path D:\a\r1\a is inside the hosted agent that run the release pipeline, is not in your application.
The same thing is for the zip file, when you specify d:/home/... is in the agent.
After the release is finish all the files are deleted, so you need to save the file in another place (maybe in azure?) during the pipeline, for example, with "Azure File Copy" task.

Related

How to modify the repository / storage location for Test Results in azure pipeline

For one of my project the TestResults.zip file is publishing on url https://dev.azure.com/MyProject/Project/_TestManagement/Runs?runId=8309822&_a=runCharts.
I want to change storage location for TestResults.zip file from above given URL to my own defined repository location.(Like: Myproject/target/surefire-reports.zip) How to do that?
Because in my azure pipeline the test are running and when it comes to create a zip for TestResults it's storing in given above URL and i want to store in one of my project sub-module under target directory so that i can create a zip file.
Please help me to resolve this issue.
Many Thanks
How to modify the repository / storage location for Test Results in azure pipeline
It is not recommended to publish the test results to the repo.
If you still want do that, you could use git command line to submit the test file to the repo in the pipeline after the test task, like:
cd $(System.DefaultWorkingDirectory)
copy Path\surefire-reports.zip target
cd target
git add surefire-reports.zip
git commit -m "Add a test file"
git push https://PATn#dev.azure.com/YourOrganization/YourProject/_git/xxx.test HEAD:master
You could check the similar thread for some more details.

Unable to copy warfile from agent folder to Tomcat folder in AzureDevops using command line script

I am trying to copy a war file from my localhost to a Tomcat web apps folder using command line script in Azure DevOps. My release is getting success but the war file is not getting copying to the destination folder. How to fix this issue?
Path folder mentioned below
The script you shared echo cd E:\apache-tomcat-9.0.41\webapps just print cd E:\apache-tomcat-9.0.41\webapps, check the pic below. We could refer to this doc for more details.
We could copy the file via below cmd. Add task Command line and enter below script
cd {file path}
copy {file name} {target path}
According to the screenshot you shared, you could try below script
cd C:\agent\_work\r1\a\_nitesh482.Devops\warfile\webapp\target
copy webapp.war E:\apache-tomcat-9.0.41\webapps
Result:
Update1
If the file does not exist, we will get the message: The system cannot find the file specified. and error message: [error]Cmd.exe exited with code '1'
Update2
Please ensure that you are using self-hosted agent instead of hosted agent. If you are using hosted agent, we will get the error message, check the pic below.
Self-hosted agent:
Hosted agent:

Deploy Nodejs apllication on azure linux vm using azure release pipeline

I am creating CI & CD pipeline for nodejs application using azure devops.
I deployed build code to azure linux vm using azure release pipeline, here I configured deployment group job.
In deployment groups I used extract files task to unzip the build files.
Unzip will works fine and my code also deployed in this path: $(System.DefaultWorkingDirectory)/LearnCab-Manage(V1.5)-CI (1)/coreservices/ *.zip
After that i would like to run the pm2 command using azure release pipeline, for this task i take bash in deployment group jobs and write the command
cd $(System.DefaultWorkingDirectory)/LearnCab-Manage(V1.5)-CI (1)/coreservices/*.zip
cd coreservices
pm2 start server.js
But bash not executed it will give exit code 2.
it will give exit code 2
This error caused by your argument are using parentheses ( in the command at your first line. As usual, the parentheses is used as group. This could not be compiled as a normal character in command line.
To solve it, you need transfer the parentheses as a normal character with \:
cd $(System.DefaultWorkingDirectory)/LearnCab-Manage\(V1.5\)-CI \(1\)/coreservices/*.zip
And now, \(V1.5\) and \(1\) could be translated into (V1.5) and (1) normally.
And also, you can use single or double quote to around the path:
cd "$(System.DefaultWorkingDirectory)/LearnCab-Manage(V1.5)-CI (1)/coreservices/*.zip"
Or
cd '$(System.DefaultWorkingDirectory)/LearnCab-Manage(V1.5)-CI (1)/coreservices/*.zip'

Azure ASP,NET Core web app says "You do not have permission to view this directory or page"

I just upgrading my Azure service from free level to basic level to get more file storage space. But now accessing my first newly deployed Web app shows: "You do not have permission to view this directory or page." The deployment from Bitbucket worked. The kudu console shows everything loaded. I have 3 branches in my repo and three Azure apps defined, one for each. Two were deployed before upgrading and they are okay. The third was just deployed after the upgrade and has this problem. All three come from the same repo, and at this time all three branches are basically the same. All are the same basic ASP.NET Core 1.0 web app for each branch. I checked a lot of google pages, but none were helpful. Where do I go to fix this?
This just means that the website didn't load so the IIS server is falling back and trying to load one of the html files it has in the list for startup which you wouldn't have since it should be loading up your site code instead, the directory listing is the last thing it could show and will fail in this scenario. Pay special attention to any differences in the deployment methods or any changes made to the Startup.cs file.
Your application files may not have deployed correctly. The root / gave me:
You do not have permission to view this directory or page.
When I tried a static HTML file I got:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
(This should have been served by the .NET Core static middleware.)
I'd been playing with my Azure Pipelines YAML and it was pushing the wrong files up in the deploy to Azure Web App task step, thing.
My app is .NET Core 2.2 in "Run-from-Zip" mode, now called Run-from-Package.
A path error in my YAML meant the package contained another subfolder with the package inside it, instead of it all being in the root of the package, if that makes sense.
Maybe this fascinating story helps someone.
A frustrating experience making this work caused me to write this guide. What happens is your output may be missing some of the files needed, or be structured incorrectly, for IIS to launch your app. The issue can arise for different reasons.
Archive contains root directory.
When you create your zip file, make sure you are not archiving the root folder. What happens is your /home/site/wwwroot directory looks like:
/home/site/wwwroot
--RootFolder
--LaunchFile
When IIS is expecting
/home/site/wwwroot
--LaunchFile
This is easy to fix by adding includeRootFolder: false to the ArchiveFiles#2 task.
- task: ArchiveFiles#2
displayName: 'Archive files'
inputs:
includeRootFolder: false
Alternatively, if using the Web UI in the Root folder or file to archive section ensure that
Prepend root folder name to archive paths is not checked.
Build vs Publish
Using the .NET Core task to build the project or solution can result in output that will not work in the /home/site/wwwroot directory. The key here is to choose the publish option, not the build option. build was working for us and then did not for one of our projects. Changing to publish made it work again.
- task: DotNetCoreCLI#2
inputs:
command: 'build'
projects: 'MyProj/MyProj.csproj'
arguments: '--output $(Build.BinariesDirectory)/WhereYouWantFilesForNextStep --configuration Release'
Instead, use the publish command.
steps:
- task: DotNetCoreCLI#2
inputs:
command: publish
arguments: '--configuration Release -o $(Build.BinariesDirectory)/WhereYouWantFilesForNextStep'
Zip File is not Mounted
Zip archives deployed to Azure are stored in
Directory of D:\home\data\SitePackages
11/03/2021 06:24 PM <DIR> .
11/03/2021 06:24 PM <DIR> ..
11/03/2021 04:24 PM 66,278,978 20211103162437.zip
11/03/2021 06:24 PM 73,799,022 20211103182443.zip
11/03/2021 06:24 PM 18 packagename.txt
And, if the following Application Setting is provided:
WEBSITE_RUN_FROM_PACKAGE = 1
Then IIS will mount the zip archive specified in packagename.txt to the D:\home\site\wwwroot.
D:\home\data\SitePackages>cat packagename.txt
20211103182443.zip
Note that 20211103182443.zip is the name of one of the .zip file listed in D:\home\data\SitePackages directory. Now if WEBSITE_RUN_FROM_PACKAGE is toggled the contents of D:\home\site\wwwroot will change.
Useful Resources
Additional reading is available at Microsoft Docs: Run your app in Azure App Service directly from a ZIP package.
If you want to examine the contents of the zip file directly, PowerShell will work in the console provided at App Service > Development Tools > Console and has access to the Unzip command.
D:\home\data\SitePackages>PowerShell Unzip -l 20211103162437.zip
Archive: 20211103162437.zip
Length Date Time Name
--------- ---------- ----- ----
25600 2013-07-17 23:18 AForge.Genetic.dll
...

Publish build artifacts step fails, when using fileshare (TFS 2015)

TFS Version: 14.102.25423.0 (Tfs2015.Update3)
In my build definition when I set the Path argument of the
Publish Build Artifacts step
with
Artifact type: File share
to
\VSALM\share
Behind the scene this build step executes a node.js script function which is called recursively, but there is a bug and the function repeats itself over and over again while trying to create the drop folder**.
The failing node.js script is
mkdir.js
and resides below the build agent folder:
agent\tasks\PublishBuildArtifacts\1.0.28\node_modules\shelljs\src\mkdir.js
Name of the failing function is:
mkdirSyncRecursive
The error msg:
016-07-23T21:22:02.3703397Z shell.js: internal error
2016-07-23T21:22:02.3703397Z RangeError: Maximum call stack size
exceeded
--> Stackoverflow
When I enter an absolut path like
c:\workspaces\share
I get this error:
2016-07-23T21:03:07.5727256Z shell.js: internal error
2016-07-23T21:03:07.5727256Z Error: EEXIST: file already exists, mkdir
'C:\workspaces\share'
Workaround
When I set the drop folder to (escaped network share path):
\\\\VSALM\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)
Then the build step succeeds but the files are not dropped under the path of the share.
They are dropped here in my case:
C:\VSALM\share\MyBuildDefinition\20160723.7\drop
I don't know why it doesn't work with my share set to:
C:\workspaces\share
but it works when I create a network share in
C:\drop\share
and set the drop folder path in my build definition to:
\\\\drop\\share\\$(Build.DefinitionName)\\$(Build.BuildNumber)
Question:
Someone knows how to fix this script?
"Publish Build Artifacts" task publishes the build output to a shared network path when you select "File Share" type. The "Maximum call stack size exceeded" error usually occurs when the shared network path cannot be found. Please check if the "Path" you entered is correct and can be accessed from the build agent. The format is usually like following:
\\hostnameoripaddress\sharedfolder
When you enter a path with "\\\\" prefix, the task will copy the output to the root of the drive where the build agent located. For example, your build agent work folder is placed in C drive, when you specify "\\\\VSALM\share" as the path, it will copy files to "C:\VSALM\Share" folder(It will create the folder if the path does not exist).

Resources