|
| 1 | +# DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows" |
| 2 | + |
| 3 | +name: Cluster (backup_pitr_mysqlshell) |
| 4 | +on: [push, pull_request] |
| 5 | +concurrency: |
| 6 | + group: format('{0}-{1}', ${{ github.ref }}, 'Cluster (backup_pitr_mysqlshell)') |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +permissions: read-all |
| 10 | + |
| 11 | +env: |
| 12 | + LAUNCHABLE_ORGANIZATION: "vitess" |
| 13 | + LAUNCHABLE_WORKSPACE: "vitess-app" |
| 14 | + GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}" |
| 15 | + GOPRIVATE: github.com/slackhq/vitess-addons |
| 16 | + GH_ACCESS_TOKEN: "${{ secrets.GH_ACCESS_TOKEN }}" |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + name: Run endtoend tests on Cluster (backup_pitr_mysqlshell) |
| 21 | + runs-on: |
| 22 | + group: vitess-ubuntu20 |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Skip CI |
| 26 | + run: | |
| 27 | + if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then |
| 28 | + echo "skipping CI due to the 'Skip CI' label" |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Check if workflow needs to be skipped |
| 33 | + id: skip-workflow |
| 34 | + run: | |
| 35 | + skip='false' |
| 36 | + echo Skip ${skip} |
| 37 | + echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT |
| 38 | +
|
| 39 | + PR_DATA=$(curl \ |
| 40 | + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
| 41 | + -H "Accept: application/vnd.github.v3+json" \ |
| 42 | + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}") |
| 43 | + draft=$(echo "$PR_DATA" | jq .draft -r) |
| 44 | + echo "is_draft=${draft}" >> $GITHUB_OUTPUT |
| 45 | +
|
| 46 | + - name: Check out code |
| 47 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Check for changes in relevant files |
| 51 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' |
| 52 | + |
| 53 | + id: changes |
| 54 | + with: |
| 55 | + token: '' |
| 56 | + filters: | |
| 57 | + end_to_end: |
| 58 | + - 'go/**/*.go' |
| 59 | + - 'go/vt/sidecardb/**/*.sql' |
| 60 | + - 'go/test/endtoend/onlineddl/vrepl_suite/**' |
| 61 | + - 'test.go' |
| 62 | + - 'Makefile' |
| 63 | + - 'build.env' |
| 64 | + - 'go.sum' |
| 65 | + - 'go.mod' |
| 66 | + - 'proto/*.proto' |
| 67 | + - 'tools/**' |
| 68 | + - 'config/**' |
| 69 | + - 'bootstrap.sh' |
| 70 | + - '.github/workflows/cluster_endtoend_backup_pitr_mysqlshell.yml' |
| 71 | +
|
| 72 | + - name: Set up Go |
| 73 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' |
| 74 | + uses: actions/setup-go@v5 |
| 75 | + with: |
| 76 | + go-version: 1.22.8 |
| 77 | + |
| 78 | + - name: Setup github.com/slackhq/vitess-addons access token |
| 79 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' |
| 80 | + run: git config --global url.https://[email protected]/.insteadOf https://github.com/ |
| 81 | + |
| 82 | + - name: Set up python |
| 83 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' |
| 84 | + uses: actions/setup-python@v5 |
| 85 | + |
| 86 | + - name: Tune the OS |
| 87 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' |
| 88 | + run: | |
| 89 | + # Limit local port range to not use ports that overlap with server side |
| 90 | + # ports that we listen on. |
| 91 | + sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535" |
| 92 | + # 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 |
| 93 | + echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf |
| 94 | + sudo sysctl -p /etc/sysctl.conf |
| 95 | +
|
| 96 | + - name: Get dependencies |
| 97 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' |
| 98 | + run: | |
| 99 | + |
| 100 | + # Get key to latest MySQL repo |
| 101 | + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C |
| 102 | + # Setup MySQL 8.0 |
| 103 | + wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb |
| 104 | + echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections |
| 105 | + sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config* |
| 106 | + sudo apt-get update |
| 107 | + # Install everything else we need, and configure |
| 108 | + sudo apt-get -qq install -y mysql-server mysql-shell mysql-client make unzip g++ etcd curl git wget eatmydata xz-utils libncurses5 |
| 109 | +
|
| 110 | + sudo service mysql stop |
| 111 | + sudo service etcd stop |
| 112 | + sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ |
| 113 | + sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld |
| 114 | + go mod download |
| 115 | +
|
| 116 | + # install JUnit report formatter |
| 117 | + go install github.com/vitessio/go-junit-report@HEAD |
| 118 | +
|
| 119 | + - name: Setup launchable dependencies |
| 120 | + if: steps.skip-workflow.outputs.is_draft == 'false' && steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main' |
| 121 | + run: | |
| 122 | + # Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up |
| 123 | + pip3 install --user launchable~=1.0 > /dev/null |
| 124 | +
|
| 125 | + # verify that launchable setup is all correct. |
| 126 | + launchable verify || true |
| 127 | +
|
| 128 | + # Tell Launchable about the build you are producing and testing |
| 129 | + launchable record build --name "$GITHUB_RUN_ID" --no-commit-collection --source . |
| 130 | +
|
| 131 | + - name: Run cluster endtoend test |
| 132 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' |
| 133 | + timeout-minutes: 45 |
| 134 | + run: | |
| 135 | + # We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file |
| 136 | + # which musn't be more than 107 characters long. |
| 137 | + export VTDATAROOT="/tmp/" |
| 138 | + source build.env |
| 139 | +
|
| 140 | + set -exo pipefail |
| 141 | +
|
| 142 | + # run the tests however you normally do, then produce a JUnit XML file |
| 143 | + eatmydata -- go run test.go -docker=false -follow -shard backup_pitr_mysqlshell | tee -a output.txt | go-junit-report -set-exit-code > report.xml |
| 144 | +
|
| 145 | + - name: Print test output and Record test result in launchable if PR is not a draft |
| 146 | + if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always() |
| 147 | + run: | |
| 148 | + if [[ "${{steps.skip-workflow.outputs.is_draft}}" == "false" ]]; then |
| 149 | + # send recorded tests to launchable |
| 150 | + launchable record tests --build "$GITHUB_RUN_ID" go-test . || true |
| 151 | + fi |
| 152 | +
|
| 153 | + # print test output |
| 154 | + cat output.txt |
0 commit comments