Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save subudear/04628a87469da9a48f2f8407b1fdebc0 to your computer and use it in GitHub Desktop.
Save subudear/04628a87469da9a48f2f8407b1fdebc0 to your computer and use it in GitHub Desktop.
upload or download files to/from artifactory using azure devops
trigger:
- master
jobs:
- job: BuildAndTest
workspace:
clean: all
pool:
name: Self-Hosted-Agent
steps:
- task: GoTool@0
inputs:
version: '1.17'
- task: Go@0
displayName: "Go Get"
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go@0
displayName: "Go Build"
inputs:
command: 'build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go@0
displayName: "Go Test"
inputs:
command: 'test'
arguments: './...'
- task: CopyFiles@2
displayName: "Copy files to ArtifactStaging"
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact"
inputs:
artifactName: drop
- task: ArtifactoryGenericUpload@2
inputs:
artifactoryService: 'BasicAuth-artifactory'
specSource: 'taskConfiguration'
fileSpec: |
{
"files": [
{
"pattern": "*.go",
"target": "uploadordownload-generic-local/upload/"
},
{
"pattern": "*.yaml",
"target": "uploadordownload-generic-local/upload/"
}
]
}
failNoOp: true
- task: ArtifactoryGenericDownload@3
inputs:
connection: 'BasicAuth-artifactory'
specSource: 'taskConfiguration'
fileSpec: |
{
"files": [
{
"pattern": "uploadordownload-generic-local/upload/*.go",
"target": "c:\\download\\"
}
]
}
failNoOp: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment