Skip to content

ci(integration): install app via git of the PR's exact head SHA#7

Merged
solracsf merged 1 commit intomainfrom
ci/integration-via-git
Apr 28, 2026
Merged

ci(integration): install app via git of the PR's exact head SHA#7
solracsf merged 1 commit intomainfrom
ci/integration-via-git

Conversation

@solracsf
Copy link
Copy Markdown
Owner

@solracsf solracsf commented Apr 28, 2026

Summary

Replaces the docker cp install flow in integration.yml with git clone + git checkout of the PR's exact head SHA inside the Nextcloud container, plus a version-match assertion as proof.

Why

occ app:enable interfonts doesn't download anything — it only enables what's on disk under custom_apps/interfonts/. The previous docker cp flow was installing the PR's code (from actions/checkout's runner tree), and nextcloud:32-apache doesn't ship interfonts (verified — only contactsinteraction is there), so nothing was actually shadowing the install.

But the workflow read like an App Store install. The intent is now self-evident: clone the repo, check out the PR's head SHA, install. No interpretation needed.

What changed in .github/workflows/integration.yml

Before After
Build /tmp/app/interfonts from runner's checkout via cp -r Removed
docker cp /tmp/app/interfonts nc:/var/www/html/custom_apps/... git clone --filter=blob:none + git fetch --depth 1 origin <PR head SHA> + git checkout FETCH_HEAD inside the container
Implicit "the right code is being tested" Explicit version-match assertion: app:list-reported version must equal appinfo/info.xml-declared version, else ::error::version mismatch
app:enable log line app:enable log line + git log -1 printout of the commit's SHA + subject + author

The cloned tree is staged into custom_apps/interfonts/ using the same release-tarball allowlist that release-publish.yml ships and tarball-dry-run validates. Three places to keep in sync; if they ever drift, integration is testing something different from what we ship.

Ref + URL resolution

Event REF CLONE_URL
pull_request (same repo) github.event.pull_request.head.sha github.event.pull_request.head.repo.clone_url (≡ base repo)
pull_request (fork) github.event.pull_request.head.sha github.event.pull_request.head.repo.clone_url (the fork)
push github.sha falls back to https://github.com/${{ github.repository }}.git
workflow_dispatch github.sha (current ref's HEAD) falls back to base repo

Bash null-coalescing: ${HEAD_REPO_URL:-https://github.com/${REPO}.git}.

Local validation (PR-style end-to-end)

Step Result
nextcloud:32-apache cold boot ready in ~30 s
apt-get install git ca-certificates in container ~10 s
git clone --filter=blob:none + fetch --depth 1 SHA + checkout ~1 s
Stage to custom_apps/ + chown + app:enable interfonts success
Version assertion: installed 2.1.1 vs PR 2.1.1 match
Stylesheet smoke test HTTP 200, 5454 bytes

Test plan

  • CI passes on this PR (the Nextcloud 32 smoke test and Nextcloud 33 smoke test jobs run the new git-based install and the version-match assertion against this PR's head SHA)
  • Logs of those jobs show the --- commit under test --- block with this PR's SHA + commit message
  • Logs show Installed version : <X> Expected (PR) : <X> with matching versions

Concern (raised on the previous integration.yml):

  > docker exec --user www-data nc php occ app:enable interfonts
  >
  > This will install the last official release, not the code being
  > tested. App should be installed using git so it pulls the exact
  > pull request being tested — otherwise what's the point?

Why the previous flow was technically correct but obscured intent
-----------------------------------------------------------------

`occ app:enable interfonts` does NOT download anything; it just
enables whatever's on disk under custom_apps/interfonts/. The
previous flow `docker cp /tmp/app/interfonts ...` did put the PR's
files there (built from actions/checkout's runner-side tree), so
the PR's code WAS what got loaded. Verified locally: nextcloud:32-apache
ships only `contactsinteraction` under apps/, no interfonts — so
nothing else could have shadowed the install.

That said, the workflow read like an App Store install. A reader
shouldn't need to know NC internals to be confident the PR's code
is exercised.

This change

- Replaces `docker cp` of the runner's tree with `git clone` of
  this repo + `git checkout` of the PR's exact head SHA inside
  the container — installation provenance is now self-evident
- Resolves the head SHA from `github.event.pull_request.head.sha`
  on PR events, falling back to `github.sha` on push events
- Resolves the clone URL from `github.event.pull_request.head.repo.clone_url`
  for fork PRs, falling back to the base repo URL for same-repo
  PRs (e.g. Dependabot) and pushes
- apt-get-installs `git` + `ca-certificates` inside the NC image
  before cloning (Debian-based, neither is preinstalled)
- Uses `--filter=blob:none --depth 1` for a fast partial fetch
  (~1-2 s vs full clone)
- Stages the cloned tree into custom_apps/interfonts using the
  SAME release-tarball allowlist already used by release-publish.yml
  and the tarball-dry-run job — three places to keep in sync
- Adds a hard assertion that the version `occ app:list` reports
  matches the version in the PR's `appinfo/info.xml`. Anything
  shadowing the install (a baked-in App Store version, a stale
  custom_apps copy from a previous run, etc.) would diverge here
  and the job fails loudly with `::error::version mismatch`
- Drops the now-redundant "Build the release-shape app directory"
  step (the staging happens inline in the install step now)

Validated locally on nextcloud:32-apache against origin/main's
HEAD: clone takes ~1 s, install takes ~5 s, version assertion
matches (2.1.1 = 2.1.1), stylesheet smoke test returns 200.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf solracsf merged commit c5c5fea into main Apr 28, 2026
16 checks passed
@solracsf solracsf deleted the ci/integration-via-git branch April 28, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant