Build Coordinator #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Coordinator | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_type: | |
| description: 'The type of build to perform. For release build, we upload to the "prod-data-share.springtail.internal" bucket (in production account), for debug builds we upload to the "data-share.springtail.internal" bucket (in development account).' | |
| type: choice | |
| default: "release" | |
| options: | |
| - release | |
| - debug | |
| permissions: | |
| id-token: write | |
| contents: read | |
| checks: write | |
| jobs: | |
| build: | |
| runs-on: warp-ubuntu-latest-arm64-4x-spot | |
| timeout-minutes: 35 | |
| container: | |
| image: ${{ vars.DEV_SUPPORT_ECR_REPO_URI }}:${{ inputs.build_type == 'release' && vars.RELEASE_BUILDER_IMAGE_VERSION || vars.BUILDER_IMAGE_VERSION }} | |
| credentials: | |
| username: AWS | |
| password: "${{ secrets.DEV_SUPPORT_ECR_PW }}" | |
| env: | |
| PACKAGE_BUCKET_NAME: ${{ inputs.build_type == 'release' && 'prod-data-share.springtail.internal' || 'data-share.springtail.internal' }} | |
| COORDINATOR_S3_PREFIX: stc | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: install-aws-cli-action | |
| uses: unfor19/install-aws-cli-action@v1 | |
| with: | |
| version: 2 # default | |
| verbose: false # default | |
| arch: arm64 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.DEV_AWS_ROLE_ARN }} | |
| role-session-name: tempSession | |
| aws-region: us-east-1 | |
| - name: Build | |
| run: | | |
| git config --global --add safe.directory /__w/springtail/springtail | |
| if [ "${{ inputs.build_type }}" = "release" ]; then | |
| ./release.sh | |
| else | |
| ./debug.sh | |
| fi | |
| - name: Pack Coordinator | |
| run: | | |
| cp -R python stc | |
| rm -rf stc/benchmarks stc/testing | |
| # Overwrite the stc/coordinator/config.yaml file with the following content | |
| echo "install_dir: '/opt/springtail'" > stc/coordinator/config.yaml | |
| echo "production: True" >> stc/coordinator/config.yaml | |
| echo "log_rotation_size: 104857600" >> stc/coordinator/config.yaml | |
| echo "log_rotation_count: 10" >> stc/coordinator/config.yaml | |
| tar -czf stc.tar.gz stc | |
| - name: Upload Coordinator | |
| run: | | |
| # generate a name with timestamp | |
| TIMESTAMP=$(date +%s) | |
| name="stc-${TIMESTAMP}.tar.gz" | |
| # Add this name to an current file | |
| echo $name > current | |
| aws s3 cp stc.tar.gz s3://${PACKAGE_BUCKET_NAME}/${COORDINATOR_S3_PREFIX}/${name} | |
| aws s3 cp current s3://${PACKAGE_BUCKET_NAME}/${COORDINATOR_S3_PREFIX}/current | |
| rm stc.tar.gz | |
| rm current |