Files
mikrotik-olsr/docs/ci.md
T
2026-11-19 09:21:01 +01:00

8.6 KiB

Gitea Actions

The repository is hosted at https://code.brunner.ninja/feedc0de/mikrotik-olsr.

Enable Actions and provide a trusted Linux runner with the mikrotik-olsr-builder label described below and network access to the pinned source/toolchain hosts and official MikroTik downloads. The check workflow needs no signing credentials and runs on pushes and pull requests.

Secrets

For a new publisher, generate a release keyset locally. For an existing installation, reuse its existing private keyset instead of generating another one:

python tools/routeros.py keygen --output .keys/release.json
python tools/routeros.py public-key --keys .keys/release.json --output release-public-key.json

In repository Settings -> Actions -> Secrets, add:

  • MIKROTIK_SIGNING_KEYSET: the complete contents of .keys/release.json.
  • QUAY_USERNAME and QUAY_TOKEN: credentials permitted to push registry.brunner.ninja/feedc0de/mikrotik-olsr.
  • GITEA_RELEASE_TOKEN is optional: CI uses its built-in GITEA_TOKEN by default with contents: write for release creation. Repository/owner Actions settings must permit that access. An explicit repository-write token can override it. A separate API token is only needed for publishing from your workstation.

For Quay robot credentials, set QUAY_USERNAME to the full robot name, e.g. feedc0de+gitea, and QUAY_TOKEN to that robot's token. Grant the robot Write permission on the image repository. Do not pair a robot token with your personal username. For an OAuth access token, use the literal username $oauthtoken (including the dollar sign), as described in the Quay API documentation. For account credentials, use the matching account username and registry password. Secret values should contain only the values, without surrounding quotes or a copied login command. Both publishing workflows check login before building; this checks authentication, while repository write access is checked during push.

Back up the release keyset outside the runner. Do not generate new release keys on each run: installed devices must recognize future packages. Protect main and limit who can modify/run the release workflow. Do not run untrusted pull request code with release secrets.

The signing step writes the key to a private temporary file and removes it on exit. Only the public key export is included in the release output.

Run a release

Push a new annotated tag matching ros-VERSION-arm-rNUMBER to run the complete build and publish automatically, for example ros-7.25.1-arm-r2. The version is parsed from the tag. Tags must point to reviewed release source; protect release tags as well as main because tagged workflows can access signing credentials.

Alternatively run Build NPK and container release manually on main, selecting the RouterOS version and a new tag such as ros-7.25.1-arm-r1. The workflow builds BusyBox, olsrd, BIRD and the service helpers, patches/signs packages and both installers, verifies signatures/checksums, and saves a downloadable Actions artifact. The same run also builds ARMv7 and ARM64 container archives. These are included in the release assets together with container instructions and the interface filter generator. Containers are development snapshots pending native forwarding acceptance; a successful build is not a hardware certification.

Enable the publish input to push the multiarchitecture container manifest tagged with the full source commit, then create a Gitea prerelease. A registry push failure prevents release publication (a successful registry push cannot be rolled back if a later release upload fails). With publication disabled, no publication credentials are needed. The artifact step uses upload-artifact v3 for Gitea compatibility. A working runner and signing secret are still required.

The uploader first creates a draft, uploads all checksummed files, and only then publishes it. A failed upload leaves a draft for inspection. It never overwrites an existing release tag automatically.

No signing secret or release token is shipped with this repository. Until those secrets and a runner are configured, the workflow definition alone cannot produce a hosted release. Hardware validation is not performed by CI, and the prerelease description explicitly records the unfinished OLSR integration.

Download page

The buildless page in site/ fetches public release metadata from the Gitea API. Host that directory on your static web server. The server must allow browser access to the public Gitea API (CORS for a different origin). The page also links directly to Gitea releases when API access is unavailable. No private token belongs in the page.

Manual first release

The local release bundle uses the keyset already installed on the test AP. Set MIKROTIK_SIGNING_KEYSET to that same keyset for compatible CI updates. Never commit it. In Gitea, create a prerelease targeting the exact source commit in manifest.json, paste RELEASE-NOTES.md, and attach every file from the bundle, including SHA256SUMS, public-key.json and runtime-sources.tar.gz. Use the tag ros-7.25.1-arm-r1 for the first bundle. Publish only after all uploads finish.

Alternatively, after configuring API access:

python tools/publish-release.py --tag ros-7.25.1-arm-r1 \
  --directory dist/ros-7.25.1-arm-r1 --token-file /path/to/private-token-file

Container-only CI

Changes to container sources, tests or the shared build script trigger .gitea/workflows/container.yml. Pull requests build/test and save ARM archives; main builds additionally push the commit-tagged image using the two registry secrets. The full NPK/container release runs on explicit release tags or manual dispatch; it requires the long-lived signing key and a unique release tag.

The keyset currently installed on the lab AP is .keys/development.json. Use that existing keyset for this publisher's MIKROTIK_SIGNING_KEYSET; generating a different key would make package-only updates incompatible. Never commit it.

Podman runner setup

These workflows use Podman as a remote client through /var/run/docker.sock, which this runner exposes from its host rootless Podman service. Nested Podman storage is not used. The host user needs valid subordinate UID/GID ranges and registered static QEMU binfmt handlers for ARM and AArch64. Verify both with podman run --rm --platform linux/arm64 alpine:3.22 uname -m and the corresponding linux/arm/v7 command. A Docker-only runner must adapt the image build commands or provide a Podman socket. Only run trusted code on a runner whose engine socket can control the host user's containers.

Avoid repeated dependency downloads

Build the reusable CI image once on the runner host, from this repository:

podman build -f ci/Dockerfile -t localhost/mikrotik-olsr-ci:20261119 .

Add this runner label and reload the runner after active jobs finish:

- "mikrotik-olsr-builder:docker://localhost/mikrotik-olsr-ci:20261119"

Keep container.force_pull: false so the host uses its local image. It contains build tools and a virtualenv with the pinned Python requirements. Routine jobs perform no apt install/update and no pip install. Rebuild the image explicitly when ci/Dockerfile or requirements.txt changes; the workflow checks that Python requirements match. The builder uses a pinned base image and Ubuntu-signed packages from the Kumi mirror to avoid the slow main archive on this host.

Gitea Actions caches the pinned source archives, OLSR Git objects and official RouterOS inputs. Runtime archives are checksum-verified again on every build. Caches are saved after the corresponding successful build step, so a later publication failure does not discard downloaded inputs. Payloads are rebuilt fresh; signing keys and signed outputs are never cached. The cache key changes with source recipes or RouterOS version. Container layers remain in the host Podman engine's persistent storage, so unchanged Dockerfile layers are reused. The first build or a deliberate cache purge still downloads missing inputs. Cache storage and builder-image storage need periodic space management; do not run blanket Podman pruning on a shared host.

On this rootless Podman runner, advertise the cache through Podman's host alias, not the host LAN address (which is not reachable through its rootless network):

cache:
  enabled: true
  v2: true
  host: host.containers.internal
  port: 43947

The port must be free on the runner. Restart the runner after active jobs finish. An ECONNREFUSED cache warning means the cache is not working even when the Actions step is marked successful; verify an actual cache save and later restore.