简体   繁体   English

Azure Devops Kubernetes-如何将.yaml文件上传为工件

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

I was using azure-pipelines.yml for Azure Pipelines' Build. 我正在使用azure-pipelines.yml进行Azure Pipelines的构建。 I included below scripts to make Artifact already which is used for Pipelines' Release. 我添加了以下脚本,以使Artifact已经用于管道的发布。

# 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"? 我应该在“部署到Kubernetes”下为Command设置什么?

How can I upload kubernetes .yaml file from GitHub to Artifacts? 如何从GitHub将kubernetes .yaml文件上传到Artifacts? (what is script in azure-pipelines.yml?) (azure-pipelines.yml中的脚本是什么?)

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: 您还可以将其他类型的任务添加到现有的Azure生成管道中,除了默认源外,还将下载另一个git存储库内容(您的kubernetes.yaml文件),如下所示:

- 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. 它将您的GitHub存储库内容放入$ {Build.Repository.LocalPath)中,从那里您可以像其他社区成员一样通过另一个类似于powershell的任务将其推送到$(Build.ArtifactStagingDirectory)中。

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. 请注意, fakhrulhilal-maktum.GitDownloader.git-downloader.GitDownloader是自定义任务,因此您首先需要将其安装到DevOps Azure项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM