停止 Azure Pipeline AWS ECR 推送任务从存储库名称中删除正斜杠
Stop Azure Pipeline AWS ECR Push task removing forward slash from repository name
我正在尝试将图像从我的 Azure Pipeline 推送到包含正斜杠的 AWS ECR,但管道一直失败,因为 ECR 任务似乎正在删除额外的正斜杠。
我的管道包含以下内容:
- task: ECRPushImage@1
displayName: 'Push latest image'
inputs:
imageSource: 'imagename'
sourceImageName: 'appname'
repositoryName: 'team-name/appname'
forceDockerNamingConventions: true
构建管道显示它正在从存储库名称中删除正斜杠:
Adding tag '##########.dkr.ecr.#########.amazonaws.com/team-nameappname:latest' to image 'appname:latest'
然后结束:
name unknown: The repository with name 'team-nameappname' does not exist in the registry with id '##########'
这是正确的,因为回购名称是 team-name/appname
如果我将 ECR 更改为不包含正斜杠,则任务会错误地标记我的图像:
Adding tag '##########.dkr.ecr.#########.amazonaws.com/team-name:latest' to image 'appname:latest'
我们有很多存储库,需要按团队名称和应用程序名称将它们分开。
我试过在名称中使用 //
,但这也会导致任务失败。
如何将我的图像推送到名称中带有正斜杠的 ECR?
我是否需要不使用 ECR 推送任务而是使用 docker
命令?或者 AWS CLI 任务?
我已经查看了文档和 SO 但没有任何运气:-(
原来是 forceDockerNamingConventions
引起了问题。 Docker 命名约定只允许小写字母、数字或 - 和 _。
我查看了 ECR 推送任务的源代码here,发现了问题。
将标志设置为 false 后(下面代码片段的最后一行),推送成功,名称中有正斜杠
- task: ECRPushImage@1
displayName: 'Push latest image'
inputs:
imageSource: 'imagename'
sourceImageName: 'appname'
repositoryName: 'team-name/appname'
forceDockerNamingConventions: false
我的存储库中现在有了正确的图像名称:-)
Pushing image '##########.dkr.ecr.#####.amazonaws.com/team-name/appname:latest' to Elastic Container Registry
希望这对遇到同样问题的其他人有所帮助。
我正在尝试将图像从我的 Azure Pipeline 推送到包含正斜杠的 AWS ECR,但管道一直失败,因为 ECR 任务似乎正在删除额外的正斜杠。
我的管道包含以下内容:
- task: ECRPushImage@1
displayName: 'Push latest image'
inputs:
imageSource: 'imagename'
sourceImageName: 'appname'
repositoryName: 'team-name/appname'
forceDockerNamingConventions: true
构建管道显示它正在从存储库名称中删除正斜杠:
Adding tag '##########.dkr.ecr.#########.amazonaws.com/team-nameappname:latest' to image 'appname:latest'
然后结束:
name unknown: The repository with name 'team-nameappname' does not exist in the registry with id '##########'
这是正确的,因为回购名称是 team-name/appname
如果我将 ECR 更改为不包含正斜杠,则任务会错误地标记我的图像:
Adding tag '##########.dkr.ecr.#########.amazonaws.com/team-name:latest' to image 'appname:latest'
我们有很多存储库,需要按团队名称和应用程序名称将它们分开。
我试过在名称中使用 //
,但这也会导致任务失败。
如何将我的图像推送到名称中带有正斜杠的 ECR?
我是否需要不使用 ECR 推送任务而是使用 docker
命令?或者 AWS CLI 任务?
我已经查看了文档和 SO 但没有任何运气:-(
原来是 forceDockerNamingConventions
引起了问题。 Docker 命名约定只允许小写字母、数字或 - 和 _。
我查看了 ECR 推送任务的源代码here,发现了问题。
将标志设置为 false 后(下面代码片段的最后一行),推送成功,名称中有正斜杠
- task: ECRPushImage@1
displayName: 'Push latest image'
inputs:
imageSource: 'imagename'
sourceImageName: 'appname'
repositoryName: 'team-name/appname'
forceDockerNamingConventions: false
我的存储库中现在有了正确的图像名称:-)
Pushing image '##########.dkr.ecr.#####.amazonaws.com/team-name/appname:latest' to Elastic Container Registry
希望这对遇到同样问题的其他人有所帮助。