No option to copy artifacts download URL in new Azure DevOps Builds - azure

How can I copy artifacts download URL in new Azure Devops Builds?

Currently there is no option to directly copy the download url of artifacts. From the page, we can only download it by clicking the download button.
To solve this issue, we need to press F12 in the browser then select Network to capture the download url .
Directly using the api captured in the above image, I can successfully download the artifact.

You can try to construct your own link with format:
https://devops.azure.com/{org_name}/{team_project_name}/_apis/build/builds/{build_id}/artifacts?artifactName={artifact_name}&api-version=5.1&%24format=zip
{org_name} - name of your azure devops account
{team_project_name} - name of team project where your build runs
{build_id} - id of your build that contains your files to download. You can find it in the link:
{artifact_name} - name of your artifact (by default drop). You van find it in the published artifacts:

Related

Unable to deploy a .NET core app from DevOps to Azure using publish profile

I am creating a new Azure Pipeline to deploy .NET Core API app to an App Service in Azure. I am using connection type=publish profile in the pipeline, which is asking for a .pubxml file.
I have already committed the .pubxml file in my Azure repository.
But while giving the path for getting this .pubxml file, I am suspecting that I can't get .pubxml file through build artifacts. Is there any way to get the .pubxml file from azure repos to release pipeline?
I tried with $(Build.SourcesDirectory)\${{ parameters.Location }}\Properties\PublishProfiles\fcmapapi_Dev%20-%20Web%20Deploy.pubxml but no luck.
Any suggestions?
Step 1: Add Azure Repos / Build artifact with an alias to your release pipeline.
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/artifacts?view=azure-devops#artifact-sources
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/artifacts?view=azure-devops#artifact-sources---tfvc-git-and-github
Add "Build" resources as an artifact:
Add "Azure Repository" as an artifact:
Once, you have added both, the classic release pipeline will look like this:
Step 2: Use the three dots to browse the files / packages.

Download result of Azure Release Pipeline

I have a release pipeline that combines two build pipelines artifacts to create the full release. I need to be able to download the result of this task after is done.
I run the Archive Task to zip the results but I don't know how to save it somewhere where I can download it using the Azure Pipeline agent.
Is there a task that can trigger that as a download or can I save it as an Artifact?
Thank you
Yeah, what you have to do is publish and then consume artifact in your Release pipeline. Here you have documentation
steps:
- publish: $(System.DefaultWorkingDirectory)/bin/WebApp
artifact: WebApp
Id you use Yaml then you should use this:
steps:
- download: current
artifact: WebApp
If you use Classic releases you needs to confgure it on designer.
Please use this task in your pipeline:
and then configure your release here:
Just realized that if I do this with my On-Prem agent I can get the file form the agent's file structure.
Would be nice though if I could get the file straight from Azure instead.
Thank you.

How to create local file link in description section of work item within Azure Devops?

I am trying to create a link to a local file within the description section of a task in Azure DevOps.
I have tried using the extension file:///H:\Documents\test.xlsx The link appears as a hyperlink, however it is not clickable.
How to create local file link in description section of work item
within Azure Devops?
I am afraid this is not achievable in Azure devops. The description section of the work item cannot add the link associated with the local file.
You can attach local files as attachments to work item.
Choose the Attachment tab icon to attach a file with supplemental information.

Upload File as a parameter to job in Azure DevOps

I have a Azure DevOps pipeline that automates user creation in salesforce. I am expecting the user details in an excel file, which is to be fed to the Azure DevOps pipeline as a pre-build parameter. However, I am not able to find a solution to it in Azure DevOps.
I had implemented this in Jenkins already using File parameter plugin in my previous projects. Does Azure DevOps has this capability?
After searching through various blogs and posts, I realized that there is no way to get this done directly in VSTS. However, I was able to get a work around for the same.
I created a VSTS User story and uploaded my attachment there
Using the Work Item ID, I used the work Item api to get the attachment ID.
Using the attachment API I was able to write a python script to download this attachment as a part of a pre-step in the Pipeline. Then this was available to use through out my automation script.
I don't think you can load a file before the build start and read the variables, but, you can add a task that read the variables from a file and put him in the beginning (the first step in your pipeline).
There are few extensions to read variable from a JSON file, for example: Json to Variable.
If you want to read from excel I think you should write a script that does it.
Using local hosted agent, you can publish artifact from local share, then move to i.e. ms-hosted agent and use it normally.
- task: DownloadFileshareArtifacts#1
inputs:
filesharePath: '\\myhost\myshare\myfolder'
artifactName: 'my-artifact'
downloadPath: '$(System.ArtifactsDirectory)'
parallelizationLimit: '8'
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-fileshare-artifacts?view=azure-devops

Find Azure slot location in azure App Service Deploy

How to find Destination path of deployed web site on Azure App Service Deploy - Azure Slot ?
I need to delete existing old files on a destination specific folder which are generated uniquely on each release(during build process).
This has to be done during pre-deployment.
I used Delete Files Task which is not deleting. Here is YAML.
In Kudu , I am able to see my web site location is D:\home\site\wwwroot\
I wanted to delete files from the path D:\home\site\wwwroot\scripts\libs>
steps:
task: DeleteFiles#1
displayName: 'Delete files from $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.artifactstagingdirectory)'
Contents: 'scripts\libs**'
You don't have to manually delete old files on your App Service Instance or its Deployment Slots. When you are using Azure App Service Deploy task you have the option built-in to remove any unused files at the destination (in this case App Service Instance/Deployment slot). Here is how to do it.
On the Azure App Service Deploy task,
Expand Additional Deployment Options.
There make sure Select Deployment Method checkbox is selected
From the Deployment Method drop down, Select Web Deploy
Select the Remove additional files at destination checkbox
If you want to keep any file that is installed with App Service Extensions or WebJobs select Exclude files from the App_Data folder as well
What this will do is it will compare the files that are already at the destination (App Service) with the files that will be copied over from the Artifacts. Then it will delete any file that is not available in the artifacts that you are doing to deploy.
Find Azure slot location in azure App Service Deploy
You may not delete the correct folder.
According to the first image in your question, we could to know you are deleting the file from the folder $(build.artifactstagingdirectory).
As we know, the folder $(build.artifactstagingdirectory) is the local path on the agent where any artifacts are copied to before being pushed to their destination.
Check Build variables for some more details.
However, I do not find any task in your build definition to copy file to the artifacts.
Besides, you said you delete existing old files on a destination specific folder which are generated uniquely on during build process.
So, I am bold to guess that the file you want to delete should be in System.DefaultWorkingDirectory instead of artifacts. But I am not very sure about it, since I could not distinguish folder type from the path D:\home\site\wwwroot\scripts\libs>.
So, to resolve this issue, you can try to delete the file from $(System.DefaultWorkingDirectory).
Or you can use a Inline Powershell task to outcome the value of $(build.artifactstagingdirectory):
Write-Output '$(Build.ArtifactStagingDirectory)'
Then check if the value is match the path of folder you want to delete D:\home\site\wwwroot\scripts\libs>.
Hope this helps.

Resources