[英]Stop Azure Pipeline AWS ECR Push task removing forward slash from repository name
我正在嘗試將圖像從我的 Azure 管道推送到包含正斜杠的 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 '##########'
這是正確的,因為 repo 名稱是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 推送任務的源代碼,發現了問題。
將標志設置為 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
希望這可以幫助遇到同樣問題的其他人。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.