How to use the build artifacts in a command line script task in a Release pipeline in Azure devops

Viewed 33

I am a newby with Azure devops. I want to use an artifact which is build by a devops build pipeline. But devops is mainly for deploying to Microsoft Azure deployments I guess. At least I can't get this simple job done in cmd line.

This is my build pipeline very basic, this produces a Java Maven jar as build artifact.

variables:
  MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
  MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'

pool:
  vmImage: ubuntu-latest

steps:
- task: Maven@3
  inputs:
    mavenPomFile: 'pom.xml'
    mavenOptions: '-Xmx3072m'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    jdkArchitectureOption: 'x64'
    publishJUnitResults: false
    #testResultsFiles: '**/surefire-reports/TEST-*.xml'
    goals: 'package'

the resulting artifact of this must be used in a commandline script.

I tried to grep the artifact but that is not possible. I have added the artifacts in the release pipeline in the UI I have created a stage but when I use a Download build artifact

steps:
- task: DownloadBuildArtifacts@1
  displayName: 'Download Build Artifacts'
  inputs:
    buildType: specific
    project: '149ff8df-e61a-446b-ab03-aa0d83882197'
    pipeline: 5
    downloadType: specific

and the Command line script:

steps:
- script: |
   echo Write your commands here
   echo Hello world
   git version
   echo start
   echo $(RELEASE.ARTIFACTS._MULE-SHARED-RESOURCES.BUILDNUMBER)
   echo $(Release.Artifacts._MULE-SHARED-RESOURCES.BuildNumber)
   mvn --version
   echo stop
   cd /home/vsts/work/r1/a
   ls -la
   echo afterdir
   cd $(System.ArtifactsDirectory)
   ls -la
   echo afterdir1
   pwd
   #npm install
   cd $(Pipeline.Workspace)
   cd work
   ls -la
   echo afterdir2
   cd /
   
  displayName: 'Command Line Script'

How to find my artifacts ?

0 Answers
Related