1
0
mirror of synced 2026-01-06 06:04:16 -05:00
Files
airbyte/.github/workflows/gke-kube-test-command.yml
2021-10-25 17:12:59 -07:00

132 lines
5.0 KiB
YAML

name: GKE Kube Acceptance Test
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
inputs:
comment-id:
description: 'The comment-id of the slash command. Used to update the comment with the status.'
required: false
jobs:
start-gke-kube-acceptance-test-runner:
timeout-minutes: 10
name: Start GKE Kube Acceptance Test EC2 Runner
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
- 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: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
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
- uses: actions/setup-java@v1
with:
java-version: '14'
- uses: actions/setup-node@v1
with:
node-version: '14.7'
- 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@master
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_PASSWORD: ${{ secrets.DOCKER_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
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: machulav/ec2-github-runner@v2.3.0
with:
mode: stop
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
label: ${{ needs.start-gke-kube-acceptance-test-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-gke-kube-acceptance-test-runner.outputs.ec2-instance-id }}