From 710581418d25a5beaeb7ab85cef3bd9975028c4c Mon Sep 17 00:00:00 2001 From: Massimiliano Date: Thu, 26 Oct 2023 15:34:56 +0200 Subject: [PATCH] Split arch for runtime snap build and dump build repo (infra) (#796) * Split arch and name action as the build repo * Move the information in step (invalid yaml else) and documentation * Remove note, invalid syntax * Added envvar for build id and merged frontend buids Minor: Spaces, nomenclature, moved comments Minor: bumped retries for build and upload Minor: clarified comment --- .../checkbox-core-snap-daily-builds.yml | 23 +++++++++++++------ .../workflows/checkbox-snap-daily-builds.yml | 23 +++++++++++++------ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/checkbox-core-snap-daily-builds.yml b/.github/workflows/checkbox-core-snap-daily-builds.yml index d51452e2d..57c395710 100644 --- a/.github/workflows/checkbox-core-snap-daily-builds.yml +++ b/.github/workflows/checkbox-core-snap-daily-builds.yml @@ -30,13 +30,17 @@ jobs: strategy: matrix: releases: [16, 18, 20, 22] + arch: [amd64, arm64, armhf] needs: check_history if: ${{ needs.check_history.outputs.should_run != 'false' }} || github.event_name == 'workflow_dispatch' runs-on: [self-hosted, linux, large] env: SERIES: series${{ matrix.releases }} SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }} - name: Checkbox Core snap for series ${{ matrix.releases }} + # snapcraft remote-build will create a repository with the name decided by the --build-id arg + # URL to this repo echoed below to help debug builds (does not change if the workflow is re-run) + SNAPCRAFT_BUILDER_ID: checkbox${{ matrix.releases }}-${{ matrix.arch }}-${{ github.run_id }} + name: Runtime (Core) ${{ matrix.releases }}-${{ matrix.arch }} steps: - uses: actions/checkout@v3 with: @@ -46,23 +50,27 @@ jobs: cd checkbox-core-snap/ sudo apt update && sudo apt install -qq -y python3-setuptools-scm ./prepare.sh $SERIES - - name: add LP credentials + - name: Add LP credentials run: | mkdir -p ~/.local/share/snapcraft/provider/launchpad/ echo '${{ secrets.LP_CREDS }}' > ~/.local/share/snapcraft/provider/launchpad/credentials git config --global user.email "robot@lists.canonical.com" git config --global user.name "Certification bot" + - name: Print Launchpad build repository + run: | + echo "Building at: https://git.launchpad.net/~ce-certification-qa/+git/$SNAPCRAFT_BUILDER_ID" - uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 + name: Build the snap with: action: Hook25/action-build@707dce252c4f367b6c1afe61ed577f7413cf7912 - id: snapcraft attempt_delay: 600000 # 10min - attempt_limit: 3 + attempt_limit: 5 with: | path: checkbox-core-snap/series${{ matrix.releases }} snapcraft-channel: 7.x/stable - snapcraft-args: remote-build --build-on amd64,arm64,armhf --launchpad-accept-public-upload + snapcraft-args: remote-build --build-for ${{ matrix.arch }} --launchpad-accept-public-upload --build-id $SNAPCRAFT_BUILDER_ID - uses: actions/upload-artifact@v3 + name: Upload logs on failure if: failure() with: name: snapcraft-log-series${{ matrix.releases }} @@ -71,14 +79,15 @@ jobs: /home/runner/.local/state/snapcraft/log/ checkbox-core-snap/series${{ matrix.releases }}/checkbox*.txt - uses: actions/upload-artifact@v3 + name: Upload the snap as artifact with: name: series${{ matrix.releases }} path: checkbox-core-snap/series${{ matrix.releases }}/*.snap - uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 - name: Upload checkbox core snaps to the store + name: Upload the snap to the store with: attempt_delay: 600000 # 10min - attempt_limit: 3 + attempt_limit: 10 command: | for snap in checkbox-core-snap/series${{ matrix.releases }}/*.snap ; \ do \ diff --git a/.github/workflows/checkbox-snap-daily-builds.yml b/.github/workflows/checkbox-snap-daily-builds.yml index 5cfd5c4c1..231722ad0 100644 --- a/.github/workflows/checkbox-snap-daily-builds.yml +++ b/.github/workflows/checkbox-snap-daily-builds.yml @@ -37,7 +37,11 @@ jobs: env: SERIES: series_${{ matrix.type }}${{ matrix.releases }} SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }} - name: Checkbox snap for series ${{ matrix.type }}${{ matrix.releases }} + # snapcraft remote-build will create a repository with the name decided by the --build-id arg + # URL to this repo echoed below to help debug builds (does not change if the workflow is re-run) + # as the run_id will not change + SNAPCRAFT_BUILDER_ID: checkbox-${{ matrix.type }}${{ matrix.releases }}-${{ github.run_id }} + name: Frontend ${{ matrix.type }}${{ matrix.releases }} steps: - uses: actions/checkout@v3 with: @@ -47,23 +51,27 @@ jobs: cd checkbox-snap/ sudo apt update && sudo apt install -qq -y python3-setuptools-scm ./prepare_${{ matrix.type }}.sh $SERIES - - name: add LP credentials + - name: Add LP credentials run: | mkdir -p ~/.local/share/snapcraft/provider/launchpad/ echo '${{ secrets.LP_CREDS }}' > ~/.local/share/snapcraft/provider/launchpad/credentials git config --global user.email "robot@lists.canonical.com" git config --global user.name "Certification bot" + - name: Print Launchpad build repository + run: | + echo "Building at: https://git.launchpad.net/~ce-certification-qa/+git/$SNAPCRAFT_BUILDER_ID" - uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 + name: Building the snaps with: action: Hook25/action-build@707dce252c4f367b6c1afe61ed577f7413cf7912 - id: snapcraft attempt_delay: 600000 # 10min - attempt_limit: 3 + attempt_limit: 5 with: | path: checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }} snapcraft-channel: 7.x/stable - snapcraft-args: remote-build --build-on amd64,arm64,armhf --launchpad-accept-public-upload + snapcraft-args: remote-build --build-for amd64,arm64,armhf --launchpad-accept-public-upload --build-id $SNAPCRAFT_BUILDER_ID - uses: actions/upload-artifact@v3 + name: Upload logs on failure if: failure() with: name: snapcraft-log-series-${{ matrix.type }}${{ matrix.releases }} @@ -72,14 +80,15 @@ jobs: /home/runner/.local/state/snapcraft/log/ checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}/checkbox*.txt - uses: actions/upload-artifact@v3 + name: Upload the snaps as artefacts with: name: series_${{ matrix.type }}${{ matrix.releases }} path: checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}/*.snap - uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 - name: Upload checkbox snaps to the store + name: Upload the snaps to the store with: attempt_delay: 600000 # 10min - attempt_limit: 3 + attempt_limit: 10 command: | for snap in checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}/*.snap ; \ do \