How to publish self-written python module to Azure Artifacts Feed from Azure Repo with Azure Pipelines?
To publish Python packages produced by your build, you'll use twine, a widely used tool for publishing Python packages. This guide covers how to do the following in your pipeline:
Install twine on your build agent
Authenticate twine with your Azure Artifacts feeds
Use a custom task that invokes twine to publish your Python packages
Check documentation below to get more details:
https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pypi?view=azure-devops&tabs=yaml
Related
I have an Azure DevOps pipeline
The pipeline has a "command line" task that runs a java command on a jar file
The jar file is a static one that represents a tool to be used in the build process.
The jar file is not created as part of the build pipeline. It's just a jar with one version and it doesn't change with each build
Where is the best place to save this jar file and how to download it to the agent during the build pipeline execution ?
Since the jar file is static one and not created as part of the build pipeline, you can save the jar file to Azure Artifacts Feed -> Universal Package.
To upload the jar file to Azure Artifacts Universal Package, you can use Universal Packages Task - Publish command in Pipeline or Azure CLI command: az artifacts universal publish (work in pipeline or local machine).
Then you can use the task: Universal Packages Task - Download command to download the Universal Package during the build pipeline execution.
I am using the Azure DevOps task ArtifactoryNuGet#2 in an Azure Pipeline.
I need help deploying NuGet packages from an Azure Devops pipeline to Artifactory. (I don't know if it makes a difference, but this is a cloud instance of Artifactory, not an on-prem instance.)
I have read the documentation at these two sites:
https://marketplace.visualstudio.com/items?itemName=JFrog.jfrog-artifactory-vsts-extension
https://www.jfrog.com/confluence/display/JFROG/Artifactory+Azure+DevOps+Extension
In addition, I have reviewed the task parameters in https://github.com/jfrog/artifactory-azure-devops-extension/blob/master/tasks/ArtifactoryNuget/Ver2/task.json
I have successfully restored packages from Artifactory and pushed packages to Artifactory, using ArtifactoryNuGet. However, I want to fine-tune the push package path to exclude a certain directory. That is, I want to push all packages found in the directory myproject except for the packages found in subdirectory myproject/foo .
I have the task specified like this:
- task: ArtifactoryNuGet#2
enabled: false
inputs:
command: 'push'
artifactoryService: 'AzureToArtifactory'
targetDeployRepo: 'acm-nuget-release-local'
targetDeployPath: 'Azure_CI_Build/xyzzy/packages'
pathToNupkg: 'myproject\**\*.nupkg;!myproject\foo\**\*.nupkg'
While ArtifactoryNuget recognizes the double-wildcard '**', it doesn't recognize the exclusionary character '!' , and I don't know if it recognizes the semicolon ';' .
If I only use the path myproject\**\*.nupkg, ArtifactoryNuGet finds 15 packages, 11 of them in foo and 4 of them in other subdirectories. I only want the 4 found elsewhere.
If I use the path with the exclusions as in the example above, ArtifactoryNuGet does not find any packages. I expected it to find the 4 packages.
How can I define pathToNupkg to exclude certain subdirectories, as shown?
How to publish only selected NuGet packages from Azure Pipeline to Artifactory?
You could try to use the JFrog CLI task to publish package with option --exclusions:
CLI for JFrog Artifactory-Uploading Files
jfrog rt u "myproject\**\*.nupkg" my-local-repo --exclusions="myproject\foo\**\*.nupkg*"
In addition to using the JFrog CLI task as suggested by another here, you also have the option of using the Artifactory Generic Upload task, right after the Artifactory NuGet task generates the artifacts. Just like the JFrog CLI task, it supports exclusions as well as many other options, but allows defining everything through file specs.
I am setting up a build and release pipeline for our Azure mobile app using Azure DevOps. I have completed the build and all works fine. I have a build task defined that creates the required zip file for deploying to Azure and this succeeds and the zip file is created at the root of the folder. But the deployment fails stating that the zip file cannot be found.
Here is my build task that creates the zip file.
And here is the output from the build step showing that it has successfully created the zip file.
But the deployment fails as it can't find the zip file.
You need to publish the .zip file from your build using the Publish Build Artifacts task. That will make it available as an artifact to be linked into a release definition to be deployed.
I am using the download artifact plugin in VSTS to get the specific artifact of different build def using the current build definition.I am unable to download the artifact to my local agent (I installed private agent).
Error below is throwing:
[12-01-2018 PM 01:30] Shwetha Rattihalli:
2018-01-11T07:23:53.7178634Z ##[section]Starting: Download Build Artifacts
2018-01-11T07:23:53.7385942Z ==============================================================================
2018-01-11T07:23:53.7386234Z Task : Download Build Artifacts
2018-01-11T07:23:53.7386451Z Description : Download Build Artifacts
2018-01-11T07:23:53.7386670Z Version : 0.127.5
2018-01-11T07:23:53.7386874Z Author : Microsoft Corporation
2018-01-11T07:23:53.7387214Z Help :
2018-01-11T07:23:53.7387484Z ==============================================================================
2018-01-11T07:23:55.4791903Z ##[error]Build with id NaN not found for build definition id 6
2018-01-11T07:23:55.4807213Z ##[section]Finishing: Download Build Artifacts
!
For the Download Build Artifacts task, you need to specify the build manually since the task has no such settings to "get Latest artifacts" for now. And you can also follow up the issue Download Build Artifacts (Preview) not able to get latest build of a specific build definition.
If you want to get the latest build artifacts for a build definition, you can use the Fetch Build Artifacts task instead.
This task can get the latest build artifacts from the specified build definition:
Note: you should Enable Allow scripts to access OAuth token in your agent phase.
I just started using VSO for one of my project. I have created the built definition and the built was successful. When I tried to create the release definition for that built its failing by throwing the error
System.Management.Automation.RuntimeException: No files were found to deploy with search pattern C:\a\858bddd5b\**\*.zip
Its expecting .zip files. Since I need to deploy the distributed folder created by gulp build, I have given the Web Deploy Package path as
$(System.DefaultWorkingDirectory)/{built name}
Any help is really appreciated
You should add a build step to create an archive with .zip extension for the output folder of the gulp step. Your steps should look like
VSO/VSTS build has a task available with Archive files to achieve the same.
Alternatively, if the standard Archive files step doesn't work for you, you can use a powershell step. The powershell command will look like the following.
[io.compression.zipfile]::CreateFromDirectory($Source, $Destination)
Source should be all the files/folders from gulp output you wish to deploy
Destination here should correspond to input for the webdeploy/ WebApp deployment step.
You can also use this extension to create a ZIP file. I used it for a situation similar to yours:
https://marketplace.visualstudio.com/items?itemName=trackyon.trackyonadvantage
"Azure Web App Deployment" task requires a web deploy zip package. You can either add one more task to create a zip package for the build output as other two answers indicated or add some code in your "gulpfile.js" to generate a zip package during the gulp build and then publish the zip package to artifact.
If you don't want to create a zip package for the build output, then you can use FTP Uploader task to deploy the build to Azure Web App via FTP Deploy.
You can create a zip file with PowerShell, assuming you're running on a Windows agent.
Command Line task
Command: powershell
Arguments: -Command "&{Add-Type -assembly 'system.io.compression.filesystem'; [io.compression.zipfile]::CreateFromDirectory('$(Build.StagingDirectory)\Zip', '$(Build.StagingDirectory)\$(BuildConfiguration)Deploy.zip')}"
Obviously, replace $(Build.StagingDirectory)\Zip with whatever folder you want zipped up and $(Build.StagingDirectory)\$(BuildConfiguration)Deploy.zip with whatever you want the file named.