From a42ee83a18dc854bfa002720ba52647d3ebcfd43 Mon Sep 17 00:00:00 2001 From: Gabriel Cocenza Date: Wed, 11 Sep 2024 11:43:50 -0300 Subject: [PATCH 1/2] Fix build (#11) * Fix build Create an override-pull to configure apt sources to ensure that at stage the dcgm-exporter can stage the datacenter-gpu-manager. Closes: #9 --- snap/snapcraft.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0925c5d..2cf0380 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -46,21 +46,19 @@ apps: parts: wrapper: plugin: dump - source: snap/local - override-build: | - craftctl default - chmod +x run_nv_hostengine.sh - configure-sources: - plugin: dump - source: snap/local build-packages: - wget - dpkg - override-build: | + source: snap/local + override-pull: | + craftctl default ./configure_sources.sh + override-build: | + craftctl default + chmod +x run_nv_hostengine.sh dcgm-exporter: after: - - configure-sources + - wrapper plugin: go stage-packages: [datacenter-gpu-manager=1:3.3.7] build-snaps: From fba655b8bc31990c2de35877ddb4ed21dd68723c Mon Sep 17 00:00:00 2001 From: "soleng-terraform[bot]" <168111096+soleng-terraform[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 08:13:12 -0700 Subject: [PATCH 2/2] Update centrally managed files (#14) Co-authored-by: soleng-terraform[bot] <168111096+soleng-terraform[bot]@users.noreply.github.com> Co-authored-by: Gabriel Cocenza --- .github/CODEOWNERS | 6 +++++ .github/workflows/check.yaml | 47 +++++++++++++++++++++++++++++++++ .github/workflows/promote.yaml | 48 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 39 +++++++++++++++++++++++++++ .yamllint | 5 ++++ 5 files changed, 145 insertions(+) create mode 100644 .github/workflows/check.yaml create mode 100644 .github/workflows/promote.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .yamllint diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 314305d..153ed37 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,9 @@ +# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation +# To update the file: +# - Edit it in the canonical/solutions-engineering-automation repository. +# - Open a PR with the changes. +# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. +# # These owners will be the default owners for everything in the repo. Unless a # later match takes precedence, @canonical/soleng-reviewers will be requested for # review when someone opens a pull request. diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..5bc07fd --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,47 @@ +# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation +# To update the file: +# - Edit it in the canonical/solutions-engineering-automation repository. +# - Open a PR with the changes. +# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. +name: Tests + +on: + workflow_call: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened] + branches: [main] + paths-ignore: + - "**.md" + - "**.rst" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Complete git history is required to generate the version from git tags. + + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y yamllint + + - name: Lint yaml files + run: | + yamllint .yamllint snap/snapcraft.yaml + + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Complete git history is required to generate the version from git tags. + + - name: Verify snap builds successfully + uses: snapcore/action-build@v1 diff --git a/.github/workflows/promote.yaml b/.github/workflows/promote.yaml new file mode 100644 index 0000000..b4c1304 --- /dev/null +++ b/.github/workflows/promote.yaml @@ -0,0 +1,48 @@ +# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation +# To update the file: +# - Edit it in the canonical/solutions-engineering-automation repository. +# - Open a PR with the changes. +# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. +name: Promote snap to default track, standard risk levels. + +on: + workflow_dispatch: + inputs: + channel-promotion: + description: 'Channel Promotion, e.g. latest/edge -> latest/candidate' + required: true + type: choice + options: + - 'latest/edge -> latest/candidate' + - 'latest/candidate -> latest/stable' + +jobs: + promote-snap: + name: Promote snap + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Snapcraft install + run: sudo snap install --classic snapcraft + - name: Get snap name + id: snap + run: echo "name=$(awk '/^name:/ {print $2}' snap/snapcraft.yaml)" >> "$GITHUB_OUTPUT" + - name: Set channels + id: set-channels + run: | + channel_promotion="${{ github.event.inputs.channel-promotion }}" + origin=$(echo "$channel_promotion" | sed 's/\s*->.*//') + destination=$(echo "$channel_promotion" | sed 's/.*->\s*//') + echo "destination-channel=$destination" >> $GITHUB_OUTPUT + echo "origin-channel=$origin" >> $GITHUB_OUTPUT + - name: Snapcraft promote snap + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + SNAPCRAFT_HAS_TTY: "true" # this is necessary because snapcraft will not allow --yes for promotions of the edge channel https://github.com/canonical/snapcraft/issues/4439 + run: | + # Note: using `yes |` instead of `--yes` because snapcraft will + # refuse to non-interactively promote a snap from the edge + # channel if it is done without any branch qualifiers + yes | snapcraft promote ${{ steps.snap.outputs.name }} \ + --from-channel ${{ steps.set-channels.outputs.origin-channel }} \ + --to-channel ${{ steps.set-channels.outputs.destination-channel }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ae3a2d8 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +# This file is centrally managed as a template file in https://github.com/canonical/solutions-engineering-automation +# To update the file: +# - Edit it in the canonical/solutions-engineering-automation repository. +# - Open a PR with the changes. +# - When the PR merges, the soleng-terraform bot will open a PR to the target repositories with the changes. +name: Publish snap + +on: + push: + branches: [ main ] + release: + types: [ published ] + +jobs: + check: + uses: ./.github/workflows/check.yaml + secrets: inherit + + release: + runs-on: ubuntu-22.04 + needs: check + outputs: + snap: ${{ steps.build.outputs.snap }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Complete git history is required to generate the version from git tags. + - uses: snapcore/action-build@v1 + id: build + - uses: actions/upload-artifact@v4 + with: + name: snap + path: ${{ steps.build.outputs.snap }} + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + with: + snap: ${{ steps.build.outputs.snap }} + release: latest/edge diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..669c864 --- /dev/null +++ b/.yamllint @@ -0,0 +1,5 @@ +extends: default + +rules: + line-length: disable + document-start: disable