Skip to content

feat: pro rock in ACR - #1153

Open
zhijie-yang wants to merge 21 commits into
mainfrom
ROCKS-2675/enable-ecr-rework
Open

feat: pro rock in ACR#1153
zhijie-yang wants to merge 21 commits into
mainfrom
ROCKS-2675/enable-ecr-rework

Conversation

@zhijie-yang

@zhijie-yang zhijie-yang commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Jobs to be done: Rebuild, Continuous scanning


Description

Add support for building and releasing Ubuntu Pro Rocks to a private Azure Container Registry.

Changes

  • Extend the image trigger schema with upload[*].pro.services (user-facing) and pro-release (no user-facing).
  • Validate supported, unique Ubuntu Pro services.
  • Build Pro images using centrally managed Pro credentials.
  • Encrypt Pro OCI archives with GPG while stored as workflow artifacts.
  • Publish Pro images exclusively to ACR and track them in _pro_releases.json. (no uploads to GHCR)
  • Keep public GHCR, Docker Hub, ECR, GitHub Release, and documentation flows unchanged.
  • Add Pro-aware rebuild, vulnerability-scan, release, and continuous-testing workflows.
  • Cache encrypted archives and decrypt them only in ephemeral test jobs.
  • Add unit, integration, workflow-contract, and publishing tests.
  • Document Pro image configuration and current limitations.

Limitations

  • Pro support is currently a preview.
  • Existing Pro revisions cannot be promoted using pro-release; releases must be done via a rebuild.
  • Pro releases do not update registry documentation, as ACR does not have a WebUI for the docs.

Testing

All PR checks pass, including pytest, bats, workflow contract tests, and mock-rock build, test, and release workflows.

Related issues


Picture of a cool rock:

@zhijie-yang
zhijie-yang force-pushed the ROCKS-2675/enable-ecr-rework branch 7 times, most recently from b79f5c6 to 224baa8 Compare July 17, 2026 15:12
@zhijie-yang
zhijie-yang force-pushed the ROCKS-2675/enable-ecr-rework branch from 224baa8 to 27d800d Compare July 18, 2026 21:45
Comment thread .github/workflows/Image.yaml Outdated
Test-Rock previously either cached the decrypted, unpacked image
(as on main) or, for encrypted Pro artifacts, skipped the cache and
re-ran a per-job prepare-rock-for-testing action to download + decrypt +
convert. The former persists Pro (private) image bytes unencrypted at
rest in the Actions cache, violating the Pro invariant that image
archives stay gpg-encrypted while exchanged and retained; the latter
duplicated logic across every test job and disabled caching for Pro.

Unify both paths: configure-tests now caches the OCI archive exactly as
downloaded (still gpg-encrypted for Pro) under the run-scoped key, and
each test job restores it, decrypts locally into its ephemeral workspace
when a passphrase is present, then converts to the layout it needs. The
cache therefore only ever holds encrypted bytes for Pro images, while
public images are unaffected.

- Drop the redundant `encrypted-artifact` input; Pro is detected solely
  by the presence of `pro-artifact-passphrase`, matching main and the
  rocks-template caller (which never set the input).
- Remove the "Determine artifact type" / "Validate passphrase" steps and
  all `encrypted-artifact == ...` cache gating.
- Delete the now-superseded prepare-rock-for-testing composite action.
- Image.yaml: stop passing `encrypted-artifact` to Test-Rock.
- Update workflow contract tests to assert the unified flow.
@zhijie-yang zhijie-yang changed the title feat: pro rock in ACR (WIP) feat: pro rock in ACR Jul 21, 2026
@zhijie-yang
zhijie-yang marked this pull request as ready for review July 21, 2026 10:32
@zhijie-yang
zhijie-yang requested a review from alesancor1 as a code owner July 21, 2026 10:32
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@canonical canonical deleted a comment from github-actions Bot Jul 21, 2026
@lczyk
lczyk self-requested a review July 22, 2026 12:46
Comment on lines +502 to +510
- name: Encrypt pro artifact
if: ${{ matrix.pro-services != '' }}
uses: ./.github/actions/crypt-artifact
with:
mode: encrypt
input-path: ${{ steps.rename-oci-archive.outputs.name }}
passphrase: ${{ secrets.ROCKS_PRO_ARTIFACT_PASSPHRASE }}
output-path: ${{ steps.rename-oci-archive.outputs.name }}.gpg

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if this can be optimized, we can just rename the downloaded artifact, and choose to keep the encrypted artifact during the decryption.

