diff --git a/.gitignore b/.gitignore index f0927ceda..a91f62054 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,13 @@ _testmain.go .ackrc .envrc +### Package builds (e.g. snap of fluxctl) +fluxctl_*_*.snap +parts +prime +stage + + # Specific to this project vendor/* !vendor/manifest diff --git a/snap/local/fluxctl-launch b/snap/local/fluxctl-launch new file mode 100755 index 000000000..e541bb652 --- /dev/null +++ b/snap/local/fluxctl-launch @@ -0,0 +1,3 @@ +#!/bin/sh +real_home=$(getent passwd "$(id -u)" | cut -d ':' -f 6) +HOME=$real_home fluxctl.real "$@" diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 000000000..4923289bd --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,59 @@ +name: fluxctl +version-script: | + FLUX_TAG="$(git tag -l | egrep -v '^(chart-|helm-|master-|pre-split)' | sort --version-sort | tail -n1)" + if [ "$SNAPCRAFT_PROJECT_GRADE" = "stable" ] + then + echo "$FLUX_TAG" + else + GIT_REV="$(git rev-parse --short HEAD)" + echo "$FLUX_TAG+$GIT_REV" + fi +version: git +summary: fluxctl talks to Weave Flux and helps you deploy your code +description: | + fluxctl talks to your Weave Flux instance and exposes all its + functionality to an easy to use command line interface. +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: strict +base: core18 + +parts: + launcher: + source: snap/local + source-type: local + plugin: dump + organize: + '*': bin/ + override-stage: | + cd $SNAPCRAFT_PART_INSTALL + chmod +x bin/fluxctl-launch + snapcraftctl stage + fluxctl: + source: . + plugin: go + go-importpath: github.com/weaveworks/flux + build-packages: + - gcc + stage: + - -bin/fluxd + - -bin/helm-operator + organize: + bin/fluxctl: bin/fluxctl.real + after: [launcher] + +plugs: + kube-config: + interface: personal-files + read: + - $HOME/.kube/config + - $HOME/.minikube/client.key + - $HOME/.minikube/client.crt + - $HOME/.minikube/ca.crt + +apps: + fluxctl: + command: bin/fluxctl-launch + plugs: + - kube-config + - network + - network-bind