Includes  snapcraft.yaml to build [snap](https://snapcraft.io/).

* Updated snap
This commit is contained in:
Michael Royal 2019-07-08 08:48:55 -07:00 committed by Hang Yan
parent ef241ada55
commit 7b6c89b3de

53
pkg/snap/snapcraft.yaml Normal file
View File

@ -0,0 +1,53 @@
name: kompose
summary: Go from Docker Compose to Kubernetes.
description:Kompose is a tool to help users who are familiar with docker-compose move to Kubernetes. kompose takes a Docker Compose file and translates it into Kubernetes resources.
grade: stable
confinement: classic
architectures:
- build-on: i386
- build-on: amd64
- build-on: armhf
- build-on: arm64
apps:
kompose:
command: bin/kompose
plugs:
- home
- network
- docker
- removable-media
parts:
kompose:
plugin: nil
source: https://github.com/kubernetes/kompose.git
source-type: git
override-pull: |
git clone https://github.com/kubernetes/kompose.git src/github.com/kubernetes/kompose
cd src/github.com/kubernetes/kompose
last_committed_tag="$(git describe --tags --abbrev=0)"
last_committed_tag_ver="$(echo ${last_committed_tag} | sed 's/v//')"
last_released_tag="$(snap info $SNAPCRAFT_PROJECT_NAME | awk '$1 == "beta:" { print $2 }')"
# If the latest tag from the upstream project has not been released to
# beta, build that tag instead of master.
if [ "${last_committed_tag_ver}" != "${last_released_tag}" ]; then
git fetch
git checkout "${last_committed_tag}"
fi
snapcraftctl set-version "$(git describe --tags | sed 's/v//')"
override-build: |
export GOPATH=$PWD
cd src/github.com/kubernetes/kompose
env CGO_ENABLED=0 GOOS=linux \
go build --ldflags "-s -w \
-X 'github.com/kubernetes/kompose/version.GitCommit=$(git rev-list -1 HEAD)' \
-X 'github.com/kubernetes/kompose/version.Version=$(git describe --tags --abbrev=0)'" \
-a -installsuffix cgo -o $SNAPCRAFT_PART_INSTALL/bin/kompose
build-snaps:
- go
build-packages:
- git
- sed