Skip to content

Commit a87a3b5

Browse files
committed
Merge remote-tracking branch 'origin/6.0/stage' into 6.0/release
2 parents 31cb6fa + d882229 commit a87a3b5

13 files changed

Lines changed: 95 additions & 77 deletions

File tree

.github/scripts/verify-query-packages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test "$(TARGET_KERNEL_FLAVORS=generic ./query-packages.sh list linux-kernel)" ==
7272
# Check that when a package has multiple dependencies they are printed in the
7373
# expected format.
7474
test "$(TARGET_KERNEL_FLAVORS="generic aws" ./query-packages.sh single -o dependencies zfs)" == \
75-
"linux-kernel-generic,linux-kernel-aws"
75+
"linux-kernel-generic,linux-kernel-aws,delphix-rust"
7676

7777
# Check that the output from the appliance list contains zfs and
7878
# delphix-platform packages. Note, we explicitly do not use grep -q here as it

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,14 @@ This quick tutorial shows how to build the packages managed by this framework.
5050
You need a system that meets the requirements above. For Delphix developers, you
5151
should clone the `bootstrap-18-04` group on DCoA.
5252

53-
### Step 2. Clone this repository and run the setup script
53+
### Step 2. Clone this repository
5454

5555
Clone this repository on the build VM.
5656

5757
```
5858
git clone https://github.com/delphix/linux-pkg.git
5959
```
6060

61-
Run the setup script. It only needs to be run once after cloning the VM.
62-
63-
```
64-
cd linux-pkg
65-
./setup.sh
66-
```
67-
6861
### Step 3. Build a package
6962

7063
We can now build an arbitrary package. Any package in the

buildpkg.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ TOP="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
1919
source "$TOP/lib/common.sh"
2020

2121
logmust check_running_system
22+
logmust run_setup_if_needed
2223

