Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ that can be used for linting and formatting code when you're preparing contribut


```shell
tox run -e format # update your code according to linting rules
tox run -e lint # code style
tox run -e unit # unit tests
tox run -e integration # integration tests
tox # runs 'format', 'lint', and 'unit' environments
tox run -e format
tox run -e lint
tox run -e unit
tox run -e integration
tox
```


The integration tests (both of the charm and the app)
require options to be passed via the command line (see `tests/conftest.py`) and
require options to be passed through the command line (see `tests/conftest.py`) and
environment variables `OPENSTACK_PASSWORD` to be able to deploy the charm and/or upload images to OpenStack.

## Build the charm
Expand Down
13 changes: 9 additions & 4 deletions Makefile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ endif
.PHONY: .check-lychee
.check-lychee:
ifndef HAS_LYCHEE
$(call errmsg,'lychee' is not installed. Please install it first) \
exit 1;
$(call msg,--- 'lychee' not installed; skipping link check ---)
else
@true
endif


Expand All @@ -60,9 +61,13 @@ vale: .check-vale vale-sync ## Run Vale checks on docs
# ==============================================================================

.PHONY: lychee
lychee: .check-lychee ## Run Lychee checks on docs
$(call msg,--- Running lychee checks on "$(LYCHEE_DOCS_FILES)"... ---)
lychee: ## Run Lychee checks on docs
ifeq ($(HAS_LYCHEE),)
$(call msg,--- 'lychee' not installed; skipping link check ---)
else
$(call msg,--- Running lychee checks on "$(DOCS_FILES)"... ---)
@lychee $(DOCS_FILES)
endif

# ==============================================================================
# Helper Targets
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Deploy GitHub runner image builder with GitHub runners.

<!--Indicate software and hardware prerequisites-->
You'll need a working [OpenStack installation](https://microstack.run/docs/single-node) with
flavors with a minimum of 2 CPU cores, 8GB RAM and 10GB disk.
flavors with a minimum of two CPU cores, 8GB RAM and 10GB disk.

### Set up

Expand Down
4 changes: 2 additions & 2 deletions app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
]
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
/usr/bin/sudo snap disable opentelemetry-collector
}

function install_github_runner() {
version="$1"
arch="$2"
Expand Down Expand Up @@ -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
7 changes: 7 additions & 0 deletions app/tests/integration/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
7 changes: 7 additions & 0 deletions app/tests/unit/test_openstack_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
/usr/bin/sudo snap disable opentelemetry-collector
}}

