-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.sh
More file actions
166 lines (139 loc) · 3.82 KB
/
build.sh
File metadata and controls
166 lines (139 loc) · 3.82 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
#
# Copyright 2021. Independent Identity Incorporated
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script runs the maven build and builds the docker packages
function show_usage (){
printf "Usage: $0 [options [parameters]]\n"
printf "\n"
printf "Options:\n"
printf " -t|--test, run maven tests\n"
printf " --tag [tag-version], Specify tag number\n"
printf " -p|--push, push to docker"
printf " -b|--build, maven build only"
printf " -h|--help, Print help\n"
return 0
}
function show_complete () {
echo "*************************************************"
echo " COMPLETE: "$(date +"%Y-%m-%d %H:%M:%S")
echo "*************************************************"
return 0
}
function compile_module() {
echo "\n\nCompiling ${1} at ${2} ..."
cd $2
mvn clean compile -DskipTests=$skip
retVal=$?
if [ $retVal -ne 0 ]
then
echo "Error performing maven packaging [${1}]: "+$retVal
exit $retVal
fi
}
function build_package() {
echo "\n\nBuilding Packaging ${1} at ${2} ...\n\n"
cd $2
mvn clean install -DskipTests=$skip
retVal=$?
if [ $retVal -ne 0 ]
then
echo "Error performing build packaging for [${1}]: "+$retVal
exit $retVal
fi
}
function package_module() {
echo "\n\nPackaging ${1} at ${2} ..."
cd $2
mvn package -DskipTests=$skip
retVal=$?
if [ $retVal -ne 0 ]
then
echo "Error performing maven packaging [${1}]: "+$retVal
exit $retVal
fi
}
I2SCIM_ROOT=$(pwd)
echo "Current dir: ${I2SCIM_ROOT}"
skip=true
rtag="0.8.0"
buildOnly=0
push=0
echo "*************************************************"
echo " Starting i2scim Build "
while [ ! -z "$1" ]; do
case "$1" in
--push|-p)
shift
echo "\tPush requested"
push=1
;;
--test|-t)
shift
echo "\tTests requested"
skip=false
;;
--build|-b)
shift
echo "\tSkipping Docker build"
buildOnly=1
;;
--tag)
shift
rtag=$1
;;
*)
show_usage
;;
esac
shift
done
echo "\tTag: $rtag"
echo "\tStarting: "$(date +"%Y-%m-%d %H:%M:%S")
echo "*************************************************"
build_package "SCIM CORE" "${I2SCIM_ROOT}/i2scim-core"
build_package "SCIM Server" "${I2SCIM_ROOT}/i2scim-server"
build_package "SCIM Memory Provider" "${I2SCIM_ROOT}/i2scim-prov-memory"
build_package "SCIM Mongo Provider" "${I2SCIM_ROOT}/i2scim-prov-mongo"
build_package "SCIM Client" "${I2SCIM_ROOT}/i2scim-client"
build_package "SCIM Signals" "${I2SCIM_ROOT}/i2scim-signals"
build_package "SCIM Universal" "${I2SCIM_ROOT}/i2scim-universal"
if [ $skip -eq false ]
then
build_package "SCIM Signals" "${I2SCIM_ROOT}/i2scim-tests"
fi
if [ $buildOnly -eq 1 ]
then
show_complete
exit 0
fi
echo ""
echo "\tStarting Docker build i2scim-universal..."
echo ""
cd ${I2SCIM_ROOT}/i2scim-universal
if [ $push -eq 1 ]
then
docker buildx build --platform linux/amd64,linux/arm64 -f src/main/docker/Dockerfile.jvm --push -t independentid/i2scim-universal:$rtag .
else
docker buildx build --load -f src/main/docker/Dockerfile.jvm -t independentid/i2scim-universal:$rtag .
fi
retVal=$?
if [ $retVal -ne 0 ]
then
echo "Docker error packaging i2scim-mem: "+$retVal
exit $retVal
fi
#cp target/kubernetes/kubernetes.yml ./4-i2scim-memory-deploy.yml
show_complete