Skip to content

Commit 9e038e6

Browse files
committed
CI: cleanup shell issues; fix bundler invocation
1 parent 137df55 commit 9e038e6

8 files changed

Lines changed: 34 additions & 23 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ docker run \
2727
bosh/os-image-stemcell-builder:${short_name}
2828

2929
# You're now in the Docker container
30-
gem install bundler
31-
bundle install
30+
pushd bosh-stemcell
31+
bundle install
32+
popd
3233

3334
# build OS image
3435
bundle exec rake stemcell:build_os_image[ubuntu,${short_name},${PWD}/tmp/ubuntu_base_image.tgz]

ci/tasks/build-release-metadata.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pushd "${REPO_PARENT}/candidate-stemcell"
3636
kernel_version=$(grep "${KERNEL_PACKAGE}" packages.txt | awk '{print $3}')
3737
popd
3838

39-
bosh_agent_version=$(cat "${REPO_PARENT}/bosh-linux-stemcell-builder/stemcell_builder/stages/bosh_go_agent/assets/bosh-agent-version")
39+
bosh_agent_version=$(cat "${REPO_ROOT}/stemcell_builder/stages/bosh_go_agent/assets/bosh-agent-version")
4040
{
4141
echo "## Metadata:"
4242
echo "**BOSH Agent Version**: ${bosh_agent_version}"
@@ -45,9 +45,9 @@ bosh_agent_version=$(cat "${REPO_PARENT}/bosh-linux-stemcell-builder/stemcell_bu
4545

4646
if [[ "${OS_NAME}" == "ubuntu" ]]; then
4747
# Ensure URL for usn-log from metalink exists before attempting to download.
48-
usn_log_json_file="${REPO_PARENT}/bosh-linux-stemcell-builder/usn-log.json"
48+
usn_log_json_file="${REPO_ROOT}/usn-log.json"
4949
touch "${usn_log_json_file}"
50-
usn_metalink_path="${REPO_PARENT}/bosh-linux-stemcell-builder/bosh-stemcell/image-metalinks/${BRANCH}/${OS_NAME}-${OS_VERSION}.meta4"
50+
usn_metalink_path="${REPO_ROOT}/bosh-stemcell/image-metalinks/${BRANCH}/${OS_NAME}-${OS_VERSION}.meta4"
5151
if [[ -n "$(meta4 file-urls --metalink "${usn_metalink_path}" --file usn-log.json)" ]]; then
5252
meta4 file-download \
5353
--skip-hash-verification \

ci/tasks/build.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ for i in $(seq 0 64); do
7171
fi
7272
done
7373

74-
chown -R ubuntu:ubuntu "${REPO_PARENT}/bosh-linux-stemcell-builder"
74+
chown -R ubuntu:ubuntu "${REPO_ROOT}"
7575
chown -R ubuntu:ubuntu /mnt
7676

7777
OS_IMAGE=""
@@ -101,27 +101,33 @@ SUDO
101101
# Output and checksum the stemcell artifacts
102102
#
103103

104-
stemcell_name="bosh-stemcell-$CANDIDATE_BUILD_NUMBER-$IAAS-$HYPERVISOR-$OS_NAME-$OS_VERSION${AGENT_SUFFIX}"
105-
meta4_path="${REPO_PARENT}/stemcells-index-output/dev/$OS_NAME-$OS_VERSION/$CANDIDATE_BUILD_NUMBER/$IAAS-$HYPERVISOR${AGENT_SUFFIX}.meta4"
104+
stemcell_name="bosh-stemcell-${CANDIDATE_BUILD_NUMBER}-$IAAS-$HYPERVISOR-$OS_NAME-$OS_VERSION${AGENT_SUFFIX}"
105+
meta4_path="${REPO_PARENT}/stemcells-index-output/dev/$OS_NAME-$OS_VERSION/${CANDIDATE_BUILD_NUMBER}/$IAAS-$HYPERVISOR${AGENT_SUFFIX}.meta4"
106106

107-
echo $CANDIDATE_BUILD_NUMBER > "${REPO_PARENT}/candidate-build-number/number"
107+
echo "${CANDIDATE_BUILD_NUMBER}" > "${REPO_PARENT}/candidate-build-number/number"
108108
mkdir -p "$( dirname "$meta4_path" )"
109109
rm -f "$meta4_path"
110110
meta4 create --metalink="$meta4_path"
111111

112-
if [ -e "${REPO_PARENT}/bosh-linux-stemcell-builder/tmp"/*-raw.tgz ] ; then
112+
raw_images=( "${REPO_ROOT}/tmp"/*-raw.tgz )
113+
if [ "${#raw_images[@]}" -ge 2 ]; then
114+
echo "Found more than one raw image: '${raw_images[*]}'" >&2
115+
exit 1
116+
fi
117+
118+
if [ -e "${raw_images[0]}" ] ; then
113119
# openstack currently publishes raw files
114120
raw_stemcell_filename="${stemcell_name}-raw.tgz"
115-
mv "${REPO_PARENT}/bosh-linux-stemcell-builder/tmp"/*-raw.tgz "${REPO_PARENT}/stemcell/${raw_stemcell_filename}"
121+
mv "${REPO_ROOT}/tmp"/*-raw.tgz "${REPO_PARENT}/stemcell/${raw_stemcell_filename}"
116122

117-
meta4 import-file --metalink="$meta4_path" --version="$CANDIDATE_BUILD_NUMBER" "${REPO_PARENT}/stemcell/${raw_stemcell_filename}"
123+
meta4 import-file --metalink="$meta4_path" --version="${CANDIDATE_BUILD_NUMBER}" "${REPO_PARENT}/stemcell/${raw_stemcell_filename}"
118124
meta4 file-set-url --metalink="$meta4_path" --file="${raw_stemcell_filename}" "https://${S3_API_ENDPOINT}/${STEMCELL_BUCKET}/${IAAS}/${raw_stemcell_filename}"
119125
fi
120126

121127
stemcell_filename="${stemcell_name}.tgz"
122-
mv "${REPO_PARENT}/bosh-linux-stemcell-builder/tmp/${stemcell_filename}" "${REPO_PARENT}/stemcell/${stemcell_filename}"
128+
mv "${REPO_ROOT}/tmp/${stemcell_filename}" "${REPO_PARENT}/stemcell/${stemcell_filename}"
123129

124-
meta4 import-file --metalink="$meta4_path" --version="$CANDIDATE_BUILD_NUMBER" "${REPO_PARENT}/stemcell/${stemcell_filename}"
130+
meta4 import-file --metalink="$meta4_path" --version="${CANDIDATE_BUILD_NUMBER}" "${REPO_PARENT}/stemcell/${stemcell_filename}"
125131
meta4 file-set-url --metalink="$meta4_path" --file="${stemcell_filename}" "https://${S3_API_ENDPOINT}/${STEMCELL_BUCKET}/${IAAS}/${stemcell_filename}"
126132

127133
# just in case we need to debug/verify the live results
@@ -132,4 +138,4 @@ cd "${REPO_PARENT}/stemcells-index-output"
132138
git add -A
133139
git config --global user.email "ci@localhost"
134140
git config --global user.name "CI Bot"
135-
git commit -m "dev: $OS_NAME-$OS_VERSION/$CANDIDATE_BUILD_NUMBER ($IAAS-$HYPERVISOR)"
141+
git commit -m "dev: ${OS_NAME}-${OS_VERSION}/${CANDIDATE_BUILD_NUMBER} ($IAAS-$HYPERVISOR)"

ci/tasks/bump-bosh-agent.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [[ -n "${DEBUG:-}" ]]; then
1010
export BOSH_LOG_PATH="${BOSH_LOG_PATH:-${REPO_PARENT}/bosh-debug.log}"
1111
fi
1212

13-
git clone "${REPO_PARENT}/bosh-linux-stemcell-builder" "${REPO_PARENT}/bosh-linux-stemcell-builder-out"
13+
git clone "${REPO_ROOT}" "${REPO_PARENT}/bosh-linux-stemcell-builder-out"
1414

1515
version=$( cat "${REPO_PARENT}/bosh-agent/.resource/version" )
1616

ci/tasks/bump-bosh-blobstore-cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [[ -n "${DEBUG:-}" ]]; then
1010
export BOSH_LOG_PATH="${BOSH_LOG_PATH:-${REPO_PARENT}/bosh-debug.log}"
1111
fi
1212

13-
git clone "${REPO_PARENT}/bosh-linux-stemcell-builder" "${REPO_PARENT}/bosh-linux-stemcell-builder-out"
13+
git clone "${REPO_ROOT}" "${REPO_PARENT}/bosh-linux-stemcell-builder-out"
1414

1515
url=$(cat "${REPO_PARENT}/bosh-blobstore-cli/url")
1616
version=$(cat "${REPO_PARENT}/bosh-blobstore-cli/version")

ci/tasks/commit-build-time.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fi
1313
build_time="$(cat "${REPO_PARENT}/build-time/timestamp")"
1414
formatted_build_time="$(date --date "${build_time%.*}" +%Y%m%dT%H%M%SZ)"
1515

16-
pushd "${REPO_PARENT}/bosh-linux-stemcell-builder"
16+
pushd "${REPO_ROOT}"
1717
echo "${formatted_build_time}" > build_time.txt
1818
git add -A
1919
git config --global user.email "ci@localhost"

ci/tasks/os-images/build.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ if [[ -n "${DEBUG:-}" ]]; then
1010
export BOSH_LOG_PATH="${BOSH_LOG_PATH:-${REPO_PARENT}/bosh-debug.log}"
1111
fi
1212

13-
cd "${REPO_PARENT}/bosh-linux-stemcell-builder"
14-
1513
function check_param() {
1614
local name=$1
1715
local value=$(eval echo '$'$name)
@@ -33,7 +31,13 @@ fi
3331
sudo chown -R ubuntu .
3432
sudo chown -R ubuntu:ubuntu /mnt
3533
sudo chmod u+s "$(which sudo)"
36-
bundle install
34+
35+
cd "${REPO_ROOT}"
36+
3737
sudo --preserve-env --set-home --user ubuntu -- /bin/bash --login -i <<SUDO
38+
pushd "${REPO_ROOT}/bosh-stemcell"
39+
bundle install
40+
popd
41+
3842
bundle exec rake stemcell:build_os_image[$OPERATING_SYSTEM_NAME,$OPERATING_SYSTEM_VERSION,$OS_IMAGE]
39-
SUDO
43+
SUDO

ci/tasks/test-stemcell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if bosh int "${REPO_PARENT}/director-state/director-creds.yml" --path /jumpbox_s
4040
export BOSH_GW_HOST="${BOSH_ENVIRONMENT}"
4141
fi
4242

43-
pushd "${REPO_PARENT}/bosh-linux-stemcell-builder/acceptance-tests"
43+
pushd "${REPO_ROOT}/acceptance-tests"
4444
# shellcheck disable=SC2154
4545
go run github.com/onsi/ginkgo/v2/ginkgo --skip-package vendor -r "${package}"
4646
popd

0 commit comments

Comments
 (0)