forked from prometheus-operator/prometheus-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis-push-docker-image.sh
executable file
·32 lines (27 loc) · 1.15 KB
/
travis-push-docker-image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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
# Push to Quay '-dev' repo if it's not a git tag or master branch build.
export REPO="quay.io/coreos/prometheus-operator"
export REPO_PROMETHEUS_CONFIG_RELOADER="quay.io/coreos/prometheus-config-reloader"
export REPO_PROMETHEUS_OPERATOR_LINT="quay.io/coreos/prometheus-operator-lint"
if [[ "${TRAVIS_TAG}" == "" ]] && [[ "${TRAVIS_BRANCH}" != master ]]; then
export REPO="quay.io/coreos/prometheus-operator-dev"
export REPO_PROMETHEUS_CONFIG_RELOADER="quay.io/coreos/prometheus-config-reloader-dev"
export REPO_PROMETHEUS_OPERATOR_LINT="quay.io/coreos/prometheus-operator-lint-dev"
fi
# For both git tags and git branches 'TRAVIS_BRANCH' contains the name.
export TAG="${TRAVIS_BRANCH}"
make image
echo "${QUAY_PASSWORD}" | docker login -u "${QUAY_USERNAME}" --password-stdin quay.io
docker push "${REPO}:${TAG}"
docker push "${REPO_PROMETHEUS_CONFIG_RELOADER}:${TAG}"
docker push "${REPO_PROMETHEUS_OPERATOR_LINT}:${TAG}"