Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implementation to run kube acceptance tests on GKE #4961

Merged
merged 24 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/gke-kube-test-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: GKE Kube Acceptance Test
on:
schedule:
- cron: '0 */6 * * *'

jobs:
start-gke-kube-acceptance-test-runner:
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: 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: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2.2.1
with:
mode: start
github-token: ${{ secrets.SELF_RUNNER_GITHUB_ACCESS_TOKEN }}
ec2-image-id: ami-04bd6e81239f4f3fb
ec2-instance-type: c5.2xlarge
subnet-id: subnet-0469a9e68a379c1d3
security-group-id: sg-0793f3c9413f21970
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)
steps:
- 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'

- uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Install Pyenv
run: python3 -m pip install virtualenv==16.7.9 --user

- 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
env:
USER: root
HOME: /home/runner
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
./tools/bin/gke-kube-acceptance-test/acceptance_test_kube_gke.sh
# In case of self-hosted EC2 errors, remove this block.
stop-gke-kube-acceptance-test-runner:
name: Stop GKE Kube Acceptance Test EC2 Runner
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.2.1
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 }}

Loading