|
1 | 1 | #!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2020 The OpenEBS Authors. All rights reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
2 | 17 | set -e |
3 | 18 |
|
4 | 19 | if [ -z ${DIMAGE} ]; |
@@ -42,7 +57,10 @@ function TagAndPushImage() { |
42 | 57 | REPO="$1" |
43 | 58 | TAG="$2" |
44 | 59 |
|
45 | | - IMAGE_URI="${REPO}:${TAG}"; |
| 60 | + #Add an option to specify a custom TAG_SUFFIX |
| 61 | + #via environment variable. Default is no tag. |
| 62 | + #Example suffix could be "-debug" of "-dev" |
| 63 | + IMAGE_URI="${REPO}:${TAG}${TAG_SUFFIX}"; |
46 | 64 | sudo docker tag ${IMAGEID} ${IMAGE_URI}; |
47 | 65 | echo " push ${IMAGE_URI}"; |
48 | 66 | sudo docker push ${IMAGE_URI}; |
|
65 | 83 | # Push with different tags if tagged as a release |
66 | 84 | # When github is tagged with a release, then Travis will |
67 | 85 | # set the release tag in env TRAVIS_TAG |
68 | | - TagAndPushImage "${DIMAGE}" "${TRAVIS_TAG}" |
| 86 | + # Trim the `v` from the TRAVIS_TAG if it exists |
| 87 | + # Example: v1.10.0 maps to 1.10.0 |
| 88 | + # Example: 1.10.0 maps to 1.10.0 |
| 89 | + # Example: v1.10.0-custom maps to 1.10.0-custom |
| 90 | + TagAndPushImage "${DIMAGE}" "${TRAVIS_TAG#v}" |
69 | 91 | TagAndPushImage "${DIMAGE}" "latest" |
70 | 92 | fi; |
71 | 93 | else |
|
85 | 107 | # Push with different tags if tagged as a release |
86 | 108 | # When github is tagged with a release, then Travis will |
87 | 109 | # set the release tag in env TRAVIS_TAG |
88 | | - TagAndPushImage "quay.io/${DIMAGE}" "${TRAVIS_TAG}" |
| 110 | + # Trim the `v` from the TRAVIS_TAG if it exists |
| 111 | + TagAndPushImage "quay.io/${DIMAGE}" "${TRAVIS_TAG#v}" |
89 | 112 | TagAndPushImage "quay.io/${DIMAGE}" "latest" |
90 | 113 | fi; |
91 | 114 | else |
|
0 commit comments