发布生成项目任务结果"路径不存在"错误



我正试图使用默认的Azure DevOps模板将图像推送到AKS:

stages:
- stage: Build
displayName: Build stage
jobs:  
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- upload: manifests
artifact: manifests

这导致以下错误:

##[error]Path does not exist: /home/vsts/work/1/s/manifests

我已经尝试使用默认的发布任务

- task: PublishPipelineArtifact@1
inputs:
artifactName: 'manifests'
path: 'manifests'

但这并没有改变任何事情。有人能解释一下,这里发生了什么,以及为什么Msft的默认模板不起作用吗?

好的-在这个阶段,我必须管理,我对构建管道中的工件有一个彻底的误解。

upload(已弃用(和publish任务对于发布管道项目任务来说人手不足(https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml(

其次,publish关键字后面的路径是将要发布的相对文件夹。如果你使用Azure DevOps中的Kubernetes服务模板,它会在你的repo根目录上创建一个manifest文件夹,并用部署和服务yml文件预填充它。

我不想把它们放在那里(而且一定已经删除了文件夹(,所以我移动了它们并修改了路径:

- publish: $(System.DefaultWorkingDirectory)/Code/Database/Docker
artifact: sql-drop

(Docker文件夹是我保存Dockerfiles、Docker compose、overrides和所有其他用于旋转容器的jazz的地方(

现在,在我的部署任务中,我需要注意,我不能使用存储库中的文字路径。我需要先下载工件,然后使用工件的名称-";sql drop"作为文件夹名称:

steps:
#current means the current pipline. shorthand sytnax
- download: current
# name from the aritfact specifed above
artifact: sql-drop
- task: KubernetesManifest@0
displayName: Create imagePullSecret
inputs:
action: createSecret
secretName: $(imagePullSecret)
dockerRegistryEndpoint: $(dockerRegistryServiceConnection)

- task: KubernetesManifest@0
displayName: Deploy to Kubernetes cluster
inputs:
action: deploy
# Use sql-drop as folder name and specify manifests
manifests: |
$(Pipeline.Workspace)/sql-drop/his-sql.dev.deployment.yml
$(Pipeline.Workspace)/sql-drop/his-sql.dev.service.yml
imagePullSecrets: |
$(imagePullSecret)
containers: |
$(containerRegistry)/$(imageRepository):$(tag)

最新更新