-
Notifications
You must be signed in to change notification settings - Fork 193
/
Copy pathrelease-local.sh
executable file
·49 lines (40 loc) · 1.39 KB
/
release-local.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
#!/bin/bash
set -euo pipefail
: "${REPO:=}"
: "${MANIFESTS:=}"
: "${DOCKERFILE:=Dockerfile}"
if [ -z "$REPO" ]; then echo "REPO is required"; exit 1; fi
if [ -z "$MANIFESTS" ]; then echo "MANIFESTS is required"; exit 1; fi
TEMP_COMMIT="false"
test -z "$(git status --porcelain)" || TEMP_COMMIT="true"
if [[ "${TEMP_COMMIT}" == "true" ]]; then
git add .
git commit -m "Temporary" || true
fi
REV=$(git rev-parse --short HEAD)
TAG="${TAG:-$REV}"
if [[ -z "${DOCKER+1}" ]] && command -v buildah >& /dev/null; then
buildah bud -t $REPO:$TAG -f "${DOCKERFILE}" .
buildah push $REPO:$TAG docker://$REPO:$TAG
elif [[ -z "${DOCKER+1}" ]] && command -v podman >& /dev/null; then
podman build -t $REPO:$TAG -f "${DOCKERFILE}" .
podman push $REPO:$TAG
else
docker build -t $REPO:$TAG -f "${DOCKERFILE}" .
docker push $REPO:$TAG
fi
if [[ "${TEMP_COMMIT}" == "true" ]]; then
git reset --soft HEAD~1
fi
cp -R manifests/* $MANIFESTS
cat manifests/02-deployment.yaml | sed "s~openshift/origin-cluster-ingress-operator:latest~$REPO:$TAG~" > "$MANIFESTS/02-deployment.yaml"
# To simulate CVO, ClusterOperator resource need to be created by the operator.
rm $MANIFESTS/03-cluster-operator.yaml
echo "Pushed $REPO:$TAG"
echo "Install manifests using:"
echo ""
echo "oc apply -f $MANIFESTS"
echo ""
echo "Alternatively, rollout just a new operator deployment with:"
echo ""
echo "oc apply -f $MANIFESTS/02-deployment.yaml"