-
Notifications
You must be signed in to change notification settings - Fork 3
/
common.sh
executable file
·67 lines (58 loc) · 2.3 KB
/
common.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#
# Copyright (c) 2020-2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
IMAGE_SIDECAR=che-sidecar-workspace-data-sync
IMAGE_SERVER=che-workspace-data-sync-storage
TAG=$1
ORGANIZATION=$2
REPOSITORY=$3
function dockerBuild() {
printf "Build docker image %s/%s/%s:%s \n" "$REPOSITORY" "$ORGANIZATION" "$IMAGE_SIDECAR" "$TAG";
docker build -t "$REPOSITORY/$ORGANIZATION/$IMAGE_SIDECAR:$TAG" . -f dockerfiles/sidecar/Dockerfile
if [ $? != 0 ]; then
printf "Failed build docker image %s/%s/%s:%s \n" "$REPOSITORY" "$ORGANIZATION" "$IMAGE_SIDECAR" "$TAG";
exit 0
fi
printf "Build docker image %s/%s/%s:%s \n" "$REPOSITORY" "$ORGANIZATION" "$IMAGE_SERVER" "$TAG";
docker build -t "$REPOSITORY/$ORGANIZATION/$IMAGE_SERVER:$TAG" . -f dockerfiles/server/Dockerfile
if [ $? != 0 ]; then
printf "Failed build docker image %s/%s/%s:%s \n" "$REPOSITORY" "$ORGANIZATION" "$IMAGE_SERVER" "$TAG";
exit 0
fi
echo "Build images successfully completed"
}
function dockerTag() {
VERSION=$(head -n 1 VERSION)
echo "Taging images to the ${VERSION}"
docker tag quay.io/eclipse/che-workspace-data-sync-storage:latest quay.io/eclipse/che-workspace-data-sync-storage:"${VERSION}"
docker tag quay.io/eclipse/che-sidecar-workspace-data-sync:latest quay.io/eclipse/che-sidecar-workspace-data-sync:"${VERSION}"
}
function dockerPushTag() {
VERSION=$(head -n 1 VERSION)
echo "Push images version: ${VERSION}"
docker push quay.io/eclipse/che-workspace-data-sync-storage:"${VERSION}"
docker push quay.io/eclipse/che-sidecar-workspace-data-sync:"${VERSION}"
}
function dockerPushLatest() {
echo "Push latest images"
docker push quay.io/eclipse/che-workspace-data-sync-storage:latest
docker push quay.io/eclipse/che-sidecar-workspace-data-sync:latest
}
function dockerPushNext() {
echo "Push next images"
docker push quay.io/eclipse/che-workspace-data-sync-storage:next
docker push quay.io/eclipse/che-sidecar-workspace-data-sync:next
}
function gitPushTag() {
VERSION=$(head -n 1 VERSION)
echo "Create tag "${VERSION}" on GitHub"
git checkout release -f
git tag "${VERSION}"
git push origin "${VERSION}"
}