-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test(conformance): smoke Snap artifacts in Ubuntu VM #2869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f95c2e0
test(test-guest): add Snap installation provisioning
elezar bced363
refactor(ci): extract single-architecture Snap build workflow
elezar d8405b4
test(conformance): verify Snap status in Ubuntu VM
elezar 44549bd
ci(conformance): build ARM Snap artifacts
elezar 2332636
fix(snap): defer gateway start until Docker connects
elezar e6da9b7
test(test-guest): add Snap JWT bootstrap workaround
elezar c987d1c
test(conformance): smoke-test Snap artifacts in Ubuntu VM
elezar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: Build Snap | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| checkout-ref: | ||
| required: true | ||
| type: string | ||
| arch: | ||
| description: "Snap package architecture" | ||
| required: true | ||
| type: string | ||
| runner: | ||
| description: "GitHub Actions runner label" | ||
| required: true | ||
| type: string | ||
| cli-artifact-name: | ||
| required: true | ||
| type: string | ||
| gateway-artifact-name: | ||
| required: true | ||
| type: string | ||
| supervisor-artifact-name: | ||
| required: true | ||
| type: string | ||
| upload-channel: | ||
| required: false | ||
| type: string | ||
| default: "" | ||
| description: "Snap Store channel to upload to; leave empty to skip upload" | ||
|
|
||
| secrets: | ||
| publish-credentials: | ||
| required: false | ||
| description: "Snap Store credentials (SNAPCRAFT_STORE_CREDENTIALS)" | ||
| permissions: | ||
| contents: read | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| build-snap: | ||
| name: Build Snap (Linux ${{ inputs.arch }}) | ||
| runs-on: ${{ inputs.runner }} | ||
| timeout-minutes: 60 | ||
| environment: ${{ inputs.upload-channel != '' && inputs.upload-channel || '' }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ inputs.checkout-ref }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install snapd | ||
| run: | | ||
| set -euo pipefail | ||
| if ! command -v snapd >/dev/null 2>&1; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y snapd | ||
| fi | ||
| sudo systemctl enable --now snapd.socket | ||
| sudo systemctl start snapd | ||
| sudo snap wait system seed.loaded | ||
|
|
||
| - name: Install LXD | ||
| run: | | ||
| set -euo pipefail | ||
| sudo snap install lxd | ||
| sudo usermod -aG lxd "$USER" | ||
| sudo lxd waitready | ||
| sudo lxd init --auto | ||
| sudo iptables -P FORWARD ACCEPT | ||
| sudo chgrp lxd /var/snap/lxd/common/lxd/unix.socket | ||
| sudo chmod 660 /var/snap/lxd/common/lxd/unix.socket | ||
|
|
||
| - name: Install snapcraft | ||
| run: sudo snap install snapcraft --classic | ||
|
|
||
| - name: Download prebuilt CLI binary | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: ${{ inputs.cli-artifact-name }} | ||
| path: prebuilt/cli | ||
|
|
||
| - name: Download prebuilt gateway binary | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: ${{ inputs.gateway-artifact-name }} | ||
| path: prebuilt/gateway | ||
|
|
||
| - name: Download prebuilt sandbox binary | ||
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| name: ${{ inputs.supervisor-artifact-name }} | ||
| path: prebuilt/sandbox | ||
|
|
||
| - name: Prepare snap build directory | ||
| run: | | ||
| set -euo pipefail | ||
| find_binary() { | ||
| find "$1" -type f -name "$2" -print -quit | ||
| } | ||
| cli="$(find_binary prebuilt/cli openshell)" | ||
| gateway="$(find_binary prebuilt/gateway openshell-gateway)" | ||
| sandbox="$(find_binary prebuilt/sandbox openshell-sandbox)" | ||
| test -n "$cli" && test -n "$gateway" && test -n "$sandbox" | ||
|
|
||
| mkdir -p snap/prebuilt/meta/gui | ||
| install -m 0755 "$cli" snap/prebuilt/openshell | ||
| install -m 0755 "$gateway" snap/prebuilt/openshell-gateway | ||
| install -m 0755 "$sandbox" snap/prebuilt/openshell-sandbox | ||
| install -m 0755 tasks/scripts/snap-gateway-wrapper.sh snap/prebuilt/openshell-gateway-wrapper | ||
| cp LICENSE README.md snap/prebuilt/ | ||
| cp snap/local/term.desktop snap/prebuilt/meta/gui/term.desktop | ||
| cp snap/local/icon.png snap/prebuilt/meta/gui/icon.png | ||
| python3 tasks/scripts/release.py get-version --snap > snap/prebuilt/version | ||
|
|
||
| - name: Build snap | ||
| run: | | ||
| set -euo pipefail | ||
| runtime_dir="/run/user/$(id -u)" | ||
| sudo install -d -m 0700 -o "$(id -u)" -g "$(id -g)" "$runtime_dir" | ||
| export XDG_RUNTIME_DIR="$runtime_dir" | ||
| sg lxd -c "XDG_RUNTIME_DIR=${runtime_dir} snapcraft pack -v" | ||
|
|
||
| - name: Upload snapcraft logs on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: snapcraft-logs-${{ inputs.arch }} | ||
| path: "~/.local/state/snapcraft/log/snapcraft-*.log" | ||
| retention-days: 7 | ||
|
|
||
| - name: Capture Snap filename | ||
| id: capture | ||
| run: | | ||
| set -euo pipefail | ||
| snap_file=$(find . -maxdepth 1 -type f -name '*.snap' -printf '%f\n' | head -1) | ||
| if [ -z "$snap_file" ]; then | ||
| echo "::error::No .snap file found after snapcraft pack" | ||
| exit 1 | ||
| fi | ||
| echo "snap-file=$snap_file" >> "$GITHUB_OUTPUT" | ||
| echo "Built Snap: $snap_file" | ||
|
|
||
| - name: Upload snap artifact (${{ inputs.arch }}) | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: snap-linux-${{ inputs.arch }} | ||
| path: | | ||
| ${{ steps.capture.outputs.snap-file }} | ||
| *.comp | ||
| retention-days: 5 | ||
|
|
||
| - name: Upload Snap to Snap Store | ||
| if: inputs.upload-channel != '' | ||
| env: | ||
| SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.publish-credentials }} | ||
| INPUTS_UPLOAD_CHANNEL: ${{ inputs.upload-channel }} | ||
| run: | | ||
| set -euo pipefail | ||
| snap_file="${{ steps.capture.outputs.snap-file }}" | ||
| snap_name="${snap_file%.snap}" | ||
| snap_name="${snap_name%%_*}" | ||
|
|
||
| component_args=() | ||
| shopt -s nullglob | ||
| for component in "${snap_name}"+*.comp; do | ||
| echo "Adding component: $component" | ||
| component_args+=(--component "$component") | ||
| done | ||
|
|
||
| echo "Uploading $snap_file to ${INPUTS_UPLOAD_CHANNEL}" | ||
| snapcraft upload --release "${INPUTS_UPLOAD_CHANNEL}" "$snap_file" "${component_args[@]}" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the relationship between this job and the
build-snap:job insnap-ackage.yml? Seems both do many of the same thingsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a rebase hiccup. The intent was to split this in a similar way as what we do for RPM packages. The one is a callable unit that can be called from various points with different parameters (e.g. architecture).