-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
74 lines (65 loc) · 1.71 KB
/
docker-entrypoint.sh
File metadata and controls
74 lines (65 loc) · 1.71 KB
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
68
69
70
71
72
73
74
#!/bin/sh
set -e # Exit immediately if anything below exits with non-zero status.
if
[ $UFFIZZI_USER ] &&
[ $UFFIZZI_SERVER ] &&
[ $UFFIZZI_PASSWORD ]
then
uffizzi login --username "${UFFIZZI_USER}" --server "${UFFIZZI_SERVER}" --silent
if [ $UFFIZZI_PROJECT ]
then
uffizzi config set project "${UFFIZZI_PROJECT}" --silent
fi
else
if
[ $REQUEST_TOKEN ] &&
[ $REQUEST_TOKEN_URL ]
then
OIDC_TOKEN=$(curl -sLS "${REQUEST_TOKEN_URL}&audience=uffizzi" -H "User-Agent: actions/oidc-client" -H "Authorization: Bearer $REQUEST_TOKEN")
uffizzi login_by_identity_token --token "${OIDC_TOKEN}" --server "${UFFIZZI_SERVER}" --silent
else
echo "Specify environment variables to login before executing Uffizzi CLI."
echo "UFFIZZI_USER, UFFIZZI_SERVER, UFFIZZI_PASSWORD, and optionally UFFIZZI_PROJECT"
echo "or"
echo "REQUEST_TOKEN, REQUEST_TOKEN_URL and UFFFIZZI SERVER"
fi
fi
if
[ $DOCKERHUB_USERNAME ] &&
[ $DOCKERHUB_PASSWORD ]
then
uffizzi connect docker-hub --update-credential-if-exists --silent
fi
if
[ $DOCKER_REGISTRY_USERNAME ] &&
[ $DOCKER_REGISTRY_PASSWORD ] &&
[ $DOCKER_REGISTRY_URL ]
then
uffizzi connect docker-registry --update-credential-if-exists --silent
fi
if
[ $ACR_USERNAME ] &&
[ $ACR_PASSWORD ] &&
[ $ACR_REGISTRY_URL ]
then
uffizzi connect acr --update-credential-if-exists --silent
fi
if
[ $AWS_ACCESS_KEY_ID ] &&
[ $AWS_SECRET_ACCESS_KEY ] &&
[ $AWS_REGISTRY_URL ]
then
uffizzi connect ecr --update-credential-if-exists --silent
fi
if
[ $GCLOUD_SERVICE_KEY ]
then
uffizzi connect gcr --update-credential-if-exists --silent
fi
if
[ $GITHUB_USERNAME ] &&
[ $GITHUB_ACCESS_TOKEN ]
then
uffizzi connect ghcr --update-credential-if-exists --silent
fi
exec uffizzi "$@"