forked from jenkinsci/bom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local-test.sh
executable file
·45 lines (38 loc) · 1.01 KB
/
local-test.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
#!/usr/bin/env bash
set -euxo pipefail
cd "$(dirname "$0")"
# expects: $PLUGINS, optionally $TEST, $LINE
LATEST_LINE=weekly
: "${LINE:=$LATEST_LINE}"
if [[ -z ${SAMPLE_PLUGIN_OPTS-} ]]; then
SAMPLE_PLUGIN_OPTS="-Dtest=InjectedTest"
fi
if [[ $LINE != "${LATEST_LINE}" ]]; then
SAMPLE_PLUGIN_OPTS+=" -P${LINE}"
fi
export SAMPLE_PLUGIN_OPTS
LINEZ=$LINE bash prep.sh
if [[ -n ${TEST-} ]]; then
EXTRA_MAVEN_PROPERTIES="test=${TEST}"
else
EXTRA_MAVEN_PROPERTIES=
fi
if [[ ${DOCKERIZED-} == "true" ]]; then
docker volume inspect m2repo || docker volume create m2repo
docker run \
-v ~/.m2:/var/maven/.m2 \
--rm \
--name bom-pct \
-v "$(pwd):/pct" \
-e MAVEN_OPTS=-Duser.home=/var/maven \
-e MAVEN_CONFIG=/var/maven/.m2 \
-e "PLUGINS=${PLUGINS}" \
-e "LINE=${LINE}" \
-e "EXTRA_MAVEN_PROPERTIES=${EXTRA_MAVEN_PROPERTIES}" \
--entrypoint bash \
maven \
-c "trap 'chown -R $(id -u):$(id -g) /pct /var/maven/.m2/repository' EXIT; bash /pct/pct.sh"
else
export EXTRA_MAVEN_PROPERTIES
LINE=$LINE bash pct.sh
fi