Skip to content

Commit

Permalink
Standardize docker images to use more uniform images across the Runtime
Browse files Browse the repository at this point in the history
WG

Update diego release to use the standard docker images for the Runtime
Working group

[#182691815](https://www.pivotaltracker.com/n/projects/2477027/stories/182691815)

Co-authored-by: Marc Paquette <[email protected]>
Co-authored-by: Josh Russett <[email protected]>
Co-authored-by: Marc Paquette <[email protected]>
  • Loading branch information
2 people authored and winkingturtle-vmw committed Apr 26, 2023
1 parent 5158007 commit ce8a542
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ As of Diego 1.0, SQL unit tests are the default unit tests for Diego. To run the

To run all the SQL-backed tests, run the following command from the root of diego-release:

./scripts/run-unit-tests
SQL_FLAVOR={mysql|postgres|choose one} ./scripts/run-unit-tests

This command will run all regular unit tests, as well as BBS and component integration tests where a backing store is required in MySQL-backed and Postgres-backed modes.

Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/initialize_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ function bootDB {
fi

if [ "$db" = "postgres" ]; then
launchDB="(docker-entrypoint.sh -c max_connections=300 &> /var/log/postgres-boot.log) &"
testConnection="psql -h localhost -U $POSTGRES_USER -c '\conninfo' &>/dev/null"
launchDB="(POSTGRES_PASSWORD=password POSTGRES_USER=root /postgres-entrypoint.sh postgres -c max_connections=300 &> /var/log/postgres-boot.log) &"
testConnection="PGPASSWORD=password psql -h localhost -U root -c '\conninfo'"
elif [[ "$db" == "mysql"* ]]; then
chown -R mysql:mysql /var/run/mysqld
launchDB="(MYSQL_USER='' MYSQL_ROOT_PASSWORD=$MYSQL_PASSWORD /entrypoint.sh mysqld &> /var/log/mysql-boot.log) &"
launchDB="(MYSQL_USER='' MYSQL_ROOT_PASSWORD=$MYSQL_PASSWORD /mysql-entrypoint.sh mysqld --max_allowed_packet=256M &> /var/log/mysql-boot.log) &"
testConnection="echo '\s;' | mysql -h127.0.0.1 -uroot --password=$MYSQL_PASSWORD &>/dev/null"
else
echo "skipping database"
Expand Down
5 changes: 1 addition & 4 deletions scripts/ci/run-unit-tests
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ echo "PATH = ${PATH}"

ERROR_CODE=0

SQL_FLAVOR=mysql ${SCRIPTS_DIR}/ci/run-unit-tests-with-backing-store
${SCRIPTS_DIR}/ci/run-unit-tests-with-backing-store
ERROR_CODE=$?

SQL_FLAVOR=postgres ${SCRIPTS_DIR}/ci/run-unit-tests-with-backing-store
let ERROR_CODE+=$?

${SCRIPTS_DIR}/ci/run-unit-tests-no-backing-store
let ERROR_CODE+=$?

Expand Down
4 changes: 2 additions & 2 deletions scripts/ci/run_unit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# vim: set ft=sh

set -e
set -ex
source diego-release/scripts/ci/initialize_mysql.sh

if [ "${SQL_FLAVOR}" = "mysql" ]; then
Expand All @@ -12,6 +12,6 @@ fi

cd diego-release/

SCRIPT=${SCRIPT:-run-unit-tests}
SCRIPT=${SCRIPT:-ci/run-unit-tests}

"scripts/${SCRIPT}" "$@"
2 changes: 1 addition & 1 deletion scripts/ci/run_unit_mysql.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ platform: linux
image_resource:
type: registry-image
source:
repository: cloudfoundry/diego-units-mysql
repository: cloudfoundry/tas-runtime-mysql-8.0
tag: latest

inputs:
Expand Down
24 changes: 24 additions & 0 deletions scripts/ci/run_unit_mysql_5.7.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
platform: linux

image_resource:
type: registry-image
source:
repository: cloudfoundry/tas-runtime-mysql-5.7
tag: latest

inputs:
- name: diego-release

params:
PACKAGE:
SCRIPT:
SQL_FLAVOR: mysql
ECR_TEST_REPO_URI:
ECR_TEST_AWS_ACCESS_KEY_ID:
ECR_TEST_AWS_SECRET_ACCESS_KEY:
MYSQL_USER: root
MYSQL_PASSWORD: password

run:
path: diego-release/scripts/ci/run_unit
4 changes: 2 additions & 2 deletions scripts/ci/run_unit_postgres.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ platform: linux
image_resource:
type: registry-image
source:
repository: cloudfoundry/diego-units-postgres
repository: cloudfoundry/tas-runtime-postgres
tag: latest

inputs:
Expand All @@ -17,7 +17,7 @@ params:
ECR_TEST_REPO_URI:
ECR_TEST_AWS_ACCESS_KEY_ID:
ECR_TEST_AWS_SECRET_ACCESS_KEY:
POSTGRES_USER: ~
POSTGRES_USER: root
POSTGRES_PASSWORD: ~

run:
Expand Down
6 changes: 3 additions & 3 deletions scripts/docker-shell
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ db=${DB:-"mysql"} # if not set, default to mysql
SQL_FLAVOR=$db

if [ "$db" = "mysql" ]; then
docker_image=cloudfoundry/diego-units-mysql
docker_image=cloudfoundry/tas-runtime-mysql-5.7
elif [ "$db" = "mysql8" ]; then
docker_image=cloudfoundry/cf-networking-mysql8
docker_image=cloudfoundry/tas-runtime-mysql-8.0
elif [ "$db" = "postgres" ]; then
docker_image=cloudfoundry/diego-units-postgres
docker_image=cloudfoundry/tas-runtime-postgres
else
echo "Database \"${db}\" not supported"
exit 1
Expand Down
13 changes: 9 additions & 4 deletions scripts/start-db-helper
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ function bootDB {
db="$1"

if [ "${db}" = "postgres" ]; then
launchDB="(POSTGRES_PASSWORD=password docker-entrypoint.sh postgres -c max_connections=300 &> /var/log/postgres-boot.log) &"
launchDB="(POSTGRES_PASSWORD=password /postgres-entrypoint.sh postgres -c max_connections=300 &> /var/log/postgres-boot.log) &"
testConnection="PGPASSWORD=password psql -h localhost -U postgres -c '\conninfo'"
elif [ "${db}" = "mysql" ] || [ "${db}" = "mysql-5.6" ] || [ "${db}" = "mysql8" ]; then
elif [ "${db}" = "mysql-5.7" ] ; then
# max_allowed_packet default for PXC Release is 256M
launchDB="(MYSQL_ROOT_PASSWORD=password /entrypoint.sh mysqld --max_allowed_packet=256M &> /var/log/mysql-boot.log) &"
testConnection="mysql -h localhost -u root -D mysql -e '\s;' --password='password' --max_allowed_packet=256M"
# TODO: yeah.. this is exactly the same code.. so let's remove it?
launchDB="(MYSQL_ROOT_PASSWORD=password /mysql-entrypoint.sh mysqld --max_allowed_packet=512M &> /var/log/mysql-boot.log) &"
testConnection="mysql -h localhost -u root -D mysql -e '\s;' --password='password' --max_allowed_packet=512M"
elif [ "${db}" = "mysql" ] || [ "${db}" = "mysql8" ]; then
# max_allowed_packet default for PXC Release is 256M
launchDB="(MYSQL_ROOT_PASSWORD=password /mysql-entrypoint.sh mysqld --max_allowed_packet=512M &> /var/log/mysql-boot.log) &"
testConnection="mysql -h localhost -u root -D mysql -e '\s;' --password='password' --max_allowed_packet=512M"
else
echo "skipping database"
return 0
Expand Down

0 comments on commit ce8a542

Please sign in to comment.