简体   繁体   English

IBM Cloud Code Engine:构建在步骤“step-build-and-push”中失败,错误为 UNAUTHORIZED

[英]IBM Cloud Code Engine: Build fails in step “step-build-and-push” with error UNAUTHORIZED

I have an existing IBM Cloud Code Engine project which was working before.我有一个以前运行过的现有 IBM Cloud Code Engine 项目。 I submitted a new buildrun, but it fails.我提交了一个新的构建运行,但它失败了。 Based on the error message it is due to permissions with the private image registry (IBM Cloud Container Registry).根据错误消息,这是由于私有映像注册表 (IBM Cloud Container Registry) 的权限所致。 The IAM API Key is valid and is working for other tasks. IAM API 密钥有效并且适用于其他任务。 There are no quota issues.不存在配额问题。

ibmcloud ce buildrun submit --build mybuild

Checking the status it shows failed.检查它显示的状态失败。 Getting to the logs, these are the lines of question:进入日志,这些是问题所在:

myproject-build-run-n9xm6-xxx-pod-yyy/step-build-and-push: error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "us.icr.io/henrik/myproject:latest": creating push check transport for us.icr.io failed: GET https://us.icr.io/oauth/token?scope=repository%3Ahenrik%myproject%3Apush%2Cpull&service=registry : UNAUTHORIZED: The login credentials are not valid, or your IBM Cloud account is not active.; myproject-build-run-n9xm6-xxx-pod-yyy/step-build-and-push:错误检查推送权限——确保您输入了正确的标签名称,并且您已通过正确的身份验证,然后重试:检查推送“us.icr.io/henrik/myproject:latest”的权限:为 us.icr.io 创建推送检查传输失败:GET https://us.icr.io/oauth/token?scope=repository%3Ahenrik%myproject %3Apush%2Cpull&service=registry : UNAUTHORIZED : 登录凭证无效,或者您的 IBM Cloud 帐户未激活。; The login credentials are not valid, or your IBM Cloud account is not active.登录凭证无效,或者您的 IBM Cloud 帐户未激活。

The error is the same regardless of whether I use the CLI or browser console.无论我使用 CLI 还是浏览器控制台,错误都是一样的。

It turns out that I had enabled enforced private endpoint access for the container registry, a security best practice.事实证明,我为容器注册表启用了强制私有端点访问,这是一种安全最佳实践。 However, with that I needed the right credentials in Code Engine to access the container registry .但是,我需要在代码引擎中使用正确的凭据来访问容器注册表 Using the IBM Cloud Container Registry, in Code Engine I needed to使用 IBM Cloud Container Registry,在代码引擎中我需要

  • create registry credentials for the registry server private.<region>.icr.io , eg, private.us.icr.io ,为注册服务器创建注册凭证private.<region>.icr.io ,例如private.us.icr.io
  • set the image name to have the private endpoint, too, eg, private.us.icr.io/henrik/myproject .将图像名称也设置为具有私有端点,例如private.us.icr.io/henrik/myproject

With both the credentials and the image name having matching server names, I succeeded and the error were gone.凭据和图像名称都具有匹配的服务器名称,我成功了,错误消失了。

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

相关问题 IBM Cloud Code Engine 无法为私有存储库构建 - IBM Cloud Code Engine fails to build for private repo 适用于iOS模拟器的IBM-Bluemix Push Service构建失败 - IBM-Bluemix Push Service build for iOS Simulator fails IBM Cloud:尝试创建 Code Engine 项目时出错 - IBM Cloud: Error trying to create Code Engine project 我可以在IBM Bluemix DevOps Services中使用不同版本的Node,构建步骤“ npm”构建器类型吗? - Can I use a different version of Node in the: IBM Bluemix DevOps Services, build step 'npm' builder type? IBM云:无法构建应用 - IBM cloud : Cannot build app 使用端口 80 部署标准容器时,IBM Cloud Code Engine 修订失败 - IBM Cloud Code Engine revision fails when deploying standard container with port 80 IBM Cloud Developer Tool:导致错误的idt构建/ bx开发构建(OCI运行时执行失败…) - IBM Cloud Developer Tool: idt build/bx dev build causing error (OCI runtime exec failed …) IBM Cloud DevOps Java构建+测试 - IBM Cloud DevOps java build + test 在 IBM 云上运行的 Openshift API 身份验证失败,出现 401 未经授权的错误 - Authentication with Openshift API running on IBM cloud failed with 401 unauthorized error IBM Cloud Code Engine:本地构建的容器镜像在部署时出现 exec 格式错误 - IBM Cloud Code Engine: Locally built container image gives exec format error when deployed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM