Merge pull request #16661 from SimonRichardson/bootstrap-agent-tools #2640
This file contains 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
name: "Snapcraft" | |
on: | |
push: | |
branches: [2.9, 3.1, 3.2, 3.3, main] | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths: | |
- '**.go' | |
- 'go.mod' | |
- 'snap/**' | |
- '.github/workflows/snap.yml' | |
- 'scripts/dqlite/**' | |
- 'Makefile' | |
- 'make_functions.sh' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
snap: | |
name: linux-arm64 | |
runs-on: [self-hosted, linux, arm64, aws, large] | |
if: github.event.pull_request.draft == false | |
steps: | |
- name: Install Dependencies | |
shell: bash | |
run: | | |
set -euxo pipefail | |
sudo snap install snapcraft --classic | |
echo "/snap/bin" >> $GITHUB_PATH | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup LXD | |
uses: canonical/setup-lxd@4e959f8e0d9c5feb27d44c5e4d9a330a782edee0 | |
- name: Set up Go | |
if: env.RUN_TEST == 'RUN' | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Build snap | |
shell: bash | |
run: | | |
set -euxo pipefail | |
snapcraft --use-lxd | |
- name: Install snap | |
shell: bash | |
run: | | |
set -euxo pipefail | |
sudo snap install *.snap --dangerous | |
# Since we're installing dangerously, we need to | |
# manually grant permissions to juju | |
sudo snap connect juju:lxd lxd | |
sudo snap connect juju:config-lxd | |
sudo snap connect juju:dot-local-share-juju | |
sudo snap connect juju:ssh-keys | |
snap connections juju | |
- name: Test bootstrap | |
shell: bash | |
run: | | |
set -euxo pipefail | |
mkdir -p ~/.ssh | |
juju bootstrap localhost --debug |