name: Publish External Connector Image on: workflow_dispatch: inputs: connector: description: "Airbyte Connector image" required: true version: description: "Airbyte Connector version" required: true comment-id: description: "The comment-id of the slash command. Used to update the comment with the status." required: false repo: description: "Repo to check out code from. Defaults to the main airbyte repo. Set this when building connectors from forked repos." required: false default: "airbytehq/airbyte" gitref: description: "The git ref to check out from the specified repository." required: false default: master jobs: find_valid_pat: name: "Find a PAT with room for actions" timeout-minutes: 10 runs-on: ubuntu-latest outputs: pat: ${{ steps.variables.outputs.pat }} steps: - name: Checkout Airbyte uses: actions/checkout@v2 - name: Check PAT rate limits id: variables run: | ./tools/bin/find_non_rate_limited_PAT \ ${{ secrets.AIRBYTEIO_PAT }} \ ${{ secrets.OSS_BUILD_RUNNER_GITHUB_PAT }} \ ${{ secrets.SUPERTOPHER_PAT }} \ ${{ secrets.DAVINCHIA_PAT }} ## Gradle Build # In case of self-hosted EC2 errors, remove this block. start-publish-image-runner: name: Start Build EC2 Runner needs: find_valid_pat runs-on: ubuntu-latest outputs: label: ${{ steps.start-ec2-runner.outputs.label }} ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} steps: - name: Checkout Airbyte uses: actions/checkout@v2 with: repository: ${{ gituhb.event.inputs.repo }} ref: ${{ github.event.inputs.gitref }} - name: Start AWS Runner id: start-ec2-runner uses: ./.github/actions/start-aws-runner with: aws-access-key-id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} github-token: ${{ needs.find_valid_pat.outputs.pat }} # 80 gb disk ec2-image-id: ami-0d648081937c75a73 publish-image: needs: start-publish-image-runner runs-on: ${{ needs.start-publish-image-runner.outputs.label }} environment: more-secrets steps: - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v0 with: service_account_key: ${{ secrets.SPEC_CACHE_SERVICE_ACCOUNT_KEY }} export_default_credentials: true - name: Link comment to workflow run if: github.event.inputs.comment-id uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ github.event.inputs.comment-id }} body: | > :clock2: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - name: Checkout Airbyte uses: actions/checkout@v2 with: repository: ${{ gituhb.event.inputs.repo }} ref: ${{ github.event.inputs.gitref }} - run: | echo "$SPEC_CACHE_SERVICE_ACCOUNT_KEY" > spec_cache_key_file.json && docker login -u ${DOCKER_HUB_USERNAME} -p ${DOCKER_HUB_PASSWORD} ./tools/integrations/manage.sh publish_external ${{ github.event.inputs.connector }} ${{ github.event.inputs.version }} name: publish ${{ github.event.inputs.connector }} id: publish env: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} # Oracle expects this variable to be set. Although usually present, this is not set by default on Github virtual runners. TZ: UTC - name: Add Success Comment if: github.event.inputs.comment-id && success() uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ github.event.inputs.comment-id }} body: | > :white_check_mark: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - name: Add Failure Comment if: github.event.inputs.comment-id && !success() uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ github.event.inputs.comment-id }} body: | > :x: ${{github.event.inputs.connector}} https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - name: Slack Notification - Failure if: failure() uses: rtCamp/action-slack-notify@master env: SLACK_WEBHOOK: ${{ secrets.BUILD_SLACK_WEBHOOK }} SLACK_USERNAME: Buildozer SLACK_ICON: https://avatars.slack-edge.com/temp/2020-09-01/1342729352468_209b10acd6ff13a649a1.jpg SLACK_COLOR: DC143C SLACK_TITLE: "Failed to publish connector ${{ github.event.inputs.connector }} from branch ${{ github.ref }}" SLACK_FOOTER: "" # In case of self-hosted EC2 errors, remove this block. stop-publish-image-runner: name: Stop Build EC2 Runner needs: - start-publish-image-runner # required to get output from the start-runner job - publish-image # required to wait when the main job is done - find_valid_pat runs-on: ubuntu-latest if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs 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: Stop EC2 runner uses: supertopher/ec2-github-runner@base64v1.0.10 with: mode: stop github-token: ${{ needs.find_valid_pat.outputs.pat }} label: ${{ needs.start-publish-image-runner.outputs.label }} ec2-instance-id: ${{ needs.start-publish-image-runner.outputs.ec2-instance-id }}