从Bitbucket管道运行授权CodeArtifact令牌
我将BitBucket用作源控制服务,我有兴趣开始使用其管道功能来构建和部署我的应用程序。我正在使用AWS CodeArtifact托管我的Java文物。
我遇到的问题是如何从Bitbucket管道中验证AWS CodeArtifact。
如何运行
aws sso login --profile XXXX
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token ....
是最好的做法来解决这个问题?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为
codeartifact_auth_token
env var的导出非常好。 For the first authentication to AWS, you probably want to take a look into Bitbucket OIDC capabilities:本质上,在您的AWS帐户中设置身份提供商,它将让您的管道仅通过声明来扮演角色
(还会导出
AWS_ROLE_ARN
某处)身份,假定的角色可以设置为每个存储库,部署阶段等粒度间隙级别,等
设置OIDC身份提供商可能会很麻烦。您可能有兴趣给予也是一个外观。
I think the exportation of the
CODEARTIFACT_AUTH_TOKEN
env var is quite fine. For the first authentication to AWS, you probably want to take a look into Bitbucket OIDC capabilities:Essentially, setting up an identity provider in you AWS account that will let your pipelines assume a role by just declaring
(also exporting an
AWS_ROLE_ARN
somewhere)Identities and the assumed roles can be set up to granular clearance levels per repository, deployment stage, etc
Setting up an OIDC identity provider can be cumbersome. You might be interested in giving https://registry.terraform.io/modules/calidae/bitbucket-oidc/aws/latest a look, even if you weren't using terraform.
我遇到了同样的问题,我创建了自己的管道。它可能会帮助您。
set_env.sh将在另一个步骤中设置您需要的$ codeartifact_auth_token来运行部署脚本。
管道存储库:
I had the same issue and I create my own pipe. It may help you.
The set_env.sh will set the $CODEARTIFACT_AUTH_TOKEN you need in another step to run your deploy script.
Pipe repository: https://bitbucket.org/rangel-tadeu/aws-codeartifact-deploy/src/master/