Skip to content

Commit

Permalink
Skip CI workflows on push for pull requests (vitessio#10768)
Browse files Browse the repository at this point in the history
* Initial addition of the skip workflow directive in docker_test_cluster_10

Signed-off-by: Florent Poinsard <[email protected]>

* Changed assertion in skip workflow step

Signed-off-by: Florent Poinsard <[email protected]>

* Use github.event.push.ref to check the event type

Signed-off-by: Florent Poinsard <[email protected]>

* Addition of debug information in the skip ci step

Signed-off-by: Florent Poinsard <[email protected]>

* Addition of debug information in the skip ci step

Signed-off-by: Florent Poinsard <[email protected]>

* Addition of debug information in the skip ci step

Signed-off-by: Florent Poinsard <[email protected]>

* Skip the step based on the skip-workflow step

Signed-off-by: Florent Poinsard <[email protected]>

* Applied the skip-workflow step on all the workflows

Signed-off-by: Florent Poinsard <[email protected]>

* Changed the vtadmin workflows' default directory to root

Signed-off-by: Florent Poinsard <[email protected]>

* Removed unwanted workflow files

Signed-off-by: Florent Poinsard <[email protected]>

* Better bash syntax for regex condition

Signed-off-by: Florent Poinsard <[email protected]>

* Changed skip to use boolean string and use better regex to match the release branch

Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui authored Jul 25, 2022
1 parent c0ee8d3 commit b5f4b57
Show file tree
Hide file tree
Showing 100 changed files with 1,940 additions and 749 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/check_make_vtadmin_authz_testgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ jobs:
name: Check Make vtadmin_authz_testgen
runs-on: ubuntu-latest
steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "::set-output name=skip-workflow::${skip}"
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v2

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
Expand All @@ -25,18 +37,18 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
if: steps.changes.outputs.vtadmin_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.vtadmin_changes == 'true'
with:
go-version: 1.18.4

- name: Tune the OS
if: steps.changes.outputs.vtadmin_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.vtadmin_changes == 'true'
run: |
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range
- name: Get dependencies
if: steps.changes.outputs.vtadmin_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.vtadmin_changes == 'true'
run: |
sudo apt-get update
sudo apt-get install -y make unzip g++ etcd curl git wget
Expand All @@ -45,11 +57,11 @@ jobs:
go install golang.org/x/tools/cmd/goimports@latest
- name: Run make minimaltools
if: steps.changes.outputs.vtadmin_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.vtadmin_changes == 'true'
run: |
make minimaltools
- name: check_make_vtadmin_authz_testgen
if: steps.changes.outputs.vtadmin_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.vtadmin_changes == 'true'
run: |
tools/check_make_vtadmin_authz_testgen.sh
20 changes: 16 additions & 4 deletions .github/workflows/check_make_vtadmin_web_proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ jobs:
name: Check Make VTAdmin Web Proto
runs-on: ubuntu-latest
steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "::set-output name=skip-workflow::${skip}"
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v2

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
Expand All @@ -27,23 +39,23 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
if: steps.changes.outputs.proto_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'
with:
go-version: 1.18.4

- name: Setup Node
if: steps.changes.outputs.proto_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'
uses: actions/setup-node@v2
with:
# node-version should match package.json
node-version: '16.13.0'

- name: Install npm dependencies
if: steps.changes.outputs.proto_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'
run: npm ci
working-directory: ./web/vtadmin

- name: check_make_vtadmin_web_proto
if: steps.changes.outputs.proto_changes == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'
run: |
tools/check_make_vtadmin_web_proto.sh
24 changes: 18 additions & 6 deletions .github/workflows/cluster_endtoend_12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ jobs:
runs-on: self-hosted

steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "::set-output name=skip-workflow::${skip}"
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v2

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
Expand All @@ -35,30 +47,30 @@ jobs:
- '.github/workflows/**'
- name: Build Docker Image
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: docker build -f ./.github/docker/cluster_test_12/Dockerfile -t cluster_test_12:$GITHUB_SHA .

- name: Run test
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 30
run: docker run --name "cluster_test_12_$GITHUB_SHA" cluster_test_12:$GITHUB_SHA /bin/bash -c 'source build.env && go run test.go -keep-data=true -docker=false -print-log -follow -shard 12 -- -- --keep-data=true'

- name: Print Volume Used
if: always() && steps.changes.outputs.end_to_end == 'true'
if: always() && steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker inspect -f '{{ (index .Mounts 0).Name }}' cluster_test_12_$GITHUB_SHA
- name: Cleanup Docker Volume
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker rm -v cluster_test_12_$GITHUB_SHA
- name: Cleanup Docker Container
if: always() && steps.changes.outputs.end_to_end == 'true'
if: always() && steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker rm -f cluster_test_12_$GITHUB_SHA
- name: Cleanup Docker Image
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker image rm cluster_test_12:$GITHUB_SHA
26 changes: 19 additions & 7 deletions .github/workflows/cluster_endtoend_13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ jobs:
runs-on: ubuntu-18.04

steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "::set-output name=skip-workflow::${skip}"
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v2

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
Expand All @@ -39,25 +51,25 @@ jobs:
- '.github/workflows/**'
- name: Set up Go
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/setup-go@v2
with:
go-version: 1.18.4

- name: Set up python
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/setup-python@v2

- name: Tune the OS
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range
# Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
- name: Get dependencies
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
sudo apt-get update
sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata
Expand All @@ -71,7 +83,7 @@ jobs:
go install github.com/vitessio/go-junit-report@HEAD
- name: Setup launchable dependencies
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
# Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up
pip3 install --user launchable~=1.0 > /dev/null
Expand All @@ -83,7 +95,7 @@ jobs:
launchable record build --name "$GITHUB_RUN_ID" --source .
- name: Run cluster endtoend test
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 30
run: |
# We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file
Expand All @@ -97,7 +109,7 @@ jobs:
eatmydata -- go run test.go -docker=false -follow -shard 13 | tee -a output.txt | go-junit-report -set-exit-code > report.xml
- name: Print test output and Record test result in launchable
if: steps.changes.outputs.end_to_end == 'true' && always()
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
run: |
# send recorded tests to launchable
launchable record tests --build "$GITHUB_RUN_ID" go-test . || true
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/cluster_endtoend_15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ jobs:
runs-on: ubuntu-18.04

steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "::set-output name=skip-workflow::${skip}"
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v2

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
Expand All @@ -39,25 +51,25 @@ jobs:
- '.github/workflows/**'
- name: Set up Go
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/setup-go@v2
with:
go-version: 1.18.4

- name: Set up python
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
uses: actions/setup-python@v2

- name: Tune the OS
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
echo '1024 65535' | sudo tee -a /proc/sys/net/ipv4/ip_local_port_range
# Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
- name: Get dependencies
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
sudo apt-get update
sudo apt-get install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata
Expand All @@ -71,7 +83,7 @@ jobs:
go install github.com/vitessio/go-junit-report@HEAD
- name: Setup launchable dependencies
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
# Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up
pip3 install --user launchable~=1.0 > /dev/null
Expand All @@ -83,7 +95,7 @@ jobs:
launchable record build --name "$GITHUB_RUN_ID" --source .
- name: Run cluster endtoend test
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 30
run: |
# We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file
Expand All @@ -97,7 +109,7 @@ jobs:
eatmydata -- go run test.go -docker=false -follow -shard 15 | tee -a output.txt | go-junit-report -set-exit-code > report.xml
- name: Print test output and Record test result in launchable
if: steps.changes.outputs.end_to_end == 'true' && always()
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()
run: |
# send recorded tests to launchable
launchable record tests --build "$GITHUB_RUN_ID" go-test . || true
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/cluster_endtoend_18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ jobs:
runs-on: self-hosted

steps:
- name: Check if workflow needs to be skipped
id: skip-workflow
run: |
skip='false'
if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then
skip='true'
fi
echo Skip ${skip}
echo "::set-output name=skip-workflow::${skip}"
- name: Check out code
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: actions/checkout@v2

- name: Check for changes in relevant files
if: steps.skip-workflow.outputs.skip-workflow == 'false'
uses: frouioui/paths-filter@main
id: changes
with:
Expand All @@ -35,30 +47,30 @@ jobs:
- '.github/workflows/**'
- name: Build Docker Image
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: docker build -f ./.github/docker/cluster_test_18/Dockerfile -t cluster_test_18:$GITHUB_SHA .

- name: Run test
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
timeout-minutes: 30
run: docker run --name "cluster_test_18_$GITHUB_SHA" cluster_test_18:$GITHUB_SHA /bin/bash -c 'source build.env && go run test.go -keep-data=true -docker=false -print-log -follow -shard 18 -- -- --keep-data=true'

- name: Print Volume Used
if: always() && steps.changes.outputs.end_to_end == 'true'
if: always() && steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker inspect -f '{{ (index .Mounts 0).Name }}' cluster_test_18_$GITHUB_SHA
- name: Cleanup Docker Volume
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker rm -v cluster_test_18_$GITHUB_SHA
- name: Cleanup Docker Container
if: always() && steps.changes.outputs.end_to_end == 'true'
if: always() && steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker rm -f cluster_test_18_$GITHUB_SHA
- name: Cleanup Docker Image
if: steps.changes.outputs.end_to_end == 'true'
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
docker image rm cluster_test_18:$GITHUB_SHA
Loading

0 comments on commit b5f4b57

Please sign in to comment.