Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
Restore Checks on Pull Requests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvonthenen committed Oct 25, 2021
1 parent 5ac772b commit 57df0ab
Show file tree
Hide file tree
Showing 16 changed files with 1,435 additions and 459 deletions.
50 changes: 10 additions & 40 deletions .github/workflows/build-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,23 @@ on:
tags-ignore:
- "**"
jobs:
start-runner:
setup-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Download Dependencies
shell: bash
run: |
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/ensure-dependencies.sh
chmod +x ./ensure-dependencies.sh
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/runner/setup.sh
chmod +x ./setup.sh
- name: Start EC2 runner
id: start-ec2-runner
env:
GITHUB_TOKEN: ${{ secrets.GH_CHECKS_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.RUNNER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNNER_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
shell: bash
run: |
./ensure-dependencies.sh
GITHUB_TOKEN=${GITHUB_TOKEN} AMI_ID=ami-0e264e3eabfba9c3d ./setup.sh
INSTANCE_ID=$(cat ./instanceid.txt)
echo "INSTANCE_ID: ${INSTANCE_ID}"
echo ::set-output name=ec2-instance-id::${INSTANCE_ID}
if [[ -f "./timedout.txt" ]]; then
exit 1
fi
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
echo "INSTANCE_NAME: ${INSTANCE_NAME}"
echo ::set-output name=ec2-instance-id::${INSTANCE_NAME}
build-release:
name: Build Release for Staging
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
needs: setup-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
Expand Down Expand Up @@ -75,29 +58,16 @@ jobs:
path: ./artifacts
destination: tce-cli-plugins-staging
credentials: ${{ secrets.GCP_BUCKET_SA }}
stop-runner:
teardown-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- setup-runner # required to get output from the setup-runner job
- build-release # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Download Dependencies
shell: bash
run: |
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/ensure-dependencies.sh
chmod +x ./ensure-dependencies.sh
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/runner/teardown.sh
chmod +x ./teardown.sh
- name: Stop EC2 runner
id: stop-ec2-runner
env:
GITHUB_TOKEN: ${{ secrets.GH_CHECKS_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.RUNNER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNNER_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
shell: bash
run: |
./ensure-dependencies.sh
GITHUB_TOKEN=${GITHUB_TOKEN} INSTANCE_ID=${{ needs.start-runner.outputs.ec2-instance-id }} ./teardown.sh
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
echo "INSTANCE_NAME: ${INSTANCE_NAME}"
58 changes: 14 additions & 44 deletions .github/workflows/check-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,23 @@ on:
- "**"

jobs:
start-runner:
setup-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Download Dependencies
shell: bash
run: |
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/ensure-dependencies.sh
chmod +x ./ensure-dependencies.sh
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/runner/setup.sh
chmod +x ./setup.sh
- name: Start EC2 runner
id: start-ec2-runner
env:
GITHUB_TOKEN: ${{ secrets.GH_CHECKS_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.RUNNER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNNER_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
shell: bash
run: |
./ensure-dependencies.sh
GITHUB_TOKEN=${GITHUB_TOKEN} AMI_ID=ami-0e264e3eabfba9c3d ./setup.sh
INSTANCE_ID=$(cat ./instanceid.txt)
echo "INSTANCE_ID: ${INSTANCE_ID}"
echo ::set-output name=ec2-instance-id::${INSTANCE_ID}
if [[ -f "./timedout.txt" ]]; then
exit 1
fi
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
echo "INSTANCE_NAME: ${INSTANCE_NAME}"
echo ::set-output name=ec2-instance-id::${INSTANCE_NAME}
build-release:
name: Build Release based on Main
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
needs: setup-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
Expand Down Expand Up @@ -77,9 +60,9 @@ jobs:
create-cluster:
name: Create Cluster
needs:
- start-runner # required to start the main job when the runner is ready
- setup-runner # required to start the main job when the runner is ready
- build-release
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Create Cluster
run: CLUSTER_PLAN=dev tanzu standalone-cluster create mytest -i docker -v 10
Expand All @@ -90,9 +73,9 @@ jobs:
delete-cluster:
name: Delete Cluster
needs:
- start-runner # required to start the main job when the runner is ready
- setup-runner # required to start the main job when the runner is ready
- create-cluster
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Delete Cluster
shell: bash
Expand All @@ -101,29 +84,16 @@ jobs:
shell: bash
run: |
./hack/runner/check-teardown.sh
stop-runner:
teardown-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- setup-runner # required to get output from the setup-runner job
- delete-cluster # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Download Dependencies
shell: bash
run: |
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/ensure-dependencies.sh
chmod +x ./ensure-dependencies.sh
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/runner/teardown.sh
chmod +x ./teardown.sh
- name: Stop EC2 runner
id: stop-ec2-runner
env:
GITHUB_TOKEN: ${{ secrets.GH_CHECKS_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.RUNNER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNNER_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
shell: bash
run: |
./ensure-dependencies.sh
GITHUB_TOKEN=${GITHUB_TOKEN} INSTANCE_ID=${{ needs.start-runner.outputs.ec2-instance-id }} ./teardown.sh
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
echo "INSTANCE_NAME: ${INSTANCE_NAME}"
98 changes: 20 additions & 78 deletions .github/workflows/check-pr-docker-management.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
name: Check - Management Docker Cluster
on:
push:
pull_request:
branches:
- main
paths:
- "Makefile"
- ".github/workflows/check-pr-docker-management.yaml"
types:
- assigned
- opened
- synchronize
- reopened
jobs:
start-runner:
setup-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Download Dependencies
shell: bash
run: |
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/ensure-dependencies.sh
chmod +x ./ensure-dependencies.sh
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/runner/setup.sh
chmod +x ./setup.sh
- name: Start EC2 runner
id: start-ec2-runner
env:
GITHUB_TOKEN: ${{ secrets.GH_CHECKS_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.RUNNER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNNER_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
shell: bash
run: |
./ensure-dependencies.sh
GITHUB_TOKEN=${GITHUB_TOKEN} AMI_ID=ami-0e264e3eabfba9c3d ./setup.sh
INSTANCE_ID=$(cat ./instanceid.txt)
echo "INSTANCE_ID: ${INSTANCE_ID}"
echo ::set-output name=ec2-instance-id::${INSTANCE_ID}
if [[ -f "./timedout.txt" ]]; then
exit 1
fi
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
echo "INSTANCE_NAME: ${INSTANCE_NAME}"
echo ::set-output name=ec2-instance-id::${INSTANCE_NAME}
build-release:
name: Build Release based on PR
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
needs: setup-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
Expand Down Expand Up @@ -75,9 +63,9 @@ jobs:
outputs:
create-cluster-time: ${{ steps.check-create-cluster.outputs.create-cluster-time }}
needs:
- start-runner # required to start the main job when the runner is ready
- setup-runner # required to start the main job when the runner is ready
- build-release
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Create Cluster
shell: bash
Expand All @@ -90,30 +78,14 @@ jobs:
CREATE_TIME=$(cat ./create-cluster-time.txt)
echo "CREATE_TIME: ${CREATE_TIME}"
echo ::set-output name=create-cluster-time::${CREATE_TIME}
report-cluster-create-time:
name: Report Cluster Creation Time
needs:
- start-runner # required to start the main job when the runner is ready
- create-cluster
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Report cluster create time
shell: bash
run: |
GIT_SHA=$(git rev-parse HEAD)
TCE_VERSION=$(git describe --tags --abbrev=0)
echo "tce.pr.management-cluster.create-time ${{ needs.create-cluster.outputs.create-cluster-time }} source=<tce.github.${{ github.event.number }}> sha=${GIT_SHA} version=${TCE_VERSION}" | curl \
--header "Authorization: Bearer ${{ secrets.VMW_WAVEFRONT_API_TOKEN }}" \
--data @- \
https://vmware.wavefront.com/report
delete-cluster:
name: Delete Cluster
outputs:
delete-cluster-time: ${{ steps.check-delete-cluster.outputs.delete-cluster-time }}
needs:
- start-runner # required to start the main job when the runner is ready
- setup-runner # required to start the main job when the runner is ready
- create-cluster
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
runs-on: ${{ needs.setup-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Delete Cluster
shell: bash
Expand All @@ -126,46 +98,16 @@ jobs:
DELETE_TIME=$(cat ./delete-cluster-time.txt)
echo "DELETE_TIME: ${DELETE_TIME}"
echo ::set-output name=delete-cluster-time::${DELETE_TIME}
report-cluster-delete-time:
name: Report Cluster Delete Time
needs:
- start-runner # required to start the main job when the runner is ready
- delete-cluster
runs-on: ${{ needs.start-runner.outputs.ec2-instance-id }} # run the job on the newly created runner
steps:
- name: Report cluster deletion time
shell: bash
run: |
GIT_SHA=$(git rev-parse HEAD)
TCE_VERSION=$(git describe --tags --abbrev=0)
echo "tce.pr.management-cluster.delete-time ${{ needs.delete-cluster.outputs.delete-cluster-time }} source=<tce.github.${{ github.event.number }}> sha=${GIT_SHA} version=${TCE_VERSION}" | curl \
--header "Authorization: Bearer ${{ secrets.VMW_WAVEFRONT_API_TOKEN }}" \
--data @- \
https://vmware.wavefront.com/report
stop-runner:
teardown-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- report-cluster-delete-time # also wait on cluster deletion being reported
- setup-runner # required to get output from the setup-runner job
- delete-cluster # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Download Dependencies
shell: bash
run: |
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/ensure-dependencies.sh
chmod +x ./ensure-dependencies.sh
curl -O -L https://raw.githubusercontent.com/vmware-tanzu/community-edition/main/hack/runner/teardown.sh
chmod +x ./teardown.sh
- name: Stop EC2 runner
id: stop-ec2-runner
env:
GITHUB_TOKEN: ${{ secrets.GH_CHECKS_ACCESS_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.RUNNER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNNER_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
shell: bash
run: |
./ensure-dependencies.sh
GITHUB_TOKEN=${GITHUB_TOKEN} INSTANCE_ID=${{ needs.start-runner.outputs.ec2-instance-id }} ./teardown.sh
INSTANCE_NAME="id-${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}"
echo "INSTANCE_NAME: ${INSTANCE_NAME}"
Loading

0 comments on commit 57df0ab

Please sign in to comment.