github.com/google/cadvisor@v0.49.1/deploy/snap/snapcraft.yaml (about)

     1  name: cadvisor
     2  summary:  Container Advisor.
     3  description:| Analyzes resource usage and performance characteristics of running containers.
     4    
     5  adopt-info: cadvisor
     6  
     7  grade: stable
     8  confinement: classic
     9  
    10  architectures:
    11    - build-on: i386
    12    - build-on: amd64
    13    - build-on: armhf
    14    - build-on: arm64
    15  
    16  apps:
    17    cadvisor:
    18      command: bin/cadvisor
    19      plugs:
    20        - home
    21        - network
    22        - docker
    23        - removable-media
    24  
    25  parts:
    26    cadvisor:
    27    plugin: nil 
    28      source: https://github.com/google/cadvisor.git
    29      source-type: git
    30      override-pull: |
    31        git clone https://github.com/google/cadvisor.git src/github.com/google/cadvisor
    32         cd src/github.com/google/cadvisor
    33        last_committed_tag="$(git describe --tags --abbrev=0)"
    34        last_committed_tag_ver="$(echo ${last_committed_tag} | sed 's/v//')"
    35        last_released_tag="$(snap info $SNAPCRAFT_PROJECT_NAME | awk '$1 == "beta:" { print $2 }')"
    36        # If the latest tag from the upstream project has not been released to
    37        # beta, build that tag instead of master.
    38        if [ "${last_committed_tag_ver}" != "${last_released_tag}" ]; then
    39          git fetch
    40          git checkout "${last_committed_tag}"
    41        fi
    42        snapcraftctl set-version "$(git describe --tags | sed 's/v//')"
    43        override-build: |
    44        export GOPATH=$PWD
    45        cd src/github.com/google/cadvisor
    46        env CGO_ENABLED=0 GOOS=linux \
    47        go build --ldflags "-s -w \
    48          -X 'github.com/google/cadvisor/version.GitCommit=$(git rev-list -1 HEAD)' \
    49          -X 'github.com/google/cadvisor/version.Version=$(git describe --tags --abbrev=0)'" \
    50          -a -installsuffix cgo -o $SNAPCRAFT_PART_INSTALL/bin/cadvisor
    51      build-snaps:
    52        - go
    53      build-packages:
    54        - git
    55        - sed