Skip to content

Commit 9f31cdd

Browse files
committed
[DEVOPS-3419] test automation: Update YBC for DB unit testing when version changes
Summary: Split out YBC stable version to separate conf file, so that a version update will trigger DB unit testing, but other changes to reference.conf need not trigger such DB CI testing. Fix prep_ybc_testing() to notice when the version installed in build/ybc is not correct and re-install. Test Plan: Running single test to verify correct updates to build/ybc when needed, and whether or not build/ybc exists, and whether or not build/ybc/ybc_version.conf exists. Also that new downloads to /opt/yb-build/ybc staging directory works. ./yb_build.sh --sb --java-test 'org.yb.pgsql.TestYbBackup#testMixedLegacyColocatedDatabase' Reviewers: dshubin, mlillibridge, jharveysmith Reviewed By: dshubin, jharveysmith Subscribers: devops Differential Revision: https://phorge.dev.yugabyte.com/D44369
1 parent 6619171 commit 9f31cdd

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

build-support/common-test-env.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,20 +2102,21 @@ prep_ybc_testing() {
21022102
# YBC is supported only on linux.
21032103
if is_linux; then
21042104
ybc_dest="$YB_SRC_ROOT/build/ybc"
2105-
if [[ -d "${ybc_dest}" ]]; then
2106-
log "Found existing $ybc_dest directory, skipping YBC prep."
2105+
config_file="$YB_SRC_ROOT/managed/src/main/resources/ybc_version.conf"
2106+
if [[ -d "${ybc_dest}" ]] && diff "$config_file" "${ybc_dest}/ybc_version.conf"; then
2107+
log "Found up to date $ybc_dest directory, skipping YBC prep."
21072108
else
21082109
ybc_tarball_dir="/opt/yb-build/ybc"
2109-
config_file="$YB_SRC_ROOT/managed/src/main/resources/reference.conf"
21102110
# check that current version is downloaded
21112111
"$YB_SRC_ROOT"/managed/download_ybc.sh -i -c "$config_file" -d "$ybc_tarball_dir"
21122112
# Extract version the same way as download_ybc.sh does.
2113-
ybc_version=$(grep ybc -A2 "${config_file}" |
2114-
awk -F '= ' '/stable_version/ {print $2}' | tr -d \")
2113+
ybc_version=$(awk -F '= ' '/stable_version/ {print $2}' "${config_file}" | tr -d \")
21152114
ybc_tar=$(compgen -G "${ybc_tarball_dir}/ybc-${ybc_version}-*-${YB_TARGET_ARCH}.tar.gz")
21162115
log "Unpacking ${ybc_tar} bin/ binaries to ${ybc_dest}/"
2116+
rm -rf "${ybc_dest}"
21172117
mkdir -p "${ybc_dest}"
21182118
tar -x -f "${ybc_tar}" -C "${ybc_dest}" --strip-components=2 --wildcards 'yb*/bin/*'
2119+
cp "$config_file" "${ybc_dest}/ybc_version.conf"
21192120
fi
21202121
fi
21212122
}

managed/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ versionGenerate := {
389389
(Compile / resourceDirectory).value / "version_metadata.json").!
390390
ybLog("version_metadata.json Generated")
391391
Process("rm -f " + (Compile / resourceDirectory).value / "gen_version_info.log").!
392-
var downloadYbcCmd = "./download_ybc.sh -c " + (Compile / resourceDirectory).value / "reference.conf" + " -i"
392+
var downloadYbcCmd = "./download_ybc.sh -c " + (Compile / resourceDirectory).value / "ybc_version.conf" + " -i"
393393
if (moveYbcPackage) {
394394
downloadYbcCmd = downloadYbcCmd + " -s"
395395
}

managed/download_ybc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ while [[ $# -gt 0 ]]; do
5757
done
5858

5959
ybc_version=$(
60-
grep ybc -A2 ${config_file} | awk -F '= ' '/stable_version/ {print $2}' | tr -d \"
60+
awk -F '= ' '/stable_version/ {print $2}' ${config_file} | tr -d \"
6161
)
6262

6363
# Use http, so aws s3 command/credential setup is not required.

managed/src/main/resources/reference.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ yb {
14471447

14481448
ybc {
14491449
releases {
1450-
stable_version = "2.2.0.2-b5"
1450+
include "ybc_version.conf"
14511451
path = "/opt/yugabyte/ybc/releases"
14521452
}
14531453
compatible_db_version = "2.15.0.0-b1"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
stable_version = "2.2.0.2-b5"
3+
}

0 commit comments

Comments
 (0)