diff --git a/.github/actions/build-branch/action.yml b/.github/actions/build-branch/action.yml index f8940ee04adfa..1f27e6c478b1b 100644 --- a/.github/actions/build-branch/action.yml +++ b/.github/actions/build-branch/action.yml @@ -4,6 +4,10 @@ inputs: branch_version_tag: description: 'Used to tag jars and docker images with a branch-specific version (should use the form "dev-" to pass AirbyteVersion validation)' required: false + build_docker_images: + description: 'Build docker images' + default: 'true' + required: false outputs: branch_version_tag: description: "Tag used for jars and docker images. Either user specified or auto generated as `dev-`" @@ -20,35 +24,17 @@ runs: [[ "${{ inputs.branch_version_tag }}" != '' ]] && echo "branch_version_tag=${{ inputs.branch_version_tag }}" >> $GITHUB_OUTPUT \ || { short_hash=$(git rev-parse --short=10 HEAD); echo "branch_version_tag=dev-$short_hash" >> $GITHUB_OUTPUT ; } - - uses: actions/setup-java@v3 - with: - distribution: "zulu" - java-version: "17" - - - uses: actions/setup-node@v3 - with: - node-version: "lts/*" - - - uses: actions/setup-python@v4 - with: - python-version: "3.9" + - name: Prepare Runner for Building + uses: ./.github/actions/runner-prepare-for-build - - name: Set up CI Gradle Properties - run: | - mkdir -p ~/.gradle/ - cat > ~/.gradle/gradle.properties < ~/.gradle/gradle.properties <> $GITHUB_ENV shell: bash + - name: Prepare Runner for Building + uses: ./.github/actions/runner-prepare-for-build + + # Put tars/artifacts in the correct build directories so docker buildx can find the artifacts it needs when building docker images + - name: Prepare Docker context + run: VERSION=${{ needs.generate-tags.outputs.dev_tag }} SUB_BUILD=PLATFORM ./gradlew copyGeneratedTar airbyte-db:db-lib:copyInitSql + shell: bash + + # Build docker images using docker buildx (for multi platform) - name: Push Docker Images env: VERSION: ${{ needs.generate-tags.outputs.dev_tag }} @@ -133,3 +158,37 @@ jobs: - name: Cleanup Docker buildx run: docker buildx rm oss-buildx shell: bash + + stop-runner: + name: "Stop Build EC2 Runner" + timeout-minutes: 10 + needs: + - start-runner # required to get output from the start-runner job + - docker-push # wait until all publish steps are done + runs-on: ubuntu-latest + # Always is required to stop the runner even if the previous job has errors. However always() runs even if the previous step is skipped. + # Thus, we check for skipped here. + if: ${{ always() && needs.start-runner.result != 'skipped'}} + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - name: Checkout Airbyte + uses: actions/checkout@v3 + - name: Check PAT rate limits + run: | + ./tools/bin/find_non_rate_limited_PAT \ + ${{ secrets.AIRBYTEIO_PAT }} \ + ${{ secrets.OSS_BUILD_RUNNER_GITHUB_PAT }} \ + ${{ secrets.SUPERTOPHER_PAT }} \ + ${{ secrets.DAVINCHIA_PAT }} + - name: Stop EC2 runner + uses: airbytehq/ec2-github-runner@base64v1.1.0 + with: + mode: stop + github-token: ${{ env.PAT }} + label: ${{ needs.start-runner.outputs.label }} + ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}