This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
run.sh
executable file
·70 lines (56 loc) · 2.17 KB
/
run.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
#!/usr/bin/env sh
#*******************************************************************************
# Copyright (c) 2019 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v20.html
#
# Contributors:
# IBM Corporation - initial API and implementation
#*******************************************************************************
# Colours for success and error messages
GREEN='\033[0;32m'
RED='\033[0;31m'
BLUE='\033[0;36m'
RESET='\033[0m'
printf "\n\n${BLUE}Running 'run.sh' to build and start codewind. $RESET\n";
# Set before mvn is run to prevent the reset of the MAVEN_OPTS that can happen if its in the start.sh script
export HOST_MAVEN_OPTS=$MAVEN_OPTS
mvn -v > /dev/null 2>&1
MVN_RET_CODE=$?
if [ "$MVN_RET_CODE" -ne 0 ]; then
echo "\n${RED}Error: Maven not found. Please install maven to continue local build.$RESET"
exit 1
fi
# CREATE CODEWIND-WORKSPACE IF NOT EXISTS
printf "\n\n${BLUE}CREATING ~/.codewind IF IT DOESN'T EXIST${RESET}\n"
mkdir -m 777 -p ~/.codewind
# Save the git config required to make an initial commit.
mkdir -m 777 -p ~/.codewind/config
GIT_CONFIG=~/.codewind/config/git.config
rm $GIT_CONFIG
git config -f $GIT_CONFIG --add user.name "`git config --get user.name || echo 'codewind user'`"
git config -f $GIT_CONFIG --add user.email "`git config --get user.email || echo 'codewind.user@localhost'`"
DIR=`pwd`
# Setting the NOBUILD env var to true uses the current images.
# Used in Jenkins when we build and push the images with script/build.sh
# before running the tests via ./test.sh
if [ "$NOBUILD" = "true" ]; then
echo "*** Using existing images, not performing image rebuild ***"
else
# Build the docker images
printf "\n\n${BLUE}BUILDING DOCKER IMAGES${RESET}\n\n";
./script/build.sh;
EC=$?
if [ $EC -ne 0 ]; then
printf "\n${RED}FAILED TO BUILD\nExiting. $RESET";
exit $EC
else
printf "\n${GREEN}ALL DOCKER IMAGES SUCCESSFULLY BUILT $RESET\n";
fi
fi
# Return to starting directory
cd $DIR/
# Start codewind
./start.sh