From efbf28acae3253c2b0ced132bf83b790a854b6d2 Mon Sep 17 00:00:00 2001 From: Alexander <42068202+ale8k@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:34:54 +0100 Subject: [PATCH] Fix jimmctl snap (#1044) * Fix jimmctl snap * newlines --- .gitignore | 2 +- Makefile | 7 ++++++- snaps/jimmctl/files/jimmctl.wrapper | 3 --- snaps/jimmctl/local/jimmctl.wrapper | 3 +++ snaps/jimmctl/snapcraft.yaml | 18 +++++++++++++----- 5 files changed, 23 insertions(+), 10 deletions(-) delete mode 100755 snaps/jimmctl/files/jimmctl.wrapper create mode 100755 snaps/jimmctl/local/jimmctl.wrapper diff --git a/.gitignore b/.gitignore index 05141fd65..f82370a92 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ /access.log /parts/ /prime/ -/snap/.snapcraft/ +/snap/ /stage/ /vendor /version/commit.txt diff --git a/Makefile b/Makefile index 52e0460e1..949fbadd3 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,12 @@ jimm-image: jimm-snap: mkdir -p ./snap cp ./snaps/jimm/snapcraft.yaml ./snap/ - snapcraft + snapcraft + +jimmctl-snap: + mkdir -p ./snap + cp -R ./snaps/jimmctl/* ./snap/ + snapcraft push-microk8s: jimm-image docker tag jimm:latest localhost:32000/jimm:latest diff --git a/snaps/jimmctl/files/jimmctl.wrapper b/snaps/jimmctl/files/jimmctl.wrapper deleted file mode 100755 index c8341287c..000000000 --- a/snaps/jimmctl/files/jimmctl.wrapper +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -JUJU_DATA=$SNAP_REAL_HOME/.local/share/juju $SNAP/bin/jimmctl "$@" diff --git a/snaps/jimmctl/local/jimmctl.wrapper b/snaps/jimmctl/local/jimmctl.wrapper new file mode 100755 index 000000000..88c915b5e --- /dev/null +++ b/snaps/jimmctl/local/jimmctl.wrapper @@ -0,0 +1,3 @@ +#!/bin/sh + +JUJU_DATA=$SNAP_REAL_HOME/.local/share/juju "$SNAP"/bin/jimmctl "$@" diff --git a/snaps/jimmctl/snapcraft.yaml b/snaps/jimmctl/snapcraft.yaml index 79d9e57ec..35ead1ea7 100644 --- a/snaps/jimmctl/snapcraft.yaml +++ b/snaps/jimmctl/snapcraft.yaml @@ -1,16 +1,26 @@ name: jimmctl -version: git summary: JAAS client description: Client for controlling JAAS multi-cloud juju controllers. +version: git grade: stable base: core20 confinement: strict plugs: + # We use personal-files instead of the home interface + # as the home interface does not permit access to hidden files/directories. + # See: https://askubuntu.com/questions/1238211/how-to-make-snaps-access-hidden-files-and-folders-in-home + # And: https://snapcraft.io/docs/personal-files-interface + # + # The personal-files interface is also a none auto-connect, and must + # typically be connected via: snap connect jimmctl:dot-local-share-juju + # + # In our scenario, we are going to request auto-connect. dot-local-share-juju: interface: personal-files read: - $HOME/.local/share/juju + - $HOME/.local/share/juju/cookies apps: jimmctl: @@ -19,7 +29,6 @@ apps: - dot-local-share-juju - network - parts: jimmctl: plugin: go @@ -30,11 +39,10 @@ parts: override-build: | set -e go install -mod readonly -ldflags '-linkmode=external' github.com/canonical/jimm/cmd/jimmctl - - files: + wrapper: plugin: dump - source: snaps/jimmctl/files/ + source: snaps/jimmctl/local/ source-type: local organize: jimmctl.wrapper: bin/wrappers/jimmctl