Skip to content

Commit f887584

Browse files
authored
Bump Debian to 12, Packer to 1.11 and Chef to 18.5 (#58)
* Bump Debian to 12 * fix: error when copying to a non-existing target * fix: increase timeout
1 parent 87c0d63 commit f887584

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

Dockerfile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2018 Google LLC. All rights reserved.
1+
# Copyright 2024 Google LLC. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -11,16 +11,16 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313

14-
FROM marketplace.gcr.io/google/debian11
14+
FROM marketplace.gcr.io/google/debian12
1515

16-
ENV PACKER_VERSION 1.8.3
17-
ENV PACKER_SHA256 0587f7815ed79589cd9c2b754c82115731c8d0b8fd3b746fe40055d969facba5
18-
ENV PACKER_BINARY /bin/packer
16+
ENV PACKER_VERSION=1.11.2
17+
ENV PACKER_SHA256=ced13efc257d0255932d14b8ae8f38863265133739a007c430cae106afcfc45a
18+
ENV PACKER_BINARY=/bin/packer
1919

20-
ENV CHEF_DIR /chef
21-
ENV PACKER_DIR /packer/templates
22-
ENV TESTS_DIR /tests
23-
ENV KEY_FILE_PATH /service-account.json
20+
ENV CHEF_DIR=/chef
21+
ENV PACKER_DIR=/packer/templates
22+
ENV TESTS_DIR=/tests
23+
ENV KEY_FILE_PATH=/service-account.json
2424

2525
# Installs packages
2626
RUN set -eux \

cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
timeout: 600s
1+
timeout: 800s
22
options:
33
workerPool: projects/${PROJECT_ID}/locations/us-central1/workerPools/gcb-workers-pool-e2
44
steps:

scripts/build-vm-image.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ python3 "${SCRIPT_DIR}/packergen.py" "${INPUT_TEMPLATE}" > /tmp/template.json
9595

9696
echo "Packer: $("${PACKER_BINARY}" -v)"
9797

98+
# Install googlecompute and chef plugins
99+
"${PACKER_BINARY}" plugins install github.com/hashicorp/googlecompute
100+
"${PACKER_BINARY}" plugins install github.com/hashicorp/chef
101+
98102
# Build the packer command
99103
PACKER_COMMAND=("${PACKER_BINARY}" build -color=false)
100104
PACKER_COMMAND+=(-var "chefdir=${CHEF_DIR}")

scripts/packergen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
# Install chef-solo via deb package.
2222
INSTALL_CHEF_SOLO = r"""
23-
declare -r VERSION=18.2.7
24-
declare -r SHA256=a4461840de71f08f11f3c65a6d2f40f41d394e98f84979f7a8388ed0b578c666
23+
declare -r VERSION=18.5.0
24+
declare -r SHA256=1918e72eebeea0dd2f7680b08f1362d699b37570431ebca3c1b4fbe40cfc2abb
2525

2626
curl "https://packages.chef.io/files/stable/chef/${VERSION}/debian/11/chef_${VERSION}-1_amd64.deb" -o chef-solo.deb \
2727
&& echo "${SHA256} chef-solo.deb" | sha256sum -c \

scripts/run-tests.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,25 @@ while (( ${index} <= ${max_connection_attempts} )); do
9494
done
9595

9696
# Create $IMAGEBUILDER_TEST_DIR directory and upload tests there
97+
echo "Copying tests to the tester instance..."
98+
ssh -i "${PRIVATE_SSH_KEY}" \
99+
-o UserKnownHostsFile="${TEMPDIR}/known_hosts" \
100+
-o StrictHostKeyChecking=no \
101+
"${USER}@${IP}" \
102+
"/bin/bash -e -c 'mkdir -p "${IMAGEBUILDER_TEST_DIR}"'"
97103
scp -r \
98104
-i "${PRIVATE_SSH_KEY}" \
99105
-o UserKnownHostsFile="${TEMPDIR}/known_hosts" \
100106
-o StrictHostKeyChecking=no \
101107
"${TESTS_DIR}" "${USER}@${IP}:${IMAGEBUILDER_TEST_DIR}/"
102108

103109
# Run tests
110+
echo "Running tests in tester instance..."
104111
ssh -i "${PRIVATE_SSH_KEY}" \
105112
-o UserKnownHostsFile="${TEMPDIR}/known_hosts" \
106113
-o StrictHostKeyChecking=no \
107114
"${USER}@${IP}" \
108-
"/bin/bash -eu -c 'chmod +x ${IMAGEBUILDER_TEST_DIR}/run-tests-on-instance.sh && PACKER_SSH_USERNAME=${PACKER_SSH_USERNAME} SOLUTION_NAME=${SOLUTION_NAME} ${IMAGEBUILDER_TEST_DIR}/run-tests-on-instance.sh'" \
115+
"/bin/bash -eu -c 'chmod +x ${IMAGEBUILDER_TEST_DIR}/tests/run-tests-on-instance.sh && PACKER_SSH_USERNAME=${PACKER_SSH_USERNAME} SOLUTION_NAME=${SOLUTION_NAME} ${IMAGEBUILDER_TEST_DIR}/tests/run-tests-on-instance.sh'" \
109116
&& lcstatus=$? || lcstatus=$?
110117

111118
echo "--> Deleting the temporary instance (${INSTANCE}) ..."

0 commit comments

Comments
 (0)