-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
39 lines (35 loc) · 1.05 KB
/
entrypoint.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
#!/usr/bin/env bash
set -e
if [ -z ${CRED+x} ]; then
echo "No authentication has been set, you might run into errors...";
else
echo "Authentication using $CRED";
if [ $CRED = "username" ];
then
sh -c "jfrog rt config --interactive=false --enc-password=true --url=$URL --user=$USER --password=$PASSWORD"
elif [ $CRED = "apikey" ];
then
sh -c "jfrog rt config --interactive=false --enc-password=true --url=$URL --apikey=$APIKEY"
elif [ $CRED = "accesstoken" ];
then
sh -c "jfrog rt config --interactive=false --enc-password=true --url=$URL --access-token=$ACCESSTOKEN"
else
echo "";
fi
fi
for cmd in "$@"; do
echo "Running '$cmd'..."
if [ "$cmd" != "-v" ]; then
if sh -c "jfrog rt $cmd"; then
# no op
echo "Successfully ran '$cmd'"
else
exit_code=$?
echo "Failure running '$cmd', exited with $exit_code"
exit $exit_code
fi
else
sh -c "jfrog $cmd"
echo "Successfully ran '$cmd'"
fi
done