Skip to content

Commit 8c1ec21

Browse files
vitess-bot[bot]arthurschreiber
authored andcommitted
[release-22.0] ci: use the newest mysql apt config package (vitessio#18790) (vitessio#18793)
Signed-off-by: Arthur Schreiber <arthur@planetscale.com> Co-authored-by: Arthur Schreiber <arthurschreiber@github.com> Co-authored-by: Arthur Schreiber <arthur@planetscale.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
1 parent 693af11 commit 8c1ec21

7 files changed

+256
-0
lines changed

.github/workflows/codecov.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Code Coverage
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
- "release-[0-9]+.[0-9]"
7+
tags: '**'
8+
pull_request:
9+
branches: '**'
10+
concurrency:
11+
group: format('{0}-{1}', ${{ github.ref }}, 'Code Coverage')
12+
cancel-in-progress: true
13+
14+
permissions: read-all
15+
16+
jobs:
17+
test:
18+
name: Code Coverage
19+
runs-on: ubuntu-24.04
20+
21+
steps:
22+
- name: Check out code
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
persist-credentials: 'false'
26+
27+
- name: Check for changes in files relevant to code coverage
28+
uses: dorny/paths-filter@ebc4d7e9ebcb0b1eb21480bb8f43113e996ac77a # v3.0.1
29+
id: changes
30+
with:
31+
token: ''
32+
filters: |
33+
changed_files:
34+
- .github/workflows/codecov.yml
35+
- 'go/**'
36+
- go.mod
37+
- go.sum
38+
- Makefile
39+
40+
- name: Set up Go
41+
if: steps.changes.outputs.changed_files == 'true'
42+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
43+
with:
44+
go-version-file: go.mod
45+
46+
- name: Set up python
47+
if: steps.changes.outputs.changed_files == 'true'
48+
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
49+
50+
- name: Tune the OS
51+
if: steps.changes.outputs.changed_files == 'true'
52+
run: |
53+
sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535"
54+
# 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
55+
echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf
56+
sudo sysctl -p /etc/sysctl.conf
57+
58+
# Don't waste a bunch of time processing man-db triggers
59+
echo "set man-db/auto-update false" | sudo debconf-communicate
60+
sudo dpkg-reconfigure man-db
61+
62+
- name: Get dependencies
63+
if: steps.changes.outputs.changed_files == 'true'
64+
run: |
65+
export DEBIAN_FRONTEND="noninteractive"
66+
sudo apt-get update
67+
68+
# Uninstall any previously installed MySQL first
69+
# sudo systemctl stop apparmor
70+
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
71+
sudo apt-get -y autoremove
72+
sudo apt-get -y autoclean
73+
# sudo deluser mysql
74+
# sudo rm -rf /var/lib/mysql
75+
# sudo rm -rf /etc/mysql
76+
77+
# Get key to latest MySQL repo
78+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
79+
80+
# mysql80
81+
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
82+
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
83+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
84+
sudo apt-get update
85+
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client
86+
87+
sudo apt-get install -y make unzip g++ curl git wget ant openjdk-11-jdk eatmydata
88+
89+
sudo service mysql stop
90+
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
91+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
92+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld || echo "could not remove mysqld profile"
93+
94+
mkdir -p dist bin
95+
curl -s -L https://github.com/coreos/etcd/releases/download/v3.5.17/etcd-v3.5.17-linux-amd64.tar.gz | tar -zxC dist
96+
mv dist/etcd-v3.5.17-linux-amd64/{etcd,etcdctl} bin/
97+
98+
go mod download
99+
go install golang.org/x/tools/cmd/goimports@latest
100+
101+
- name: Run make tools
102+
if: steps.changes.outputs.changed_files == 'true'
103+
run: |
104+
make tools
105+
106+
- name: Run unit tests and generate code coverage reports
107+
if: steps.changes.outputs.changed_files == 'true'
108+
timeout-minutes: 45
109+
run: |
110+
set -exo pipefail
111+
# We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file
112+
# which musn't be more than 107 characters long.
113+
export VTDATAROOT="/tmp/"
114+
115+
export NOVTADMINBUILD=1
116+
117+
# Exclude endtoend tests from the coverage report.
118+
# TODO: figure out how best to include our endtoend tests in the coverage report.
119+
rm -rf go/test/endtoend go/*/endtoend go/vt/*/endtoend go/cmd/vttestserver
120+
121+
eatmydata -- make unit_test_cover
122+
123+
# Restore the files we deleted as codecov tries to fix their paths.
124+
git reset --hard HEAD
125+
126+
- name: Upload coverage reports to codecov.io
127+
if: steps.changes.outputs.changed_files == 'true'
128+
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # https://github.com/codecov/codecov-action/releases/tag/v5.0.7
129+
with:
130+
fail_ci_if_error: true
131+
verbose: true
132+
env:
133+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-**.0
8+
schedule:
9+
- cron: '0 0 * * 1'
10+
workflow_dispatch:
11+
12+
permissions: read-all
13+
14+
jobs:
15+
analyze:
16+
name: Analyze
17+
runs-on: ubuntu-24.04
18+
permissions:
19+
actions: read
20+
contents: read
21+
security-events: write
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
language: [ 'go', 'javascript', 'python' ]
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
with:
32+
persist-credentials: 'false'
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
36+
with:
37+
go-version-file: go.mod
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v3
42+
with:
43+
languages: ${{ matrix.language }}
44+
# If you wish to specify cu stom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
48+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
49+
# queries: security-extended,security-and-quality
50+
51+
- name: Get base dependencies
52+
timeout-minutes: 10
53+
run: |
54+
sudo DEBIAN_FRONTEND="noninteractive" apt-get update
55+
# Uninstall any previously installed MySQL first
56+
# sudo systemctl stop apparmor
57+
sudo DEBIAN_FRONTEND="noninteractive" apt-get remove -y --purge mysql-server mysql-client mysql-common
58+
sudo apt-get -y autoremove
59+
sudo apt-get -y autoclean
60+
# sudo deluser mysql
61+
# sudo rm -rf /var/lib/mysql
62+
# sudo rm -rf /etc/mysql
63+
# Install mysql80
64+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
65+
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
66+
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
67+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
68+
sudo apt-get update
69+
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client
70+
# Install everything else we need, and configure
71+
sudo apt-get install -y make unzip g++ etcd-client etcd-server curl git wget eatmydata
72+
73+
sudo service mysql stop
74+
sudo service etcd stop
75+
sudo bash -c "echo '/usr/sbin/mysqld { }' > /etc/apparmor.d/usr.sbin.mysqld" # https://bugs.launchpad.net/ubuntu/+source/mariadb-10.1/+bug/1806263
76+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
77+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld || echo "could not remove mysqld profile"
78+
79+
# install JUnit report formatter
80+
go install github.com/vitessio/go-junit-report@HEAD
81+
82+
- name: Building binaries
83+
timeout-minutes: 30
84+
run: |
85+
source build.env
86+
make build
87+
88+
- name: Perform CodeQL Analysis
89+
uses: github/codeql-action/analyze@v3
90+
91+
- name: Slack Workflow Notification
92+
if: ${{ failure() }}
93+
uses: Gamesight/slack-workflow-status@master
94+
with:
95+
repo_token: ${{secrets.GITHUB_TOKEN}}
96+
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
97+
channel: '#codeql'
98+
name: 'CodeQL Workflows'
99+
100+
- name: Fail if needed
101+
if: ${{ failure() }}
102+
run: |
103+
exit 1

.github/workflows/unit_test_evalengine_mysql57.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ jobs:
9898
9999
# Get key to latest MySQL repo
100100
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
101+
<<<<<<< HEAD
101102
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb
103+
=======
104+
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
105+
>>>>>>> cd2d9478ec ([release-22.0] ci: use the newest mysql apt config package (#18790) (#18793))
102106

103107
# Bionic packages are still compatible for Jammy since there's no MySQL 5.7
104108
# packages for Jammy.

.github/workflows/unit_test_mysql57.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ jobs:
9898
9999
# Get key to latest MySQL repo
100100
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
101+
<<<<<<< HEAD
101102
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb
103+
=======
104+
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
105+
>>>>>>> cd2d9478ec ([release-22.0] ci: use the newest mysql apt config package (#18790) (#18793))
102106

103107
# Bionic packages are still compatible for Jammy since there's no MySQL 5.7
104108
# packages for Jammy.

.github/workflows/upgrade_downgrade_test_query_serving_queries.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ jobs:
109109
# Install mysql80
110110
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
111111
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
112+
<<<<<<< HEAD
113+
=======
114+
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
115+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
116+
>>>>>>> cd2d9478ec ([release-22.0] ci: use the newest mysql apt config package (#18790) (#18793))
112117
sudo apt-get update
113118
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client
114119
# Install everything else we need, and configure

.github/workflows/upgrade_downgrade_test_query_serving_queries_2.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ jobs:
109109
# Install mysql80
110110
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
111111
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
112+
<<<<<<< HEAD
113+
=======
114+
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
115+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
116+
>>>>>>> cd2d9478ec ([release-22.0] ci: use the newest mysql apt config package (#18790) (#18793))
112117
sudo apt-get update
113118
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client
114119
# Install everything else we need, and configure

.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ jobs:
109109
# Install mysql80
110110
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C
111111
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.35-1_all.deb
112+
echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections
113+
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config*
112114
sudo apt-get update
113115
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server mysql-client
114116
# Install everything else we need, and configure

0 commit comments

Comments
 (0)