did anyone have worked custom build on the powershell and upload the artifact to the VSTS directory.
I have configured Build Process on the VSTS agent, Build process all passed and i have artifact, we also need to encrypt the app, the process is on CLI, i have powershell script execute those tasks, but i couldn't able to upload that articats to VSTS directory,
his anyone have any idea how can i achieve this goal.
The tasks (i) button helps understand the directory you'll be working in the context of for a task.
In the instance of the Powershell task it will be working from the $(System.DefaultWorkingDirectory). If the powershell task is in version control use the ... button to select the powershell script you wish to execute.
Once your script executes you'll probably want a Copy Task to copy the file you just encrypted to $(Build.ArtifactStagingDirectory) something like this (obviously you'll need to modify the contents field so it copies the encrypted file from the powershell step):
Then you're ready to publish to Azure DevOps taking the contents of $(Build.ArtifactStagingDirectory) and making this an artifact for the build. In the below example this artifact will be called drop.
Hope that helps.
Related
When you set up an azure devops agent on a build machine, it will have a working folder (by default _work) where it will create subfolders for each pipeline that it has to run.
These folders have integer names like "80" or "29". This makes it hard to trouble shoot issues on a given build machine, when you have many pipelines, as you don't know which folder it each pipeline relates to.
Is there a way to figure out the mapping from pipeline > folder number, or to name these folders more explicitly?
Rename the folders is currently not supported in Azure DevOps.
Each pipeline maps a folder in the agent-> _work.
1.You could check the pipeline log to figure out which folder is your pipeline's working folder. (Enable system diagnostics)
2.You could also add a command line task in your pipeline to echo this directory.
echo $(System.DefaultWorkingDirectory)
I am using IIS Deployment template in Release pipeline to deploy MVC application to VM and it is working fine. But after deploying application, we want to run any ad-hoc sql changes using script files in SQL server using custom task Run SQLCMD Scripts from VSTS market place.
Relese pipeline, scripts are in zip file, Can anyone suggest what we should key-in in "Path to folder containing SQLCMD script files"?
You can try referencing the variable
$(Build.ArtifactStagingDirectory)
In Release Pipeline, the artifacts will be downloaded to the path : $(System.ArtifactsDirectory).
According to your screenshot, I noticed that you are using the "Extract files" task. This task will find the zip files in the $(System.ArtifactsDirectory) and extract it.
The unzipped folder name is set in the "Extract files" task (Destination folder).
So you could try to use the following path:
$(System.ArtifactsDirectory)/Destination folder name
You can also expand this path according to the actual location of the file.
Hope this helps.
I already made an build pipeline with CI and i got successful builds. I want my latest successful build to be released on a website where people can download an .exe file of the application. I find very little information about this on how to do this.
I am working with Azure DevOps.
That depends on your website upload method:
File share. Use the Copy Files task or Publish Build Artifacts task in you build definition.
FTP or another. Try to use PowerShell to publish your results with PowerShell task
I created a custom vsts task that merge web.config files and I want to used it in my release pipeline, my task is a powershell and i want to run this powershell on agent machine but it runs in different directory when I give it the source folder it can't find it.
How to change powershell directory to make this task run on agent machine.
Thanks.
By default, the build pipeline will be used the hosted agent, which provided by AzureDevOps.In your case, you need to change this behavior since you need to run your PowerShell script in your machine directory.
For that first, you need to install your self-own agent. Then you can point the directory to your PowerShell script which you'd like to run
I cannot use the Publish Build Artifacts Task in a release-definition, I'm getting the following error:
ErrorHostTypeNotSupported: This task must run in a build to publish artifacts to Visual Studio Team Services/TFS.
So my question is:
How can I save a file from a release-definition?
Why I want to achieve this:
I'm using a Deploy to Kubernetes Task in my release definition (which deploys a microservice with a yaml file to azure aks), this yaml file is tokenized during the release (I'm replacing the build-id). So at the end, I want to be able to download this file for each release and to use it for a manual deployment (if necessary).
Thanks for your help.
There is no container for artifacts in Release Management, so you cannot use that task in Release.
As a workaround, you can use ##vso[task.uploadfile]local file path command in VSTS Task Logging Command to upload the file.
Upload user interested file as additional log information to the
current timeline record. The file shall be available for download
along with task logs.
To do this, add a powershell task in your release definition like below:
When you want to use the file, download the release logs as zip, the file will be included in it.