forked from RedHatInsights/rhsm-subscriptions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcicd_common.sh
42 lines (39 loc) · 1.06 KB
/
cicd_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
#!/bin/bash
if [[ -n "$DRY_RUN" ]]; then
docker() {
echo [DRYRUN] docker "$@"
}
podman() {
echo [DRYRUN] podman "$@"
}
oc() {
echo [DRYRUN] oc "$@"
}
fi
get_dockerfile() {
component=$1
if [ "$component" == "rhsm-subscriptions" ]; then
echo "./Dockerfile"
else
if [[ -f $component/Dockerfile ]]; then
echo "$component/Dockerfile"
elif [[ -f $component/src/main/docker/Dockerfile.jvm ]]; then
echo "src/main/docker/Dockerfile.jvm"
fi
fi
}
get_approot() {
component=$1
if [ "$component" == "rhsm-subscriptions" ]; then
echo "$PWD"
else
if [[ -f $component/Dockerfile ]]; then
echo "$PWD"
elif [[ -f $component/src/main/docker/Dockerfile.jvm ]]; then
echo "$PWD/$component"
fi
fi
}
# First sed removes leading ".", second sed removes leading "/"
# so that "./swatch-system-conduit" becomes "swatch-system-conduit"
SERVICES="rhsm-subscriptions `(find -name Dockerfile.jvm -exec dirname {} \;; find -regex '.*/Dockerfile' -exec dirname {} \;) | sed 's/^.//' | sed 's#^/##' | sed s'#/.*##'`"