-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/6.0/release' into 6.0/patch
- Loading branch information
Showing
16 changed files
with
550 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash -ex | ||
# | ||
# Copyright 2018-2020 Delphix | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# | ||
# This script is responsible for generating a new Aptly repository by | ||
# taking and combining all of the deb.tar.gz tarballs produced by live | ||
# build for this variant (of which there will be one per supported | ||
# platform). The generated repository will be stored at ~/.aptly/public. | ||
# This new repository can then be used to generate a new upgrade image, | ||
# by running the "upgrade-image-from-aptly-repo.sh" script. | ||
# | ||
|
||
. "${BASH_SOURCE%/*}/common.sh" | ||
|
||
if [[ -z "$TOP" ]]; then | ||
echo "Must be run inside the git repsitory." | ||
exit 1 | ||
fi | ||
|
||
if [[ $# -ne 1 ]]; then | ||
echo "Must specify a single variant." 1>&2 | ||
exit 1 | ||
fi | ||
|
||
cd "$TOP/upgrade" | ||
APPLIANCE_VARIANT=$1 | ||
|
||
rm -rf ~/.aptly | ||
rm -rf debs | ||
mkdir debs | ||
|
||
# | ||
# For upgrade images that we ship to customers, we will need to include | ||
# the packages for every platform that we support. Building for every | ||
# platform can be time-comsuming though, so for developer convenience, | ||
# here we just take the artifacts from the live-build stage for whatever | ||
# appliance versions were built (making sure that we built for at least | ||
# one platform), and build an upgrade image from that. | ||
# | ||
LIVE_BUILD_OUTPUT_DIR="$TOP/live-build/build/artifacts" | ||
if ! compgen -G "$LIVE_BUILD_OUTPUT_DIR/$APPLIANCE_VARIANT*.debs.tar.gz"; then | ||
echo "No live-build artifacts found for this variant" >&2 | ||
exit 1 | ||
fi | ||
for deb_tarball in "$LIVE_BUILD_OUTPUT_DIR/$APPLIANCE_VARIANT"*.debs.tar.gz; do | ||
tar xf "$deb_tarball" -C debs | ||
done | ||
|
||
# | ||
# Download the delphix upgrade verification debian package, stored in the | ||
# combined-packages bundle. | ||
# | ||
AWS_S3_URI_COMBINED_PACKAGES=$(resolve_s3_uri \ | ||
"$AWS_S3_URI_COMBINED_PACKAGES" \ | ||
"devops-gate/master/linux-pkg/${UPSTREAM_BRANCH}/combine-packages/post-push/latest") | ||
|
||
WORK_DIRECTORY=$(mktemp -d -p "$TOP/upgrade" tmp.pkgs.XXXXXXXXXX) | ||
|
||
download_combined_packages_artifacts "$AWS_S3_URI_COMBINED_PACKAGES" \ | ||
"$WORK_DIRECTORY" upgrade-verify | ||
|
||
extract_debs_into_dir "$WORK_DIRECTORY/packages/upgrade-verify" \ | ||
"$TOP/upgrade/debs" | ||
|
||
rm -rf "$WORK_DIRECTORY" | ||
|
||
# | ||
# Generate an Aptly/APT repository | ||
# | ||
aptly repo create -distribution=bionic -component=delphix upgrade-repository | ||
aptly repo add upgrade-repository debs | ||
aptly publish repo -skip-contents -skip-signing upgrade-repository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash -x | ||
# | ||
# Copyright 2020 Delphix | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# | ||
# This script is responsible for taking two upgrade images as input, and | ||
# generating a new Aptly repository containing the set difference of | ||
# these two images (i.e. A - B), which it stores at ~/.aptly/public. | ||
# This new repository can then be used to generate a new upgrade image, | ||
# by running the "upgrade-image-from-aptly-repo.sh" script. | ||
# | ||
|
||
. "${BASH_SOURCE%/*}/common.sh" | ||
|
||
set -o pipefail | ||
|
||
function cleanup() { | ||
[[ -n "$UNPACK_DIR" ]] && [[ -d "$UNPACK_DIR" ]] && rm -rf "$UNPACK_DIR" | ||
} | ||
|
||
function usage() { | ||
echo "$(basename "$0"): $*" >&2 | ||
echo "Usage: $(basename "$0") <image A> <image B>" | ||
exit 2 | ||
} | ||
|
||
function import_image_into_aptly() { | ||
local reponame="$1" | ||
local imagepath="$2" | ||
|
||
mkdir "$reponame" || die "'mkdir $reponame' failed" | ||
pushd "$reponame" &>/dev/null || die "'pushd $reponame' failed" | ||
|
||
tar -xf "$imagepath" || die "failed to extract image '$imagepath'" | ||
tar -xf payload.tar.gz || die "failed to extract payload" | ||
|
||
aptly repo create "$reponame" || | ||
die "failed to create repository: '$reponame'" | ||
aptly repo add "$reponame" pool || | ||
die "failed to add packages to repository: '$reponame'" | ||
|
||
popd &>/dev/null || die "'popd' failed" | ||
rm -rf "$reponame" || die "'rm -rf $reponame' failed" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
[[ $# -gt 2 ]] && usage "too many arguments specified" | ||
[[ $# -lt 2 ]] && usage "too few arguments specified" | ||
|
||
IMAGE_A_PATH=$(readlink -f "$1") | ||
[[ -n "$IMAGE_A_PATH" ]] || die "unable to determine image A path" | ||
[[ -f "$IMAGE_A_PATH" ]] || die "image path is not a file: '$IMAGE_A_PATH'" | ||
|
||
IMAGE_B_PATH=$(readlink -f "$2") | ||
[[ -n "$IMAGE_B_PATH" ]] || die "unable to determine image B path" | ||
[[ -f "$IMAGE_B_PATH" ]] || die "image path is not a file: '$IMAGE_B_PATH'" | ||
|
||
UNPACK_DIR=$(mktemp -d -p . -t diff.XXXXXXX) | ||
[[ -d "$UNPACK_DIR" ]] || die "failed to create unpack directory '$UNPACK_DIR'" | ||
pushd "$UNPACK_DIR" &>/dev/null || die "'pushd $UNPACK_DIR' failed" | ||
|
||
rm -rf ~/.aptly | ||
import_image_into_aptly "image-a" "$IMAGE_A_PATH" | ||
import_image_into_aptly "image-b" "$IMAGE_B_PATH" | ||
|
||
popd &>/dev/null || die "'popd' failed" | ||
|
||
# | ||
# The repository we wish to build is the "set difference" of image A and | ||
# image B; i.e. A - B. To do this, we perform the following steps below: | ||
# | ||
# 1. Create a new empty repository | ||
# 2. Add all packages from image A to this new repository | ||
# 3. Remove any packages that're found in image B | ||
# | ||
# The result of this, is a new repository containing all packages from | ||
# image A, that are not in image B; this new repository is stored in | ||
# ~/.aptly/public, and this can then be used by other parts of the build | ||
# system (e.g. "upgrade-image-from-aptly-repo.sh"). | ||
# | ||
|
||
aptly repo create -distribution=bionic -component=delphix upgrade-repository || | ||
die "failed to create repository: 'upgrade-repository'" | ||
aptly repo search image-a | xargs aptly repo copy image-a upgrade-repository || | ||
die "failed to copy packages to repository: 'upgrade-repository'" | ||
|
||
# | ||
# Here we're performing step 3 from the comment above, but since the | ||
# "delphix-upgrade-verification" package is a bit different than most | ||
# other packages on a Delphix appliance, we need to handle that package | ||
# uniquely here. Specifically, we want to ensure this package is always | ||
# contained in the resultant aptly repository (even if the package is | ||
# the same within both image A and image B). | ||
# | ||
aptly repo search image-b | | ||
grep -v "^delphix-upgrade-verification" | | ||
xargs aptly repo remove upgrade-repository || | ||
die "failed to remove packages from repository: 'upgrade-repository'" | ||
|
||
aptly publish repo -skip-contents -skip-signing upgrade-repository || | ||
die "failed to publish repository: 'upgrade-repository'" | ||
|
||
[[ -d ~/.aptly/public ]] || die "failed to generate aptly repository" |
Oops, something went wrong.