cadvisor/deploy/snap/snapcraft.yaml
Michael Royal cc445b9cc7 Moving snap folder into deploy (#2246)
* snap package

includes snapcraft.yaml to build snap.
2019-05-24 13:12:27 -07:00

56 lines
1.7 KiB
YAML

name: cadvisor
summary: Container Advisor.
description:| Analyzes resource usage and performance characteristics of running containers.
adopt-info: cadvisor
grade: stable
confinement: classic
architectures:
- build-on: i386
- build-on: amd64
- build-on: armhf
- build-on: arm64
apps:
cadvisor:
command: bin/cadvisor
plugs:
- home
- network
- docker
- removable-media
parts:
cadvisor:
plugin: nil
source: https://github.com/google/cadvisor.git
source-type: git
override-pull: |
git clone https://github.com/google/cadvisor.git src/github.com/google/cadvisor
cd src/github.com/google/cadvisor
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/google/cadvisor
env CGO_ENABLED=0 GOOS=linux \
go build --ldflags "-s -w \
-X 'github.com/google/cadvisor/version.GitCommit=$(git rev-list -1 HEAD)' \
-X 'github.com/google/cadvisor/version.Version=$(git describe --tags --abbrev=0)'" \
-a -installsuffix cgo -o $SNAPCRAFT_PART_INSTALL/bin/cadvisor
build-snaps:
- go
build-packages:
- git
- sed