Skip to content

Commit

Permalink
Bump Debian to 12, Packer to 1.11 and Chef to 18.5 (#58)
Browse files Browse the repository at this point in the history
* Bump Debian to 12

* fix: error when copying to a non-existing target

* fix: increase timeout
  • Loading branch information
armandomiani authored Dec 4, 2024
1 parent 87c0d63 commit f887584
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Google LLC. All rights reserved.
# Copyright 2024 Google LLC. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,16 +11,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

FROM marketplace.gcr.io/google/debian11
FROM marketplace.gcr.io/google/debian12

ENV PACKER_VERSION 1.8.3
ENV PACKER_SHA256 0587f7815ed79589cd9c2b754c82115731c8d0b8fd3b746fe40055d969facba5
ENV PACKER_BINARY /bin/packer
ENV PACKER_VERSION=1.11.2
ENV PACKER_SHA256=ced13efc257d0255932d14b8ae8f38863265133739a007c430cae106afcfc45a
ENV PACKER_BINARY=/bin/packer

ENV CHEF_DIR /chef
ENV PACKER_DIR /packer/templates
ENV TESTS_DIR /tests
ENV KEY_FILE_PATH /service-account.json
ENV CHEF_DIR=/chef
ENV PACKER_DIR=/packer/templates
ENV TESTS_DIR=/tests
ENV KEY_FILE_PATH=/service-account.json

# Installs packages
RUN set -eux \
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
timeout: 600s
timeout: 800s
options:
workerPool: projects/${PROJECT_ID}/locations/us-central1/workerPools/gcb-workers-pool-e2
steps:
Expand Down
4 changes: 4 additions & 0 deletions scripts/build-vm-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ python3 "${SCRIPT_DIR}/packergen.py" "${INPUT_TEMPLATE}" > /tmp/template.json

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

# Install googlecompute and chef plugins
"${PACKER_BINARY}" plugins install github.com/hashicorp/googlecompute
"${PACKER_BINARY}" plugins install github.com/hashicorp/chef

# Build the packer command
PACKER_COMMAND=("${PACKER_BINARY}" build -color=false)
PACKER_COMMAND+=(-var "chefdir=${CHEF_DIR}")
Expand Down
4 changes: 2 additions & 2 deletions scripts/packergen.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

# Install chef-solo via deb package.
INSTALL_CHEF_SOLO = r"""
declare -r VERSION=18.2.7
declare -r SHA256=a4461840de71f08f11f3c65a6d2f40f41d394e98f84979f7a8388ed0b578c666
declare -r VERSION=18.5.0
declare -r SHA256=1918e72eebeea0dd2f7680b08f1362d699b37570431ebca3c1b4fbe40cfc2abb
curl "https://packages.chef.io/files/stable/chef/${VERSION}/debian/11/chef_${VERSION}-1_amd64.deb" -o chef-solo.deb \
&& echo "${SHA256} chef-solo.deb" | sha256sum -c \
Expand Down
9 changes: 8 additions & 1 deletion scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,25 @@ while (( ${index} <= ${max_connection_attempts} )); do
done

# Create $IMAGEBUILDER_TEST_DIR directory and upload tests there
echo "Copying tests to the tester instance..."
ssh -i "${PRIVATE_SSH_KEY}" \
-o UserKnownHostsFile="${TEMPDIR}/known_hosts" \
-o StrictHostKeyChecking=no \
"${USER}@${IP}" \
"/bin/bash -e -c 'mkdir -p "${IMAGEBUILDER_TEST_DIR}"'"
scp -r \
-i "${PRIVATE_SSH_KEY}" \
-o UserKnownHostsFile="${TEMPDIR}/known_hosts" \
-o StrictHostKeyChecking=no \
"${TESTS_DIR}" "${USER}@${IP}:${IMAGEBUILDER_TEST_DIR}/"

# Run tests
echo "Running tests in tester instance..."
ssh -i "${PRIVATE_SSH_KEY}" \
-o UserKnownHostsFile="${TEMPDIR}/known_hosts" \
-o StrictHostKeyChecking=no \
"${USER}@${IP}" \
"/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'" \
"/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'" \
&& lcstatus=$? || lcstatus=$?

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

0 comments on commit f887584

Please sign in to comment.