Push container on release

This commit is contained in:
stefanprodan
2019-08-06 15:32:37 +03:00
parent 045246c324
commit f9ce51da4b
2 changed files with 7 additions and 25 deletions
+5 -25
View File
@@ -2,7 +2,7 @@ sudo: required
language: go
go:
- 1.11.x
- 1.12.x
services:
- docker
@@ -12,36 +12,16 @@ addons:
packages:
- docker-ce
before_install:
- make dep
# - go get sigs.k8s.io/kind
# - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
# - chmod +x ./kubectl
# - kind create cluster
# - export KUBECONFIG="$(kind get kubeconfig-path --name="1")"
# - ./kubectl cluster-info
# - docker build -t podinfo:test -f Dockerfile.ci .
# - ./kubectl run podinfo --image=podinfo:test --port=9898 --image-pull-policy=Never -- ./podinfo --port=9898
# - sleep 5
# - ./kubectl describe deployment podinfo
# - ./kubectl describe po
script:
- make test
- make build docker-build
- make build-container
after_success:
- if [ -z "$DOCKER_USER" ]; then
echo "PR build, skipping Docker Hub push";
- if [ -z "$TRAVIS_TAG" ]; then
echo "Not a release, skipping container push";
else
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin;
make docker-push;
fi
- if [ -z "$QUAY_USER" ]; then
echo "PR build, skipping Quay push";
else
echo $QUAY_PASS | docker login -u $QUAY_USER --password-stdin quay.io;
make quay-push;
make push-container;
fi
deploy:
+2
View File
@@ -8,6 +8,8 @@ COPY . .
RUN GOPROXY=https://proxy.golang.org go mod download
RUN go test -v -race ./...
RUN GIT_COMMIT=$(git rev-list -1 HEAD) && \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${GIT_COMMIT}" \