Skip to content

Commit c0c031c

Browse files
committed
CI: remove (future) deprecated --preserve-env flag
Explicitly pass: - GEM_HOME - BUILD_TIME - UBUNTU_ADVANTAGE_TOKEN - UBUNTU_FIPS_USE_IAAS_KERNEL Fixes: ``` sudo: preserving the entire environment is not supported, '--preserve-env' is ignored ubuntu@21f652d6-b208-4386-b0c0-097e26578228:/tmp/build/44575cf5$ set -e ubuntu@21f652d6-b208-4386-b0c0-097e26578228:/tmp/build/44575cf5$ ubuntu@21f652d6-b208-4386-b0c0-097e26578228:/tmp/build/44575cf5$ cd "/tmp/build/44575cf5/bosh-linux-stemcell-builder" ubuntu@21f652d6-b208-4386-b0c0-097e26578228:/tmp/build/44575cf5/bosh-linux-stemcell-builder$ bundle install Bundler 4.0.13 is running, but your lockfile was generated with 2.5.23. Installing Bundler 2.5.23 and restarting using that version. Fetching gem metadata from https://rubygems.org/. Fetching bundler 2.5.23 Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::PermissionError There was an error while trying to write to `/usr/local/lib/ruby/gems/3.3.0/cache/bundler-2.5.23.gem`. It is likely that you need to grant write permissions for that path. ``` ^ https://bosh.ci.cloudfoundry.org/teams/stemcell/pipelines/ubuntu-resolute-builder/jobs/build-os-image/builds/1#L6a052874:4:13
1 parent b042519 commit c0c031c

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

ci/tasks/build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ chown -R ubuntu:ubuntu "${REPO_PARENT}/bosh-linux-stemcell-builder"
7777
chown -R ubuntu:ubuntu /mnt
7878
sudo chmod u+s "$(which sudo)"
7979

80-
sudo --preserve-env --set-home --user ubuntu -- /bin/bash --login -i <<SUDO
80+
sudo --set-home --user ubuntu -- \
81+
env GEM_HOME="${GEM_HOME}" \
82+
UBUNTU_ADVANTAGE_TOKEN="${UBUNTU_ADVANTAGE_TOKEN:=}" \
83+
UBUNTU_FIPS_USE_IAAS_KERNEL="${UBUNTU_FIPS_USE_IAAS_KERNEL:-}" \
84+
/bin/bash --login -i <<SUDO
8185
set -e
8286
8387
cd "${REPO_PARENT}/bosh-linux-stemcell-builder"

ci/tasks/os-images/build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ chown -R ubuntu:ubuntu "${REPO_PARENT}/bosh-linux-stemcell-builder"
3535
chown -R ubuntu:ubuntu /mnt
3636
sudo chmod u+s "$(which sudo)"
3737

38-
sudo --preserve-env --set-home --user ubuntu -- /bin/bash --login -i <<SUDO
38+
sudo --set-home --user ubuntu -- \
39+
env GEM_HOME="${GEM_HOME}" \
40+
BUILD_TIME="${BUILD_TIME:-}" \
41+
UBUNTU_ADVANTAGE_TOKEN="${UBUNTU_ADVANTAGE_TOKEN:-}" \
42+
UBUNTU_DEBOOTSTRAP_MIRROR="${UBUNTU_DEBOOTSTRAP_MIRROR:-}" \
43+
/bin/bash --login -i <<SUDO
3944
set -e
4045
4146
cd "${REPO_PARENT}/bosh-linux-stemcell-builder"
4247
bundle install
4348
44-
bundle exec rake stemcell:build_os_image[$OPERATING_SYSTEM_NAME,$OPERATING_SYSTEM_VERSION,$OS_IMAGE]
49+
bundle exec rake stemcell:build_os_image[${OPERATING_SYSTEM_NAME},${OPERATING_SYSTEM_VERSION},${OS_IMAGE}]
4550
SUDO

0 commit comments

Comments
 (0)