function install_github_runner() {{
version="$1"
arch="$2"
Expand Down Expand Up @@ -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\
Expand Down
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

<!-- vale Canonical.007-Headings-sentence-case = NO -->

## [#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.

Expand All @@ -26,7 +29,7 @@

### Bug Fixes

* The proxy configuration was not set for the snap install of aproxy during image building, causing the image building to fail if snapstore need to be accessed through a proxy. This is fixed.
* The proxy configuration was not set for the snap install of a proxy during image building, causing the image building to fail if the Snap Store needs to be accessed through a proxy. This is fixed.

## [#144 feat(docs): Evolve and standardize the documentation workflow](https://github.com/canonical/github-runner-image-builder-operator/pull/144) (2025-08-22)

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/configure-build-interval.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ juju deploy github-runner-image-builder \
--config openstack-user-name=$OPENSTACK_USERNAME
```

The example above would build images every three hours, from the latest version of dependent sources (cloud-images, apt, snap, etc).
The example above would build images every three hours, from the latest version of dependent sources (cloud-images, apt, snap, and so on).
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SRE teams through Juju's clean interface.

## Contributing to this documentation

Documentation is an important part of this project, and we take the same open-source approach to the documentation as the code. As such, we welcome community contributions, suggestions and constructive feedback on our documentation. Our documentation is hosted on the [Charmhub forum](https://discourse.charmhub.io/t/github-runner-image-builder-documentation-overview) to enable easy collaboration. Please use the "Help us improve this documentation" links on each documentation page to either directly change something you see that's wrong, ask a question, or make a suggestion about a potential change via the comments section.
Documentation is an important part of this project, and we take the same open-source approach to the documentation as the code. As such, we welcome community contributions, suggestions and constructive feedback on our documentation. Our documentation is hosted on the [Charmhub forum](https://discourse.charmhub.io/t/github-runner-image-builder-documentation-overview) to enable easy collaboration. Please use the "Help us improve this documentation" links on each documentation page to either directly change something you see that's wrong, ask a question, or make a suggestion about a potential change through the comments section.

If there's a particular area of documentation that you'd like to see that's missing, please [file a bug](https://github.com/canonical/github-runner-image-builder-operator/issues).

Expand Down
14 changes: 7 additions & 7 deletions docs/reference/charm-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ The image-builder uses an OpenStack cloud to build images.
Through integration with another charm, the charm obtains the credentials to upload the images to a specified OpenStack project,
which can then be reused by the other charm to spawn VM instances with the necessary software preinstalled.

The image-builder uses the [OpenStack SDK](https://docs.openstack.org/openstacksdk/latest/) to spawn a VM instance in a cloud specified
The image-builder uses the [OpenStack SDK](https://docs.openstack.org/openstacksdk/latest/) to spawn a VM instance in a cloud specified
by a config option. Using an external OpenStack VM instead of the charm's machine allows for more features
(using chroot has some limitations, e.g. for building snaps) and parallel image building.
[cloud-init](https://cloud-init.io/) is used to install the necessary dependencies for spawning self-hosted runners
([github actions runner binary](https://github.com/actions/runner)) and tools for automatic proxy support ([aproxy](https://github.com/canonical/aproxy)).
([GitHub Actions runner binary](https://github.com/actions/runner)) and tools for automatic proxy support ([proxy tool](https://github.com/canonical/aproxy)).
There is also a custom script configuration combined with a secret that is run in the cloud-init script to allow further customization of the images.
The image-builder repeatedly checks to see if the cloud-init script has finished successfully, then snapshots the VM, uploads the image to a specified OpenStack project
and deletes the VM. This specified OpenStack project is determined via the `image:github_runner_image_v0` integration with another charm (e.g. [GitHub Runner Charm](https://charmhub.io/github-runner)).
and deletes the VM. This specified OpenStack project is determined through the `image:github_runner_image_v0` integration with another charm (e.g. [GitHub Runner Charm](https://charmhub.io/github-runner)).

The other charm can then use the image to create a VM instance with the required software preinstalled. It receives
the image ID from the Image Builder charm via the integration mentioned above.
the image ID from the Image Builder charm through the integration mentioned above.

Depending on the configuration, the charm will trigger multiple image builds in parallel to speed up the process. This
leads to multiple OpenStack VMs in the OpenStack cloud (and requires corresponding OpenStack quotas) and multiple
Expand All @@ -66,7 +66,7 @@ and uploaded to OpenStack.

The image-builder application is initialized by the charm before it can be used. Initialization includes

- Downloading and validating the base images (e.g. Ubuntu 22.04 or 24.04)
- Downloading and validating the base images (e.g. Ubuntu 22.04 LTS or Ubuntu 24.04 LTS)
- Uploading the base images to OpenStack
- Creating key pairs and security groups in OpenStack

Expand Down Expand Up @@ -115,7 +115,7 @@ Once the build is complete, the image-builder will upload the image taking into

## Charm code overview

The `src/charm.py` is the default entry point for a charm and has the GithubRunnerImageBuilderCharm Python class which inherits from CharmBase. CharmBase is the base class
The `src/charm.py` is the default entry point for a charm and has the GitHubRunnerImageBuilderCharm Python class which inherits from CharmBase. CharmBase is the base class
from which all charms are formed, defined by [Ops](https://juju.is/docs/sdk/ops) (Python framework for developing charms).

> See more in the Juju docs: [Charm](https://documentation.ubuntu.com/juju/3.6/reference/charm/)
Expand All @@ -133,7 +133,7 @@ juju config github-runner-image-builder build-interval=3
```python
self.framework.observe(self.on.config_changed, self._on_config_changed)
```
4. The method `_on_config_changed`, for its turn, will take the necessary actions such as updating the cron job's interval to 3 hours.
4. The method `_on_config_changed`, for its turn, will take the necessary actions such as updating the cron job's interval to three hours.


The code is structured according to the best practices described in [Managing charm complexity](https://discourse.charmhub.io/t/specification-isd014-managing-charm-complexity/11619).
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ juju deploy github-runner-image-builder \
--config openstack-user-name=$OPENSTACK_USERNAME
```

- Verify that the image is being built via Juju logs:
- Verify that the image is being built using Juju logs:
```
juju debug-log --include=github-runner-image-builder/0
```
Expand Down
Loading