Skip to content

Commit 7de01c6

Browse files
committed
[db] Run test against the same (bitnami/)mysql:8.0.33 version
1 parent 3422cc7 commit 7de01c6

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ jobs:
142142
cancel-in-progress: ${{ needs.configuration.outputs.is_main_branch == 'false' }}
143143
services:
144144
mysql:
145-
image: mysql:5.7
145+
image: bitnami/mysql:8.0.33-debian-11-r24
146146
env:
147147
MYSQL_ROOT_PASSWORD: test
148148
MYSQL_TCP_PORT: 23306
149+
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
149150
ports:
150151
- 23306:23306
151152
container:

components/gitpod-db/BUILD.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ packages:
6363
# Check if a DB is present. If not: start one and wait until it's up
6464
# Note: In CI there is a DB running as sidecar; in workspaces we're starting it once.
6565
# Re-use of the instance because of the init scripts (cmp. next step).
66-
- ["sh", "-c", "mysqladmin ping -h $DB_HOST --port $DB_PORT -p$DB_PASSWORD -u$DB_USER --silent || (docker run --name test-mysql -d -e MYSQL_ROOT_PASSWORD=$DB_PASSWORD -e MYSQL_TCP_PORT=$DB_PORT -p $DB_PORT:$DB_PORT mysql:5.7; while ! mysqladmin ping -h \"$DB_HOST\" -P \"$DB_PORT\" -p$DB_PASSWORD -u$DB_USER --silent; do echo \"waiting for DB...\"; sleep 2; done)"]
66+
# TODO(gpl) Would be awesome to run the exact bitnami/mysql image we run in preview, but it does not run in Gitpod workspaces. Falling back to plain mysql, then
67+
- ["sh", "-c", "mysqladmin ping -h $DB_HOST --port $DB_PORT -p$DB_PASSWORD -u$DB_USER --silent || (docker run --name test-mysql -d -e MYSQL_ROOT_PASSWORD=$DB_PASSWORD -e MYSQL_TCP_PORT=$DB_PORT -p $DB_PORT:$DB_PORT mysql:8.0.33 --default-authentication-plugin=mysql_native_password; while ! mysqladmin ping -h \"$DB_HOST\" -P \"$DB_PORT\" -p$DB_PASSWORD -u$DB_USER --silent; do echo \"waiting for DB...\"; sleep 2; done)"]
6768
# Apply the DB initialization scripts (re-creates the "gitpod" DB if already there)
6869
- ["mkdir", "-p", "init-scripts"]
6970
- ["sh", "-c", "find . -name \"*.sql\" | sort | xargs -I file cp file init-scripts"]

install/installer/pkg/components/database/incluster/helm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ var Helm = common.CompositeHelmFunc(
2626

2727
imageRegistry := common.ThirdPartyContainerRepo(cfg.Config.Repository, common.DockerRegistryURL)
2828

29+
extraEnvVars := map[string]string{}
2930
// We switched to specific tags because we got subtle broken versions with just specifying major versions
3031
mysqlBitnamiImageTag := "5.7.34-debian-10-r55"
3132
if cfg.Config.Database.InClusterMysSQL_8_0 {
3233
mysqlBitnamiImageTag = "8.0.33-debian-11-r24"
34+
extraEnvVars["MYSQL_AUTHENTICATION_PLUGIN"] = "mysql_native_password"
3335
}
3436

3537
return &common.HelmConfig{
@@ -49,6 +51,7 @@ var Helm = common.CompositeHelmFunc(
4951
helm.ImagePullSecrets("mysql.volumePermissions.image.pullSecrets", cfg),
5052
helm.KeyValue("mysql.volumePermissions.image.pullPolicy", "IfNotPresent"),
5153
helm.KeyValue("mysql.volumePermissions.image.registry", imageRegistry),
54+
helm.KeyValueArray("mysql.primary.extraEnvVars", extraEnvVars),
5255

5356
// improve start time
5457
helm.KeyValue("mysql.primary.startupProbe.enabled", "false"),

install/installer/pkg/helm/common.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,27 @@ package helm
66

77
import (
88
"fmt"
9-
"github.com/gitpod-io/gitpod/installer/pkg/common"
109
"os"
10+
"strings"
11+
12+
"github.com/gitpod-io/gitpod/installer/pkg/common"
1113
)
1214

1315
// KeyValue ensure that a key/value pair is correctly formatted for Values
1416
func KeyValue(key string, value string) string {
1517
return fmt.Sprintf("%s=%s", key, value)
1618
}
1719

20+
// KeyValueArray ensure that a key/value pair is correctly formatted for Values
21+
func KeyValueArray(key string, envs map[string]string) string {
22+
var envVarList []string
23+
for n, v := range envs {
24+
envVar := KeyValue(n, v)
25+
envVarList = append(envVarList, envVar)
26+
}
27+
return KeyValue(key, strings.Join(envVarList, ","))
28+
}
29+
1830
// KeyFileValue ensure that a key/value pair is correctly formatted for FileValues
1931
func KeyFileValue(key string, data []byte) (string, error) {
2032
dir, err := os.MkdirTemp("", "helm")

0 commit comments

Comments
 (0)