forked from github/multus-cni
117 lines
6.1 KiB
YAML
117 lines
6.1 KiB
YAML
os: linux
|
|
language: go
|
|
# see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments
|
|
# for the detail
|
|
# sudo: requried
|
|
dist: bionic
|
|
|
|
services:
|
|
- docker
|
|
|
|
go:
|
|
- 1.13.x
|
|
|
|
env:
|
|
global:
|
|
- GO111MODULE=on
|
|
- REGISTRY_USER=${REGISTRY_USER:-nfvpe}
|
|
- REGISTRY_PASS=${REGISTRY_PASS}
|
|
- REPOSITORY_NAME=${REPOSITORY_NAME}
|
|
- REPOSITORY_USER=${REPOSITORY_USER}
|
|
- DOCKER_CLI_EXPERIMENTAL="enabled"
|
|
- secure: "${REGISTRY_SECURE}"
|
|
jobs:
|
|
- TARGET=amd64
|
|
- TARGET=ppc64le
|
|
|
|
before_install:
|
|
- if [ "${REPOSITORY_NAME}" = "" ]; then export REPOSITORY_NAME=multus; fi
|
|
- sudo apt-get update -qq
|
|
- go get github.com/mattn/goveralls
|
|
|
|
install:
|
|
- go get -u golang.org/x/lint/golint
|
|
|
|
before_script:
|
|
# Make gopath... to run golint/go fmt/go vet
|
|
# Suppress golint for fixing lint later.
|
|
- golint ./... | grep -v vendor | grep -v ALL_CAPS | xargs -r false
|
|
- go fmt ./...
|
|
- go vet ./...
|
|
# - gocyclo -over 15 ./multus
|
|
|
|
script:
|
|
- GOARCH="${TARGET}" ./hack/build-go.sh
|
|
- |
|
|
if [ "${TARGET}" == "amd64" ]; then
|
|
sudo env PATH=${PATH} ./scripts/test.sh
|
|
goveralls -coverprofile=coverage.out -service=travis-ci
|
|
docker build -t ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 .
|
|
docker build -t ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le -f Dockerfile.ppc64le .
|
|
docker build -t ${REPOSITORY_USER}/${REPOSITORY_NAME}-origin:latest -f Dockerfile.openshift .
|
|
fi
|
|
|
|
deploy:
|
|
# Release on versioned tag (e.g. v1.0)
|
|
- provider: script
|
|
#cleanup: false
|
|
script: curl -sL https://git.io/goreleaser
|
|
on:
|
|
tags: true
|
|
all_branches: true
|
|
condition: "$TARGET = amd64 && $TRAVIS_TAG =~ ^v[0-9].*$ && ! -z $GITHUB_TOKEN && $TRAVIS_OS_NAME = linux"
|
|
# Push images to Dockerhub on tag
|
|
- provider: script
|
|
cleanup: false
|
|
script: >
|
|
bash -c '
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest;
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable;
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64;
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:$TRAVIS_TAG;
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le;
|
|
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:$TRAVIS_TAG;
|
|
export DOCKER_CLI_EXPERIMENTAL="enabled";
|
|
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 --arch amd64;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le --arch ppc64le;
|
|
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest;
|
|
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-amd64 --arch amd64;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable-ppc64le --arch ppc64le;
|
|
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:stable;
|
|
echo done'
|
|
on:
|
|
tags: true
|
|
all_branches: true
|
|
condition: "$TRAVIS_TAG =~ ^v[0-9].*$ && -n $REGISTRY_USER && -n $REGISTRY_PASS && -n $REPOSITORY_NAME && -n $REPOSITORY_USER"
|
|
# Push images to Dockerhub on merge to master
|
|
- provider: script
|
|
on:
|
|
branch: master
|
|
condition: "-n $REGISTRY_USER && -n $REGISTRY_PASS && -n $REPOSITORY_NAME && -n $REPOSITORY_USER"
|
|
script: >
|
|
bash -c '
|
|
docker tag ${REPOSITORY_USER}/:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot;
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64;
|
|
docker tag ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le;
|
|
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64;
|
|
docker push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le;
|
|
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-amd64 --arch amd64;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot-ppc64le --arch ppc64le;
|
|
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:snapshot;
|
|
docker manifest create ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-amd64 --arch amd64;
|
|
docker manifest annotate ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest-ppc64le --arch ppc64le;
|
|
docker manifest push ${REPOSITORY_USER}/${REPOSITORY_NAME}:latest;
|
|
echo done'
|