diff --git a/app/pyproject.toml b/app/pyproject.toml index 386db293..1deff3ce 100644 --- a/app/pyproject.toml +++ b/app/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "github-runner-image-builder" -version = "0.12.0" +version = "0.13.0" authors = [ { name = "Canonical IS DevOps", email = "is-devops-team@canonical.com" }, ] @@ -32,7 +32,7 @@ dependencies = { file = ["requirements.txt"] } [tool.pydocstyle] match = "src/github_runner_image_builder/cli.py" -ignore = ["D301"] # ignore backshlashes in docstring - click lib uses them. +ignore = ["D301"] # ignore backshlashes in docstring - click lib uses them. [tool.bandit] diff --git a/app/src/github_runner_image_builder/templates/cloud-init.sh.j2 b/app/src/github_runner_image_builder/templates/cloud-init.sh.j2 index 1f905ee9..f13fe4b4 100644 --- a/app/src/github_runner_image_builder/templates/cloud-init.sh.j2 +++ b/app/src/github_runner_image_builder/templates/cloud-init.sh.j2 @@ -120,6 +120,12 @@ function install_yq() { /usr/bin/snap remove go } +function install_opentelemetry_collector_snap() { + echo "Installing OpenTelemetry Collector snap" + /usr/bin/sudo snap install opentelemetry-collector --stable + /usr/bin/sudo snap disable opentelemetry-collector +} + function install_github_runner() { version="$1" arch="$2" @@ -172,6 +178,7 @@ if [ $RELEASE != "focal" ]; then install_yarn fi install_yq +install_opentelemetry_collector_snap install_github_runner "$github_runner_version" "$github_runner_arch" chown_home configure_system_users diff --git a/app/tests/integration/commands.py b/app/tests/integration/commands.py index e7d3e740..112f9b82 100644 --- a/app/tests/integration/commands.py +++ b/app/tests/integration/commands.py @@ -38,6 +38,13 @@ class Commands: name="check aproxy", command="sudo snap info aproxy && sudo snap services aproxy", ), + Commands( + name="check opentelemetry-collector snap installed and inactive", + command=( + "sudo snap services opentelemetry-collector | grep -q 'disabled' " + "&& sudo snap services opentelemetry-collector | grep -q 'inactive'" + ), + ), Commands(name="update apt in docker", command="docker run python:3.10-slim apt-get update"), Commands(name="docker version", command="docker version"), Commands(name="check python3 alias", command="python --version"), diff --git a/app/tests/unit/test_openstack_builder.py b/app/tests/unit/test_openstack_builder.py index 33099b40..2a1278e2 100644 --- a/app/tests/unit/test_openstack_builder.py +++ b/app/tests/unit/test_openstack_builder.py @@ -831,6 +831,12 @@ def test__generate_cloud_init_script( /usr/bin/snap remove go }} +function install_opentelemetry_collector_snap() {{ + echo "Installing OpenTelemetry Collector snap" + /usr/bin/sudo snap install opentelemetry-collector --stable + /usr/bin/sudo snap disable opentelemetry-collector +}} + function install_github_runner() {{ version="$1" arch="$2" @@ -884,6 +890,7 @@ def test__generate_cloud_init_script( install_yarn fi install_yq +install_opentelemetry_collector_snap install_github_runner "$github_runner_version" "$github_runner_arch" chown_home configure_system_users\ diff --git a/docs/changelog.md b/docs/changelog.md index 603312f4..8d00d65c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,9 @@ +## [#195 feat: otel-collector snap](https://github.com/canonical/github-runner-image-builder-operator/pull/195) (2026-02-11) +* Install opentelemetry collector snap in the runner image. + ## [#172 feat: apt upgrade](https://github.com/canonical/github-runner-image-builder-operator/pull/172) (2025-11-26) * Apply apt-update and apt-upgrade to GH runner images by applying them during cloud-init.