Comment on lines +92 to +93
is-public-release: ${{ steps.release-type.outputs.is-public-release }}
is-pro-release: ${{ steps.release-type.outputs.is-pro-release }}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider refactoring these two boolean names to contains-x-release to reduce the ambiguity.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisit this to see if we can avoid any changes to this established workflow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem more like a drive-by to me. Afaict they are not really required for any of the workflows to run correctly right? Since the inputs and outputs remain the same.

If so, I'd move this to a separate refactor PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes aren't a drive-by refactor — they're required for Pro support, which is why the inputs/outputs are unchanged (the behavior change is internal to how Pro artifacts are handled).

Previously configure-tests unpacked the rock once and cached the unpacked OCI layout, which every downstream test job restored. For Pro images that would mean the decrypted image content sits in the shared, run-scoped cache — defeating the reason we GPG-encrypt the artifact in the first place.

To keep the property "cache encrypted archives, decrypt only in ephemeral test jobs", the restructuring:

  • caches the raw archive (<name> / <name>.gpg) instead of the unpacked layout, and
  • moves the Decrypt Rock + Unpack Rock steps out of the shared job into each individual test job, so decryption happens only inside the short-lived job that needs it and the plaintext is never persisted to the cache.

Public (non-Pro) images are unaffected: the Decrypt Rock step is gated on ARTIFACT_PASSPHRASE != '', so for them it's a no-op and the unpack behaves as before.

Given that, I'd prefer to keep it in this PR rather than split it, since the Pro test flow doesn't work correctly without it. Happy to revisit if you still see a piece here that's genuinely independent of Pro.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is essentially what I flagged back in: https://github.com/canonical/oci-factory/pull/706/changes#r2623388879 but wasn't ever addressed. Happy to keep it in this PR 👍

@lczyk lczyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed on 1-1, overall approach looks good. a couple of drive-bys but i personally don't mind. i found a small pile of things to look at though:

  • worth failing fast in the matrix on an upload[*] entry with pro: but no release:
  • pro build metadata in Swift records digest: "" (the GHCR push is skipped), so a Pro revision has no content identity anywhere once the artifact expires.
  • pro archives are uploaded with default retention (90 day). retention-days: 1 ??
  • Create Git tag runs for Pro too. just flagging.
  • upload-rock/action.yml still decrypts with a <name>* glob while everything else moved to <name>.gpg.
  • docker is unpinned in tests/etc/requirements.txt while everything else there is pinned.

and inline comments ofc

Comment thread .github/workflows/Image.yaml Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread src/image/merge_release_info.py
Comment thread .github/workflows/Build-Rock.yaml Outdated
Comment thread .github/workflows/Build-Rock.yaml
@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 30531125111 ; Attempt: 1

See logs.

@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 30531314343 ; Attempt: 1

See logs.

@lczyk lczyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1153 (comment) was really my only blocker. everything else is flags / nice-to-have's so +1 from me

lczyk

This comment was marked as resolved.

@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 30533672959 ; Attempt: 1

See logs.

@lczyk lczyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. f2a3f98 is even better. now approve ;)

@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 30543325089 ; Attempt: 1

See logs.

@alesancor1 alesancor1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass

Overall the code looks good, I can see it's quite polished already after a couple iterations with @lczyk (thanks!).

For now, just a couple of nits and a bigger concern, check below:

Comment thread .github/actions/commit-releases-json/action.yaml
Comment thread .github/workflows/_Test-OCI-Factory.yaml Outdated
Comment thread .github/workflows/_Test-OCI-Factory.yaml Outdated
Comment thread .github/workflows/Build-Rock.yaml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem more like a drive-by to me. Afaict they are not really required for any of the workflows to run correctly right? Since the inputs and outputs remain the same.

If so, I'd move this to a separate refactor PR.

@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 32471687513 ; Attempt: 1

See logs.

@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 32473659861 ; Attempt: 1

See logs.

@github-actions

Copy link
Copy Markdown

The Docker repository for this image does not exist yet. Merging of this repo is blocked.
Run ID: 32481618009 ; Attempt: 1

See logs.

@zhijie-yang
zhijie-yang requested a review from alesancor1 August 21, 2026 13:20

@alesancor1 alesancor1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy with the current state of this, thanks!

Is there any chance you could provide a test run before merging?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is essentially what I flagged back in: https://github.com/canonical/oci-factory/pull/706/changes#r2623388879 but wasn't ever addressed. Happy to keep it in this PR 👍

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.

3 participants