Skip to content

Commit

Permalink
DLPX-92280 [Backport of Issue DLPX-92279] Appliance build to take as …
Browse files Browse the repository at this point in the history
…input DCT S3 URL and app version (#775)

PR URL: https://www.github.com/delphix/appliance-build/pull/775

Co-authored-by: eyalkaspi-delphix <[email protected]>
  • Loading branch information
em-delphix and eyalkaspi-delphix authored Sep 30, 2024
1 parent 05a5fe0 commit e0e1c61
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ for (variant in allVariants) {
for (envVar in ["DELPHIX_PLATFORMS",
"DELPHIX_HOTFIX_VERSION",
"DELPHIX_MINIMUM_VERSION",
"DELPHIX_PACKAGED_APP_VERSION",
"AWS_S3_URI_LIVEBUILD_ARTIFACTS",
"AWS_S3_URI_COMBINED_PACKAGES"]) {
inputs.property(envVar, System.getenv(envVar)).optional(true)
Expand Down
1 change: 1 addition & 0 deletions live-build/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ for (variant in allVariants) {

for (envVar in ["APPLIANCE_PASSWORD",
"DELPHIX_APPLIANCE_VERSION",
"DELPHIX_PACKAGED_APP_VERSION",
"DELPHIX_HOTFIX_VERSION",
"DELPHIX_PACKAGE_MIRROR_MAIN",
"DELPHIX_PACKAGE_MIRROR_SECONDARY",
Expand Down
6 changes: 6 additions & 0 deletions live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ if [[ -n "$DELPHIX_HOTFIX_VERSION" ]]; then
"$FSNAME/ROOT/$FSNAME"
fi

if [[ -n "$DELPHIX_PACKAGED_APP_VERSION" ]]; then
zfs set \
"com.delphix:packaged-app-version=$DELPHIX_PACKAGED_APP_VERSION" \
"$FSNAME/ROOT/$FSNAME"
fi

if [[ -n "$DELPHIX_MINIMUM_VERSION" ]]; then
zfs set \
"com.delphix:minimum-version=$DELPHIX_MINIMUM_VERSION" \
Expand Down
2 changes: 1 addition & 1 deletion scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function download_dct_artifacts() {
mkdir "$target_dir/dct"
pushd "$target_dir/dct" &>/dev/null || exit 1

aws s3 sync "$DCT_S3_DIR/$DCT_PACKAGE_PREFIX" .
aws s3 sync "$dct_artifacts_uri" .
sha256sum -c SHA256SUMS

popd &>/dev/null || exit 1
Expand Down
3 changes: 3 additions & 0 deletions scripts/create-build-info-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ check_env DELPHIX_APPLIANCE_VERSION
echo "$DELPHIX_APPLIANCE_VERSION" >"$target/appliance-build/DELPHIX_APPLIANCE_VERSION"
check_env AWS_S3_HOTFIX_METADATA
echo "$AWS_S3_HOTFIX_METADATA" >"$target/appliance-build/HOTFIX_METDATA"
if [[ -n "$DELPHIX_PACKAGED_APP_VERSION" ]]; then
echo "$DELPHIX_PACKAGED_APP_VERSION" >"$target/appliance-build/DELPHIX_PACKAGED_APP_VERSION"
fi

#
# Build the package
Expand Down
12 changes: 8 additions & 4 deletions scripts/upgrade-image-from-aptly-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,18 @@ sed -i "s/@@VERSION@@/$VERSION/" version.info ||
die "failed to set VERSION in version.info file"

#
# The DELPHIX_HOTFIX_VERSION variable is optional, and thus it may not
# be set at this point. That is by design, and when that's the case, we
# still need to do this replacement, such that the version information
# file properly reflects an empty value for the hotfix version.
# The DELPHIX_HOTFIX_VERSION and DELPHIX_PACKAGED_APP_VERSION variable are optional,
# optional, and thus may not be set at this point. That is by design, and
# when that's the case, we still need to do these replacements, such that
# the version information file properly reflects empty values for the
# hotfix and app versions.
#
sed -i "s/@@HOTFIX@@/$DELPHIX_HOTFIX_VERSION/" version.info ||
die "failed to set HOTFIX in version.info file"

sed -i "s/@@PACKAGED_APP_VERSION@@/$DELPHIX_PACKAGED_APP_VERSION/" version.info ||
die "failed to set PACKAGED_APP_VERSION in version.info file"

#
# On 6.0 versions, the virtualization application expects to find the
# "verification-version.info" file within the unpacked upgrade image
Expand Down
3 changes: 3 additions & 0 deletions upgrade/prepare
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ popd &>/dev/null || die "'popd' failed"
if [[ -n "$HOTFIX" ]]; then
VERSION="$VERSION-$HOTFIX"
fi
if [[ -n "$PACKAGED_APP_VERSION" ]]; then
VERSION="$VERSION-$PACKAGED_APP_VERSION"
fi

$opt_f && rm -rf "${UPDATE_DIR:?}/$VERSION" >/dev/null 2>&1

Expand Down
5 changes: 5 additions & 0 deletions upgrade/upgrade-scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ PROP_CURRENT_VERSION="com.delphix:current-version"
PROP_INITIAL_VERSION="com.delphix:initial-version"
PROP_HOTFIX_VERSION="com.delphix:hotfix-version"
PROP_MINIMUM_VERSION="com.delphix:minimum-version"
PROP_PACKAGED_APP_VERSION="com.delphix:packaged-app-version"

#
# To better enable root cause analysis of any upgrade failures, we
Expand Down Expand Up @@ -202,6 +203,10 @@ function get_hotfix_version() {
get_version_property "$PROP_HOTFIX_VERSION"
}

function get_packaged_app_version() {
get_version_property "$PROP_PACKAGED_APP_VERSION"
}

function copy_required_dataset_property() {
local PROP_NAME="$1"
local SRC_DATASET="$2"
Expand Down
12 changes: 12 additions & 0 deletions upgrade/upgrade-scripts/execute
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ if [[ -n "$CURRENT_VERSION" ]]; then
"$ROOTFS_CONTAINER" "$ROOTFS_CONTAINER@execute-upgrade.$UNIQUE"
copy_optional_dataset_property "$PROP_HOTFIX_VERSION" \
"$ROOTFS_CONTAINER" "$ROOTFS_CONTAINER@execute-upgrade.$UNIQUE"
copy_optional_dataset_property "$PROP_PACKAGED_APP_VERSION" \
"$ROOTFS_CONTAINER" "$ROOTFS_CONTAINER@execute-upgrade.$UNIQUE"
fi

if [[ -f /etc/apt/sources.list ]]; then
Expand Down Expand Up @@ -552,6 +554,16 @@ else
"for '$ROOTFS_CONTAINER'"
fi

if [[ -n "$PACKAGED_APP_VERSION" ]]; then
zfs set "$PROP_PACKAGED_APP_VERSION=$PACKAGED_APP_VERSION" "$ROOTFS_CONTAINER" ||
die "failed to set property '$PROP_PACKAGED_APP_VERSION'" \
"to '$PACKAGED_APP_VERSION' for '$ROOTFS_CONTAINER'"
else
zfs inherit "$PROP_PACKAGED_APP_VERSION" "$ROOTFS_CONTAINER" ||
die "failed to inherit property '$PROP_PACKAGED_APP_VERSION'" \
"for '$ROOTFS_CONTAINER'"
fi

# In AWS environments, changing instance type could result in generation of
# different network interface names compared to the existing ones. This mismatch
# causes our netplan file handler in the osadmin service to remove the existing
Expand Down
6 changes: 6 additions & 0 deletions upgrade/upgrade-scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ function rollback() {
[[ -n "$ROLLBACK_BASE_VERSION" ]] ||
die "unable to determine current appliance version"
ROLLBACK_BASE_HOTFIX="$(get_hotfix_version)"
ROLLBACK_BASE_PACKAGED_APP_VERSION="$(get_packaged_app_version)"

set_upgrade_property "ROLLBACK_BASE_CONTAINER" "$ROLLBACK_BASE_CONTAINER" ||
die "failed setting 'ROLLBACK_BASE_CONTAINER' property"
Expand All @@ -321,6 +322,11 @@ function rollback() {
set_upgrade_property "ROLLBACK_BASE_HOTFIX" "$ROLLBACK_BASE_HOTFIX" ||
die "failed setting 'ROLLBACK_BASE_HOTFIX' property"
fi
if [[ -n "$ROLLBACK_BASE_PACKAGED_APP_VERSION" ]]; then
set_upgrade_property "ROLLBACK_BASE_PACKAGED_APP_VERSION" \
"$ROLLBACK_BASE_PACKAGED_APP_VERSION" ||
die "failed setting 'ROLLBACK_BASE_PACKAGED_APP_VERSION' property"
fi

if [[ "$UPGRADE_BASE_CONTAINER" == "$ROLLBACK_BASE_CONTAINER" ]]; then
#
Expand Down
5 changes: 5 additions & 0 deletions upgrade/version.info.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ VERSION=@@VERSION@@
#
HOTFIX=@@HOTFIX@@

#
# The app version contained in the upgrade image (if any)
#
PACKAGED_APP_VERSION=@@PACKAGED_APP_VERSION@@

#
# The minimum product version an engine must have installed, in order to
# upgrade using this upgrade image.
Expand Down

0 comments on commit e0e1c61

Please sign in to comment.