-
Notifications
You must be signed in to change notification settings - Fork 0
/
runme.sh
executable file
·82 lines (65 loc) · 2.13 KB
/
runme.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
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
75
76
77
78
79
80
81
82
#!/bin/bash
while getopts n:p:u:t:U: opt
do
case "$opt" in
n) JFROG_BUILD_NAME=$OPTARG;;
p) JFROG_PROJECT=$OPTARG;;
u) JFROG_URL=$OPTARG;;
t) JFROG_TOKEN=$OPTARG;;
U) JFROG_USERNAME=$OPTARG;;
b) JFROG_BUILDNUMBER=$OPTARG;;
esac
done
if [ -z $JFROG_BUILD_NAME ]; then
echo "Missing build name"
SHOWHELP=1
fi
if [ -z $JFROG_PROJECT ]; then
echo "Missing project"
SHOWHELP=1
fi
if [ -z $JFROG_URL ]; then
echo "Missing URL"
SHOWHELP=1
fi
if [ -z $JFROG_TOKEN ]; then
echo "Missing token"
SHOWHELP=1
fi
if [ -z $JFROG_USERNAME ]; then
echo "Missing username"
SHOWHELP=1
fi
if [ -z $JFROG_BUILDNUMBER ]; then
JFROG_BUILDNUMBER=$(date +"%4Y.%m.%d-%H.%M.%S")
fi
if [ "$SHOWHELP" == "1" ]; then
echo "At least one missing parameter"
echo "All are required"
echo "-n <Build name to report to JFrog>"
echo "-p <Project name in JFrog>"
echo "-u <JFrog instance URL>"
echo "-t <Token to authenticate to JFrog with>"
echo "-U <Username to authenticate to JFrog with>"
echo "Optional:"
echo "-b <Build Number>, default to the current date/time in the format of %4Y.%m.%d-%H.%M.%S - example $(date +"%4Y.%m.%d-%H.%M.%S")"
exit 1
fi
docker image build -t jfrog --progress=plain ./jfrog-base
cp -r .git demo
cd ./demo
./build-docker.sh -t "test-buildserver1,test-buildserver2" -- \
--progress=plain \
--build-arg "dotnetcmd=jf dotnet" \
--build-arg JFROG_CLI_BUILD_NAME=${JFROG_BUILD_NAME} \
--build-arg JFROG_CLI_BUILD_NUMBER=${JFROG_BUILDNUMBER} \
--build-arg JFROG_CLI_BUILD_PROJECT=${JFROG_PROJECT} \
--build-arg JFROG_URL=${JFROG_URL} \
--build-arg JFROG_ENABLED=true \
--build-arg JFROG_TOKEN=${JFROG_TOKEN} \
--build-arg JFROG_USERNAME=${JFROG_USERNAME} \
--target=jfrogscan
./build-docker.sh -t "test-enduser"
rm -rf .git
echo "Expecting at least test-buildserver1, test-buildserver2 and test-enduser"
docker image ls | grep "^test"