2324
function usage() {
2425
[[ $# != 0 ]] && echo "$(basename "$0"): $*"

checkupdates.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ TOP="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
1919
source "$TOP/lib/common.sh"
2020

2121
logmust check_running_system
22+
logmust run_setup_if_needed
2223

2324
function usage() {
2425
[[ $# != 0 ]] && echo "$(basename "$0"): $*"

lib/common.sh

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2018, 2020 Delphix
3+
# Copyright 2018, 2021 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ export SUPPORTED_KERNEL_FLAVORS="generic aws gcp azure oracle"
2626
# for testing purposes to use jenkins-ops.<developer> instead.
2727
#
2828
export JENKINS_OPS_DIR="${JENKINS_OPS_DIR:-jenkins-ops}"
29+
export S3_DEVOPS_BRANCH="${S3_DEVOPS_BRANCH:-master}"
2930

3031
export UBUNTU_DISTRIBUTION="bionic"
3132

@@ -100,23 +101,50 @@ function logmust() {
100101
# scripts on their work system and changing its configuration.
101102
#
102103
function check_running_system() {
104+
local msg
105+
103106
if [[ "$DISABLE_SYSTEM_CHECK" == "true" ]]; then
104107
echo "WARNING: System check disabled."
105108
return 0
106109
fi
107110

111+
msg="Note that you can bypass this check by setting environment"
112+
msg="${msg} variable DISABLE_SYSTEM_CHECK=true. Use this at your"
113+
msg="${msg} own risk as running this command may modify your system."
114+
108115
if ! (command -v lsb_release >/dev/null &&
109116
[[ $(lsb_release -cs) == "$UBUNTU_DISTRIBUTION" ]]); then
110-
die "Script can only be ran on an ubuntu-${UBUNTU_DISTRIBUTION} system."
117+
echo_error "Script can only be run on an ubuntu-${UBUNTU_DISTRIBUTION} system."
118+
echo_bold "$msg"
119+
exit 1
111120
fi
112121

113122
if ! curl "http://169.254.169.254/latest/meta-datas" \
114123
>/dev/null 2>&1; then
115-
die "Not running in AWS, are you sure you are on the" \
124+
echo_error "Not running in AWS, are you sure you are on the" \
116125
"right system?"
126+
echo_bold "$msg"
127+
exit 1
117128
fi
118129
}
119130

131+
#
132+
# We need to have run setup.sh before running most linux-pkg commands.
133+
# This checks if setup has been run before. Note that if the system was
134+
# rebooted we want to rerun setup as cloud-init will reset apt sources on
135+
# boot.
136+
#
137+
function run_setup_if_needed() {
138+
[[ -f /run/linux-pkg-setup ]] && return
139+
140+
check_env TOP
141+
echo_bold "------------------------------------------------------------"
142+
echo_bold "Running setup script"
143+
echo_bold "------------------------------------------------------------"
144+
logmust "$TOP/setup.sh"
145+
echo_bold "------------------------------------------------------------"
146+
}
147+
120148
#
121149
# Determine DEFAULT_GIT_BRANCH. If it is unset, default to the branch set in
122150
# branch.config.
@@ -632,7 +660,7 @@ function determine_dependencies_base_url() {
632660
[[ -n "$suv" ]] || die "No artifacts found at $url"
633661
DEPENDENCIES_BASE_URL="$url/$suv/input-artifacts/combined-packages/packages"
634662
else
635-
DEPENDENCIES_BASE_URL="s3://snapshot-de-images/builds/$JENKINS_OPS_DIR/devops-gate/master/linux-pkg/$DEFAULT_GIT_BRANCH/build-package"
663+
DEPENDENCIES_BASE_URL="s3://snapshot-de-images/builds/$JENKINS_OPS_DIR/devops-gate/$S3_DEVOPS_BRANCH/linux-pkg/$DEFAULT_GIT_BRANCH/build-package"
636664
fi
637665

638666
#
@@ -715,6 +743,26 @@ function fetch_dependencies() {
715743
done
716744
}
717745

746+
#
747+
# Run git fetch with the passed arguments. Git url must be passed as first
748+
# argument. If FETCH_GIT_TOKEN is set and this is a github repository
749+
# then pass-in the token when fetching.
750+
#
751+
function git_fetch_helper() {
752+
local orig_url="$1"
753+
local git_url="$1"
754+
local label=''
755+
shift
756+
757+
if [[ -n "$FETCH_GIT_TOKEN" ]] &&
758+
[[ "$git_url" == https://github.com/* ]]; then
759+
git_url="${git_url/https:\/\//https:\/\/${FETCH_GIT_TOKEN}@}"
760+
label='[token passed]'
761+
fi
762+
echo "Running: $label git fetch $orig_url $*"
763+
git fetch "$git_url" "$@" || die "git fetch failed"
764+
}
765+
718766
#
719767
# Fetch package repository into $WORKDIR/repo
720768
#
@@ -731,14 +779,14 @@ function fetch_repo_from_git() {
731779
# Otherwise just get the latest commit of the main branch.
732780
#
733781
if [[ "$DO_UPDATE_PACKAGE" == "true" ]]; then
734-
logmust git fetch --no-tags "$PACKAGE_GIT_URL" \
782+
logmust git_fetch_helper "$PACKAGE_GIT_URL" --no-tags \
735783
"+$PACKAGE_GIT_BRANCH:repo-HEAD"
736-
logmust git fetch --no-tags "$PACKAGE_GIT_URL" \
784+
logmust git_fetch_helper "$PACKAGE_GIT_URL" --no-tags \
737785
"+upstreams/$DEFAULT_GIT_BRANCH:upstream-HEAD"
738786
logmust git show-ref repo-HEAD
739787
logmust git show-ref upstream-HEAD
740788
else
741-
logmust git fetch --no-tags "$PACKAGE_GIT_URL" \
789+
logmust git_fetch_helper "$PACKAGE_GIT_URL" --no-tags \
742790
"+$PACKAGE_GIT_BRANCH:repo-HEAD" --depth=1
743791
logmust git show-ref repo-HEAD
744792
fi
@@ -826,8 +874,7 @@ function update_upstream_from_git() {
826874
#
827875
# Fetch updates from third-party upstream repository.
828876
#
829-
logmust git remote add upstream "$UPSTREAM_GIT_URL"
830-
logmust git fetch upstream "$UPSTREAM_GIT_BRANCH"
877+
logmust git_fetch_helper "$UPSTREAM_GIT_URL" "$UPSTREAM_GIT_BRANCH"
831878

832879
#
833880
# Compare third-party upstream repository to our local snapshot of the

package-lists/build/main.pkgs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ cloud-init
1010
crash-python
1111
crypt-blowfish
1212
delphix-platform
13+
delphix-rust
1314
delphix-sso-app
1415
drgn
1516
docker-python-image

packages/adoptopenjdk/config.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
DEFAULT_PACKAGE_GIT_URL=none
2020
PACKAGE_DEPENDENCIES="make-jpkg"
2121

22-
_tarfile="OpenJDK8U-jdk_x64_linux_hotspot_8u282b08.tar.gz"
23-
_tarfile_sha256="e6e6e0356649b9696fa5082cfcb0663d4bef159fc22d406e3a012e71fce83a5c"
22+
_tarfile="OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz"
23+
_tarfile_sha256="cc13f274becf9dd5517b6be583632819dfd4dd81e524b5c1b4f406bdaf0e063a"
2424
_jdk_path="/usr/lib/jvm/adoptopenjdk-java8-jdk-amd64"
2525

2626
function prepare() {

packages/delphix-rust/config.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2021 Delphix
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# shellcheck disable=SC2034
18+
19+
DEFAULT_PACKAGE_GIT_URL="https://github.com/delphix/delphix-rust.git"
20+
21+
function build() {
22+
logmust mkdir -p "$WORKDIR/repo"
23+
logmust dpkg_buildpackage_default
24+
}

packages/td-agent/config.sh

Lines changed: 0 additions & 53 deletions
This file was deleted.

packages/zfs/config.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# shellcheck disable=SC2034
1818

1919
DEFAULT_PACKAGE_GIT_URL="https://github.com/delphix/zfs.git"
20-
PACKAGE_DEPENDENCIES="@linux-kernel"
20+
PACKAGE_DEPENDENCIES="@linux-kernel delphix-rust"
2121

2222
UPSTREAM_GIT_URL="https://github.com/zfsonlinux/zfs.git"
2323
UPSTREAM_GIT_BRANCH="master"
@@ -29,7 +29,6 @@ function prepare() {
2929
autogen \
3030
autotools-dev \
3131
build-essential \
32-
cargo \
3332
debhelper \
3433
devscripts \
3534
dh-autoreconf \
@@ -52,10 +51,10 @@ function prepare() {
5251
pkg-config \
5352
po-debconf \
5453
python3 \
55-
rustc \
5654
uuid-dev \
5755
zlib1g-dev
5856
logmust install_kernel_headers
57+
logmust install_pkgs "$DEPDIR"/delphix-rust/*.deb
5958
}
6059

6160
function checkstyle() {

0 commit comments

Comments
 (0)