Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit d36068a

Browse files
committed
Fix develop image deployment
The $TRAVIS_TAG variable is available for tagged branches only. Separate tag deployments and branch deployments with their own docker tag commands in scripts/deploy.sh.
1 parent 9e673ae commit d36068a

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ jobs:
6565
- make image/cluster-operator
6666
before_deploy:
6767
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"
68-
- docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:latest"
69-
- docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:${TRAVIS_TAG}"
7068
deploy:
7169
- provider: script
72-
script: docker push "${IMAGE_NAME}:latest" && docker push "${IMAGE_NAME}:${TRAVIS_TAG}"
70+
script: bash scripts/deploy.sh tagged
7371
on:
7472
tags: true
7573
- provider: script
76-
script: docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:develop" && docker push "${IMAGE_NAME}:develop"
74+
script: bash scripts/deploy.sh develop
7775
on:
7876
branch: master

scripts/deploy.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# This script is used for publishing latest(release) and develop(canary)
5+
# container images of the operator. Script argument "tagged" must be passed to
6+
# publish a new release and "develop" must be passed to publish a canary image.
7+
8+
if [ "$1" = "tagged" ]; then
9+
docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:latest"
10+
docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:${TRAVIS_TAG}"
11+
docker push "${IMAGE_NAME}:latest" && docker push "${IMAGE_NAME}:${TRAVIS_TAG}"
12+
elif [ "$1" = "develop" ]; then
13+
docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${IMAGE_NAME}:develop"
14+
docker push "${IMAGE_NAME}:develop"
15+
fi

0 commit comments

Comments
 (0)