Files
copr-publish/README.md
rob thijssen 95a84e4ad8 fix: require every chroot to succeed, and repair a stale timeout variable
Two things.

A build-level "succeeded" says the build finished, not that every chroot
produced an RPM. The job could go green while fedora-43, fedora-44 or rawhide
had failed or was still building. Poll build-chroot/list alongside the build
state, keep waiting while any chroot is unfinished, and fail if any finished in
anything other than succeeded or skipped. Per-chroot results are printed at the
end and included in the heartbeat, so a slow chroot is visible while it runs.

copr-cli has no per-chroot status subcommand, so this reads COPR's public API
directly with python3 — already a hard dependency of copr-cli, so nothing new
is required. COPR_API_BASE overrides the instance.

Separately, renaming BUILD_TIMEOUT to WAIT_BUDGET in v1.0.5 missed the
watch-build invocation, leaving `timeout "" copr-cli watch-build`. That failed
immediately, so the progress stream has not actually run since v1.0.5 —
harmless only because the verdict comes from polling, and caught here because
the new tests surfaced the error text.

The unfinished-versus-failed distinction is deliberate and load-bearing:
reporting a still-running chroot as a failure would be the same mistake this
action has now made in three different guises.
2026-08-07 16:42:30 +03:00

3.6 KiB

copr-publish

Gitea composite action that submits a source RPM to Fedora COPR, watches the build, and dumps each chroot's builder-live.log into the CI output as collapsible groups.

Why use this

copr-cli build by itself only prints status transitions (pending / importing / running / succeeded). When a build fails you have to click through to the COPR web UI to see the actual log. This action:

  • Submits with --nowait and captures the build ID.
  • Prints a clickable https://copr.fedorainfracloud.org/coprs/build/... link so you can follow live.
  • Streams status transitions from copr-cli watch-build while polling COPR for the build's actual state, so the job's verdict comes from the build rather than from the health of a long-lived connection.
  • On completion, fetches each chroot's builder-live.log via copr-cli download-build and emits them as ::group:: blocks.
  • Waits for every chroot to finish, not just the build as a whole, and fails CI if any of them failed. A build-level "succeeded" is not the same as every release having produced an RPM.
  • Fails CI if the build fails. A build or chroot merely still running when the wait budget expires is reported, not failed.
  • Returns within COPR_WAIT_BUDGET whatever happens, so the step finishes before a CI runner's step limit kills it.

Environment overrides

Variable Default Purpose
COPR_WAIT_BUDGET 2700 Seconds to wait for the build before returning. A build still running at expiry is reported as such and the step exits 0 — CI runners commonly kill a step long before a large build finishes.
COPR_POLL_INTERVAL 30 Seconds between build-state polls.
COPR_API_BASE https://copr.fedorainfracloud.org COPR instance queried for per-chroot state.

Requirements

The runner must already have:

  • copr-cli on PATH (provided by the copr-cli RPM on Fedora runners).
  • grep -P (PCRE, default on Fedora).
  • python3, used to read per-chroot state from COPR's API. Already a hard dependency of copr-cli, so this adds nothing in practice.

Inputs

Input Required Description
project yes COPR project in the form <owner>/<project>, e.g. helexa/cortex.
srpm yes Path or glob to the source RPM(s) to submit, e.g. *.src.rpm.
copr-config yes Contents of ~/.config/copr. Fetch from https://copr.fedorainfracloud.org/api/ and store as a repo or org secret.

Usage

jobs:
  publish:
    runs-on: fedora
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: my-srpm

      - name: Publish to COPR
        uses: https://git.lair.cafe/actions/copr-publish@v1
        with:
          project: helexa/cortex
          srpm: '*.src.rpm'
          copr-config: ${{ secrets.COPR_CONFIG }}

Note the fully-qualified URL in uses: — the Gitea instance's DEFAULT_ACTIONS_URL points at github.com, so internal actions must be referenced by absolute URL.

Versioning

Pin to a major version tag (@v1) for automatic patch/minor updates. Pin to an exact tag (@v1.0.3) to freeze.

Obtaining COPR_CONFIG

  1. Log in to https://copr.fedorainfracloud.org/.
  2. Visit https://copr.fedorainfracloud.org/api/.
  3. Copy the entire [copr-cli] config block.
  4. Save as a Gitea secret named COPR_CONFIG in the consuming repo (or at org level to share across all org repos).