Skip to content

Github: Add and replace snap build job - #1470

Open
roosterfish wants to merge 3 commits into
canonical:mainfrom
roosterfish:merge_packaging
Open

Github: Add and replace snap build job#1470
roosterfish wants to merge 3 commits into
canonical:mainfrom
roosterfish:merge_packaging

Conversation

@roosterfish

@roosterfish roosterfish commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Migrates the build job from github.com/canonical/microcloud-pkg-snap. Aligns with the build job from LXD.

To stay in line with LXD, I would propose using the same format for release-* branches even though MicroCloud uses vX-edge scheme for the version branches.

Copilot AI review requested due to automatic review settings July 24, 2026 09:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Migrates the GitHub Actions “snap” job to the newer Launchpad snap build flow (aligned with the approach used by LXD), replacing the previous microcloud-pkg-snap-based triggering.

Changes:

  • Updates the snap job to use canonical/lxd-pkg-snap/.github/actions/lp-snap-build with the MicroCloud Launchpad repo.
  • Adds branch mapping logic (edge vs candidate) and derives snap version/grade from version/version.go and branch naming patterns.
  • Pushes updates to the Launchpad branches, including repository packing/gc before pushing.
Comments suppressed due to low confidence (1)

.github/workflows/tests.yml:379

  • Same issue as above: || true suppresses grep errors (exit 2) as well as "no matches" (exit 1). Count with awk so missing/unreadable files still fail clearly.
            # Fail unless exactly one `grade: devel` line exists, then replace it.
            match_count="$(grep -cxF 'grade: devel' snapcraft.yaml || true)"
            if [ "${match_count}" -ne 1 ]; then

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/tests.yml Outdated
Comment thread .github/workflows/tests.yml
Copilot AI review requested due to automatic review settings July 24, 2026 09:05
Comment thread snap/snapcraft/commands/microcloud Fixed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread snap/snapcraft/commands/microcloud Outdated
Comment thread .github/workflows/tests.yml
Comment thread .github/workflows/tests.yml
Comment thread snap/snapcraft.yaml
Copilot AI review requested due to automatic review settings July 24, 2026 11:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

snap/snapcraft.yaml:99

  • go get ./... during the snap build can update go.mod/go.sum (and potentially upgrade deps), making the snap build non-reproducible. Prefer downloading modules without changing the module graph.
      set -ex

      # Download the dependencies
      go get -v -tags=agent ./...

Comment thread snap/snapcraft.yaml Outdated
Comment thread snap/snapcraft/commands/microcloud
Comment thread snap/snapcraft/commands/daemon.start
Comment thread .github/workflows/tests.yml
Copilot AI review requested due to automatic review settings July 24, 2026 11:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

snap/snapcraft.yaml:97

  • go get ... ./... is not a pure “download deps” step and can update go.mod/go.sum, reducing build reproducibility. Use go mod download to fetch the pinned module graph without modifying module files.
      go get -v -tags=agent ./...

Comment thread snap/snapcraft.yaml
Copilot AI review requested due to automatic review settings July 24, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

snap/snapcraft.yaml:97

  • override-pull uses go get -v -tags=agent ./... to “download dependencies”. In module mode, go get ./... can update go.mod/go.sum and may invoke package loading that triggers CGO processing/build steps, which is fragile this early in the lifecycle (before the build env/CGO flags are set) and can fail on cgo-based deps. Prefer go mod download (or go mod download -x) here to fetch modules without attempting to build/update them.
    override-pull: |
      craftctl default
      set -ex

      # Download the dependencies
      go get -v -tags=agent ./...

Comment thread .github/workflows/tests.yml Outdated
Migrates the build job from github.com/canonical/microcloud-pkg-snap.
Aligns with the build job from LXD.

Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Signed-off-by: Julian Pelizäus <julian.pelizaeus@canonical.com>
Copilot AI review requested due to automatic review settings July 24, 2026 12:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

snap/snapcraft.yaml:97

  • override-pull runs go get ./... to “download dependencies”. go get is intended for changing module requirements and can unexpectedly rewrite go.mod/go.sum during the pull step. Use a non-mutating download step (e.g. go mod download) to populate the module cache instead.
      # Download the dependencies
      go get -v -tags=agent ./...

Comment thread snapcraft/commands/microcloud
Comment thread snap/snapcraft.yaml
@roosterfish
roosterfish marked this pull request as ready for review July 24, 2026 13:44
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