Skip to content

Commit

Permalink
Packer: set 'cloudwatch_group' in worker config if provided
Browse files Browse the repository at this point in the history
Set the 'cloudwatch_group' value in the worker configuration if provided
in /tmp/cloud_init_vars, so that it is used by the worker when spinning
up an osbuild-executor instance.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza committed Mar 8, 2024
1 parent e7743f1 commit 1659d19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ source /tmp/cloud_init_vars

echo "Writing osbuild_executor config to worker configuration."
OSBUILD_EXECUTOR_IAM_PROFILE=${OSBUILD_EXECUTOR_IAM_PROFILE:-osbuild-executor}
OSBUILD_EXECUTOR_CLOUDWATCH_GROUP=${OSBUILD_EXECUTOR_CLOUDWATCH_GROUP:-}

CLOUDWATCH_GROUP_CONFIG=""
if [ -n "${OSBUILD_EXECUTOR_CLOUDWATCH_GROUP}" ]; then
CLOUDWATCH_GROUP_CONFIG="cloudwatch_group = \"${OSBUILD_EXECUTOR_CLOUDWATCH_GROUP}\"\n"
fi

sudo tee -a /etc/osbuild-worker/osbuild-worker.toml > /dev/null << EOF
[osbuild_executor]
type = "aws.ec2"
iam_profile = "${OSBUILD_EXECUTOR_IAM_PROFILE}"
${CLOUDWATCH_GROUP_CONFIG}
EOF
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -euo pipefail

source /etc/os-release
# TODO: uncomment, when the cloud_init_vars file is created on the executor
#source /tmp/cloud_init_vars
# /tmp/cloud_init_vars may not exist on the osbuild-executor
source /tmp/cloud_init_vars || true

# Don't subscribe on fedora
if [ "$ID" != fedora ]; then
Expand Down

0 comments on commit 1659d19

Please sign in to comment.