From f798cbd9f9cccfd1f93627e0f8c7da7033fd5862 Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Thu, 29 May 2025 17:50:03 +0200 Subject: [PATCH] Update Talos Linux v1.10.3 Signed-off-by: Andrei Kvapil --- .github/workflows/pull-requests-release.yaml | 31 ++++++++++++- .github/workflows/pull-requests.yaml | 15 ++++--- Makefile | 2 +- hack/e2e-cluster.bats | 32 +++++++------ packages/core/installer/hack/gen-profiles.sh | 45 +++++++++++++------ .../images/talos/profiles/initramfs.yaml | 18 ++++---- .../images/talos/profiles/installer.yaml | 18 ++++---- .../installer/images/talos/profiles/iso.yaml | 18 ++++---- .../images/talos/profiles/kernel.yaml | 18 ++++---- .../images/talos/profiles/metal.yaml | 18 ++++---- .../images/talos/profiles/nocloud.yaml | 18 ++++---- packages/core/testing/Makefile | 3 +- 12 files changed, 139 insertions(+), 97 deletions(-) diff --git a/.github/workflows/pull-requests-release.yaml b/.github/workflows/pull-requests-release.yaml index 070877db..e039a109 100644 --- a/.github/workflows/pull-requests-release.yaml +++ b/.github/workflows/pull-requests-release.yaml @@ -16,7 +16,6 @@ jobs: contents: read packages: write - # Run only when the PR carries the "release" label and not closed. if: | contains(github.event.pull_request.labels.*.name, 'release') && github.event.action != 'closed' @@ -35,8 +34,36 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io + - name: Extract tag from PR branch + id: get_tag + uses: actions/github-script@v7 + with: + script: | + const branch = context.payload.pull_request.head.ref; + const m = branch.match(/^release-(\d+\.\d+\.\d+(?:[-\w\.]+)?)$/); + if (!m) { + core.setFailed(`❌ Branch '${branch}' does not match 'release-X.Y.Z[-suffix]'`); + return; + } + const tag = `v${m[1]}`; + core.setOutput('tag', tag); + + - name: Download required release assets + run: | + mkdir -p _out/assets + gh release download ${{ steps.get_tag.outputs.tag }} \ + --repo ${{ github.repository }} \ + --dir _out/assets \ + --pattern cozystack-installer.yaml \ + --pattern nocloud-amd64.raw.xz + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: List downloaded files + run: ls -lh _out/assets/ + - name: Run tests - run: make manifests && make test + run: make test finalize: name: Finalize Release diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index b6b0cfc0..826d1b4e 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -37,11 +37,16 @@ jobs: - name: Build run: make build - - name: Upload installer artifact + - name: Build Talos image + run: make -C packages/core/installer talos-nocloud + + - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: cozystack-installer - path: _out/assets/cozystack-installer.yaml + name: cozystack-artefacts + path: | + _out/assets/nocloud-amd64.raw.xz + _out/assets/cozystack-installer.yaml test: name: Test @@ -59,10 +64,10 @@ jobs: fetch-depth: 0 fetch-tags: true - - name: Download installer artifact + - name: Download artifacts uses: actions/download-artifact@v4 with: - name: cozystack-installer + name: cozystack-artefacts path: _out/assets/ - name: Test diff --git a/Makefile b/Makefile index 63f61458..e9263669 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ manifests: (cd packages/core/installer/; helm template -n cozy-installer installer .) > _out/assets/cozystack-installer.yaml assets: - make -C packages/core/installer/ assets + make -C packages/core/installer assets test: make -C packages/core/testing apply diff --git a/hack/e2e-cluster.bats b/hack/e2e-cluster.bats index 39e2aff4..aadc1081 100755 --- a/hack/e2e-cluster.bats +++ b/hack/e2e-cluster.bats @@ -3,12 +3,14 @@ # Cozystack end‑to‑end provisioning test (Bats) # ----------------------------------------------------------------------------- -@test "Environment variable COZYSTACK_INSTALLER_YAML is defined" { - if [ -z "${COZYSTACK_INSTALLER_YAML:-}" ]; then - echo 'COZYSTACK_INSTALLER_YAML environment variable is not set!' >&2 - echo >&2 - echo 'Please export it with the following command:' >&2 - echo ' export COZYSTACK_INSTALLER_YAML=$(helm template -n cozy-system installer packages/core/installer)' >&2 +@test "Required installer assets exist" { + if [ ! -f _out/assets/cozystack-installer.yaml ]; then + echo "Missing: _out/assets/cozystack-installer.yaml" >&2 + exit 1 + fi + + if [ ! -f _out/assets/nocloud-amd64.raw.xz ]; then + echo "Missing: _out/assets/nocloud-amd64.raw.xz" >&2 exit 1 fi } @@ -70,13 +72,15 @@ EOF done } -@test "Download Talos NoCloud image" { - if [ ! -f nocloud-amd64.raw ]; then - wget https://github.com/cozystack/cozystack/releases/latest/download/nocloud-amd64.raw.xz \ - -O nocloud-amd64.raw.xz --show-progress --output-file /dev/stdout --progress=dot:giga 2>/dev/null - rm -f nocloud-amd64.raw - xz --decompress nocloud-amd64.raw.xz +@test "Use Talos NoCloud image from assets" { + if [ ! -f _out/assets/nocloud-amd64.raw.xz ]; then + echo "Missing _out/assets/nocloud-amd64.raw.xz" 2>&1 + exit 1 fi + + rm -f nocloud-amd64.raw + cp _out/assets/nocloud-amd64.raw.xz . + xz --decompress nocloud-amd64.raw.xz } @test "Prepare VM disks" { @@ -243,8 +247,8 @@ EOF --from-literal=api-server-endpoint=https://192.168.123.10:6443 \ --dry-run=client -o yaml | kubectl apply -f - - # Apply installer manifests from env variable - echo "$COZYSTACK_INSTALLER_YAML" | kubectl apply -f - + # Apply installer manifests from file + kubectl apply -f _out/assets/cozystack-installer.yaml # Wait for the installer deployment to become available kubectl wait deployment/cozystack -n cozy-system --timeout=1m --for=condition=Available diff --git a/packages/core/installer/hack/gen-profiles.sh b/packages/core/installer/hack/gen-profiles.sh index 64880fb3..5225ace6 100755 --- a/packages/core/installer/hack/gen-profiles.sh +++ b/packages/core/installer/hack/gen-profiles.sh @@ -32,17 +32,36 @@ done for profile in $PROFILES; do echo "writing profile images/talos/profiles/$profile.yaml" - if [ "$profile" = "nocloud" ] || [ "$profile" = "metal" ]; then - image_options="{ diskSize: 1306525696, diskFormat: raw }" - out_format=".xz" - platform="$profile" - kind="image" - else - image_options="{}" - out_format="raw" - platform="metal" - kind="$profile" - fi + case "$profile" in + initramfs|kernel|iso) + image_options="{}" + out_format="raw" + platform="metal" + kind="$profile" + ;; + installer) + image_options="{}" + out_format="raw" + platform="metal" + kind="installer" + ;; + metal) + image_options="{ diskSize: 1306525696, diskFormat: raw }" + out_format=".xz" + platform="metal" + kind="image" + ;; + nocloud) + image_options="{ diskSize: 1306525696, diskFormat: raw }" + out_format=".xz" + platform="nocloud" + kind="image" + ;; + *) + echo "Unknown profile: $profile" >&2 + exit 1 + ;; + esac cat > images/talos/profiles/$profile.yaml <