How to auto deploying git repositories with submodules on AWS?

前端 未结 8 967
长发绾君心
长发绾君心 2021-02-04 15:02

I have a submodule in my git repository and my directory structure is like,

app
  -- folder1
  -- folder2
  -- submodule @5855

I have deployed

8条回答
  •  北海茫月
    2021-02-04 15:09

    Borrowing from the concepts of @MattBucci and @JoshuaEvans. Here is what we did. We could not install git in our pipeline, because of strict access/security issues with ssh. So we ended up doing this thru HTTP instead.

    1. I created a new Github Personal Access Token
    2. I stored the PAT in the AWS Secrets manager as a SecureString. This doesn't actually change anything within CodeBuild, since it's smart enough to just know how to decrypt the key
    3. I gave the "codebuild" role to read from Secrets manager
    4. I made my buildspec.yml file, using a bunch of the commands suggested by @matt-bucci and @JoshuaEvans, as well as some new ones
    version: 0.2
    env:
        variables:
          token: " token "
        secrets-manager:
          personalAccessToken: $personalAccessTokenPath
    phases:
        install:
          runtime-versions:
            nodejs: 12
          commands:
              - cd 
              - wget --header="Authorization:$token$personalAccessToken" --content-disposition  https://github.com/uri/zipball/$branch/
              - unzip project*.zip -d project-folder
              - rm -rf project*.zip
              - cd project-folder
              - mv project*/* .
              - rm -rf project*
              - cd 
        pre_build:
          commands:
            - xxx
        build:
          commands:
            - xxx
        post_build:
          commands:
            - xxx
    artifacts:
        files:
          - '**/*'
        base-directory: dist
    

    Hope this helps!

提交回复
热议问题