-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathenv.sh
More file actions
executable file
·45 lines (37 loc) · 1021 Bytes
/
env.sh
File metadata and controls
executable file
·45 lines (37 loc) · 1021 Bytes
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
#/bin/bash
function docker_image_pushed {
if docker buildx imagetools inspect "$1" > /dev/null 2> /dev/null; then
return 0
else
return 1
fi
}
function git_get_current_tag {
if [ "$1" != "" ]; then pushd "$1" > /dev/null; fi
git tag --points-at HEAD | sed 's|+||g'
if [ "$1" != "" ]; then popd > /dev/null; fi
}
function git_get_origin {
if [ "$1" != "" ]; then pushd "$1" > /dev/null; fi
git config --get remote.origin.url
if [ "$1" != "" ]; then popd > /dev/null; fi
}
function git_get_current_sha {
if [ "$1" != "" ]; then pushd "$1" > /dev/null; fi
git rev-parse --short HEAD
if [ "$1" != "" ]; then popd > /dev/null; fi
}
if [ "$REPO_GIT_REF" == "" ]; then
REPO_GIT_REF="$(git_get_current_tag)"
fi
if [ "$REPO_GIT_REF" == "" ]; then
REPO_GIT_REF="$(git_get_current_sha)"
fi
if [ "$BASE_UBUNTU_REGISTRY" == "" ]; then
BASE_UBUNTU_REGISTRY=docker.io/library
fi
if [ "$1" != "" ]; then
for PROJ in "$@"; do
source $(dirname ${BASH_SOURCE[0]})/${PROJ}/env.sh
done
fi