Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/6.0/release' into 6.0/patch
Browse files Browse the repository at this point in the history
  • Loading branch information
rasantel committed Jan 21, 2021
2 parents 681c252 + 1d429cb commit 98d9416
Show file tree
Hide file tree
Showing 16 changed files with 550 additions and 262 deletions.
10 changes: 5 additions & 5 deletions .github/scripts/install-ansible-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ git checkout v3.4.21
git branch -D master

#
# GitHub Actions exposes some "debugging commands" that can be used to
# GitHub Actions exposes the GITHUB_ENV file that can be used to
# manipulate the environment of the job that's running. In this case, we
# use the "set-env" command to modify the environment of the job, to
# edit the PATH and PYTHONPATH global variables.
# use it to modify the environment of the job, to edit the PATH and
# PYTHONPATH global variables.
#
echo "::set-env name=PATH::${PATH}:/opt/ansible-lint/bin"
echo "::set-env name=PYTHONPATH::${PYTHONPATH}:/opt/ansible-lint/lib"
echo "PATH=${PATH}:/opt/ansible-lint/bin" >> ${GITHUB_ENV}
echo "PYTHONPATH=${PYTHONPATH}:/opt/ansible-lint/lib" >> ${GITHUB_ENV}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- run: sudo ./.github/scripts/install-gradle.sh
- run: sudo ./.github/scripts/install-ansible-lint.sh
- run: sudo -E ./.github/scripts/install-ansible-lint.sh
- run: /opt/gradle-5.1/bin/gradle ansibleCheck
check-shellcheck:
runs-on: ubuntu-18.04
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
#

*.swp
*.orig
.gradle/
.gradleUserHome/
build/
Expand All @@ -22,4 +24,4 @@ build/
*.iml

# Ignore the .idea directory that IntelliJ puts in the root of projects
.idea
.idea
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ for (variant in allVariants) {

for (envVar in ["DELPHIX_PLATFORMS",
"AWS_S3_URI_LIVEBUILD_ARTIFACTS",
"AWS_S3_URI_UPGRADE_VERIFICATION",
"AWS_S3_PREFIX_UPGRADE_VERIFICATION"]) {
"AWS_S3_URI_COMBINED_PACKAGES"]) {
inputs.property(envVar, System.getenv(envVar)).optional(true)
}

Expand Down
2 changes: 1 addition & 1 deletion live-build/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply from: "${rootProject.projectDir}/gradle-lib/util.gradle"
task ancillaryRepository(type: Exec) {
inputs.file "${rootProject.projectDir}/scripts/build-ancillary-repository.sh"

for (envVar in ["COMBINED_PACKAGES_S3_URL"]) {
for (envVar in ["AWS_S3_URI_COMBINED_PACKAGES"]) {
inputs.property(envVar, System.getenv(envVar)).optional(true)
}

Expand Down
4 changes: 2 additions & 2 deletions live-build/config/hooks/vm-artifacts/template.ovf
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@
<rasd:ResourceType>10</rasd:ResourceType>
<vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/>
</Item>
<vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="true"/>
<vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/>
<vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="true"/>
<vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/>
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/>
<vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
- isc-dhcp-server
- libldap2-dev
- libsasl2-dev
- nfs-common-dbgsym
- nfs-kernel-server
- nfs-kernel-server-dbgsym
- python-dbg
- python-dev
- python-ldap
Expand All @@ -34,18 +36,17 @@
- python-pyvmomi
- python-six
- python-tenacity
- python-virtualenv
- python2.7
- python3
- python3-dbg
- python3-dev
- python3-ldap
- python3-paramiko
- python3-pip
- python3-pyvmomi
- python3-six
- python3-tenacity
- python3-virtualenv
- python3-venv
- targetcli-fb
- telnet
state: present
register: result
Expand All @@ -66,11 +67,6 @@
accept_hostkey: yes
update: no

- copy:
dest: "/etc/dcenter.conf"
content: |
[[ -z "$DC_ROOT" ]] && export DC_ROOT="dcenter"
#
# By default, ubuntu restricts directories where dhcpd and named
# can operate. For dcenter, we maintain the dhcp configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
#
# This file is intended only for QA-specific testing items and frameworks.
# Anything required by customers should not be added here.
# snmptrapd pkg is added to test snmp traps feature.
#

- apt:
name: nftables
name:
- nftables
- snmptrapd
state: present
register: result
until: result is not failed
Expand Down
86 changes: 86 additions & 0 deletions scripts/aptly-repo-from-debs.sh
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
117 changes: 117 additions & 0 deletions scripts/aptly-repo-from-image-diff.sh
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"
Loading

0 comments on commit 98d9416

Please sign in to comment.