0

我正在使用 bitbucket 管道将工件发布到 AWS 代码工件,一切运行良好,但令牌的 12 小时有效期需要我每次更新密码。谁能指导我如何使这个过程自动化?

编辑:终于能够自己解决了。

pipelines:
  default:
    - step:
        name: test
        image: atlassian/pipelines-awscli
        script:
           - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
           - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
           - export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
           - aws codeartifact get-authorization-token --domain XXXXX --domain-owner XXXXXx --query authorizationToken --output text > pass.txt
           - value=$(<pass.txt)
           - echo $value
           - echo "export value=$value" set_env.sh

           - printenv > set_env.sh 

        artifacts:
           - set_env.sh
     
              
    - step:
        name: maven
        image: maven:3.8.1
        caches:
          - maven
        script: # Modify the commands below to build your repository.
         
          - source set_env.sh
          - echo $value
          - sed -i 's/passwd12/'"$value"'/g' ./settings.xml
          - cat settings.xml
          - mvn clean deploy -s settings.xml -P snapshot
      
4

0 回答 0