163 lines
6.2 KiB
YAML
163 lines
6.2 KiB
YAML
name: GKE Kube Acceptance Test
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
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
|
|
comment-id:
|
|
description: "The comment-id of the slash command. Used to update the comment with the status."
|
|
required: false
|
|
|
|
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 }}
|
|
start-gke-kube-acceptance-test-runner:
|
|
timeout-minutes: 10
|
|
name: Start GKE Kube Acceptance Test EC2 Runner
|
|
runs-on: ubuntu-latest
|
|
needs: find_valid_pat
|
|
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: ${{ github.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 }}
|
|
gke-kube-acceptance-test:
|
|
# In case of self-hosted EC2 errors, removed the `needs` line and switch back to running on ubuntu-latest.
|
|
needs: start-gke-kube-acceptance-test-runner # required to start the main job when the runner is ready
|
|
runs-on: ${{ needs.start-gke-kube-acceptance-test-runner.outputs.label }} # run the job on the newly created runner
|
|
name: GKE Acceptance Tests (Kube)
|
|
timeout-minutes: 90
|
|
steps:
|
|
- 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: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
|
|
|
|
- name: Checkout Airbyte
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: ${{ github.event.inputs.repo }}
|
|
ref: ${{ github.event.inputs.gitref }}
|
|
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: "17"
|
|
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: "lts/gallium"
|
|
|
|
- name: Fix EC-2 Runner
|
|
run: |
|
|
mkdir -p /home/runner
|
|
|
|
- name: Install socat (required for port forwarding)
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install socat
|
|
|
|
- name: Set up Cloud SDK
|
|
uses: google-github-actions/setup-gcloud@v0
|
|
with:
|
|
project_id: ${{ secrets.GKE_TEST_PROJECT_ID }}
|
|
service_account_key: ${{ secrets.GKE_TEST_SA_KEY }}
|
|
export_default_credentials: true
|
|
|
|
- name: Get GKE credentials
|
|
uses: google-github-actions/get-gke-credentials@main
|
|
with:
|
|
project_id: ${{ secrets.GKE_TEST_PROJECT_ID }}
|
|
credentials: ${{ secrets.GKE_TEST_SA_KEY }}
|
|
cluster_name: kube-acceptance-test-cluster
|
|
location: us-central1-c
|
|
|
|
- name: Install kubectl
|
|
run: |-
|
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
|
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
|
|
|
|
- name: Run End-to-End Acceptance Tests on GKE
|
|
id: gke-kube-test
|
|
env:
|
|
USER: root
|
|
HOME: /home/runner
|
|
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
|
ACTION_RUN_ID: ${{github.run_id}}
|
|
run: |
|
|
./tools/bin/gke-kube-acceptance-test/acceptance_test_kube_gke.sh
|
|
|
|
- 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: 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: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
|
|
# In case of self-hosted EC2 errors, remove this block.
|
|
stop-gke-kube-acceptance-test-runner:
|
|
name: Stop GKE Kube Acceptance Test EC2 Runner
|
|
timeout-minutes: 10
|
|
needs:
|
|
- start-gke-kube-acceptance-test-runner # required to get output from the start-runner job
|
|
- gke-kube-acceptance-test # required to wait when the main job is done
|
|
- find_valid_pat
|
|
runs-on: ubuntu-latest
|
|
if: ${{ always() }}
|
|
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-gke-kube-acceptance-test-runner.outputs.label }}
|
|
ec2-instance-id: ${{ needs.start-gke-kube-acceptance-test-runner.outputs.ec2-instance-id }}
|