1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

quay: Push docker images to quay for all git branches

This commit is contained in:
Max Leonard Inden 2018-04-11 17:26:13 +02:00
parent aae5278218
commit 034d0d13ea
No known key found for this signature in database
GPG key ID: 5403C5464810BC26
2 changed files with 33 additions and 1 deletions

View file

@ -10,7 +10,7 @@ before_install:
jobs:
include:
# Check generated contents are up to date and code is formatted.
- stage: Sanity check and unit tests
- stage: Sanity check and unit tests
script: ./scripts/check-make-generate.sh
# Build Prometheus config reloader
- script: cd contrib/prometheus-config-reloader && make build
@ -28,3 +28,5 @@ jobs:
script: make helm-sync-s3
on:
branch: master
- stage: push-docker-image
script: ./scripts/travis-push-docker-image.sh

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# error on unset variables
set -u
function defer {
docker logout quay.io
}
trap defer EXIT
if [[ "${TRAVIS_PULL_REQUEST}" != "false" ]]; then
exit 0
fi
export REPO=quay.io/coreos/prometheus-operator
# Push to Quay '-dev' repo if not a git tag or master branch build
if [[ "${TRAVIS_TAG}" == "" ]] && [[ "${TRAVIS_BRANCH}" != master ]]; then
export REPO="${REPO}-dev"
fi
make crossbuild
# For both git tags and git branches 'TRAVIS_BRANCH' contains the name.
export TAG="${TRAVIS_BRANCH}"
make container
echo "${QUAY_PASSWORD}" | docker login -u "${QUAY_USERNAME}" --password-stdin quay.io
docker push "${REPO}:${TRAVIS_BRANCH}"