Azure Devops Kubernetes - how to upload .yaml file as Artifact

12/7/2018

I was using azure-pipelines.yml for Azure Pipelines' Build. I included below scripts to make Artifact already which is used for Pipelines' Release.

# publish artifacts
- powershell: gci env:* | sort-object name | Format-Table -AutoSize | Out-File $env:BUILD_ARTIFACTSTAGINGDIRECTORY/environment-variables.txt

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)'
    artifactName: drop1
- task: DownloadBuildArtifacts@0
  inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop2'
    downloadPath: '$(System.ArtifactsDirectory)'

What should I set for Command under "Deploy to Kubernetes"?

How can I upload kubernetes .yaml file from GitHub to Artifacts? (what is script in azure-pipelines.yml?)

-- DaiKeung
artifacts
azure
azure-devops
kubernetes
yaml

1 Answer

12/7/2018

You can also add additional type of task to your existing Azure Build Pipeline, that will download another git repository content (your kubernetes.yaml files) in addition to default source, like this one:

- task: fakhrulhilal-maktum.GitDownloader.git-downloader.GitDownloader@0

It should put your GitHub repo content to $(Build.Repository.LocalPath), from where you can push it via another powershell-like task to $(Build.ArtifactStagingDirectory), like other community members mentioned.

Please note that fakhrulhilal-maktum.GitDownloader.git-downloader.GitDownloader is a custom task, so you will need first to install it to your DevOps Azure project.

-- Nepomucen
Source: StackOverflow