snapcraft.yaml 1.7 KB

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