forked from nagypeter/angular-java-creditscore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wercker.yml
126 lines (122 loc) · 5.24 KB
/
wercker.yml
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
box: combient/java-mvn
build:
steps:
# Build Creditscore application
- script:
name: Customize application home page
code: sed "s|@@NAMESPACE@@|${WERCKER_APPLICATION_OWNER_NAME}|g" -i $WERCKER_ROOT/src/main/webapp/WEB-INF/views/CreditScore.jsp
- script:
name: Print JSP source
code: cat $WERCKER_ROOT/src/main/webapp/WEB-INF/views/CreditScore.jsp
- script:
name: Customize application context path
code: sed "s|replaceme|${WERCKER_APPLICATION_OWNER_NAME}|g" -i $WERCKER_ROOT/src/main/webapp/WEB-INF/weblogic.xml
- script:
name: Print weblogic.xml source
code: cat $WERCKER_ROOT/src/main/webapp/WEB-INF/weblogic.xml
- script:
name: Maven build for WebLogic deployment
code: mvn clean package -Pweblogic
deploy-to-weblogic:
box:
id: spotify/alpine
cmd: /bin/sh
steps:
# Deploy WAR using WebLogic REST Management interface
- script:
name: using curl to deploy through REST management interface
code: |
curl -v --user $WLS_ADMIN:$WLS_PASSWORD -H "X-Requested-By:Wercker" -H "Accept:application/json" -H "Content-Type:multipart/form-data" -F "model={name: '${WERCKER_APPLICATION_OWNER_NAME}-webapp', targets: [ 'cluster-1' ]}" -F deployment=@"${WERCKER_ROOT}/target/creditscore-1.0.0.war" http://${WLS_IP}:${WLS_ADMIN_PORT}/management/wls/latest/deployments/application
- script:
name: Print application URL
code: echo http://${WLS_IP}:30305/${WERCKER_APPLICATION_OWNER_NAME}
package-archive:
box:
id: spotify/alpine
cmd: /bin/sh
steps:
- script:
name: Install zip
code: apk --no-cache add zip
- script:
name: Package application
code: |
mkdir -p $WERCKER_ROOT/wlsdeploy/applications
cp $WERCKER_ROOT/target/*.war $WERCKER_ROOT/wlsdeploy/applications/
zip -r archive.zip wlsdeploy
- script:
name: Update application archive name in WLDT topology
code: |
sed "s|@@APP2DEPLOY@@|`ls $WERCKER_ROOT/wlsdeploy/applications/`|g" -i $WERCKER_ROOT/docker/simple-topology.yaml
cat $WERCKER_ROOT/docker/simple-topology.yaml
build-domain-in-home-image:
box:
id: alpine
cmd: /bin/sh
docker: true
steps:
- script:
name: Install curl and docker
code: apk --no-cache add curl docker
- script:
name: Download WLDT
code: |
curl -Lo $WERCKER_ROOT/weblogic-deploy.zip https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.14/weblogic-deploy.zip
ls -la $WERCKER_ROOT
- script:
name: Create WebLogic credentials
code: |
echo "$WLS_ADMIN" > $WERCKER_ROOT/docker/adminuser.properties
echo "$WLS_PASSWORD" > $WERCKER_ROOT/docker/adminpass.properties
echo "$JDBC_URL" > $WERCKER_ROOT/docker/jdbcurl.properties
ls -la $WERCKER_ROOT/docker/
cat $WERCKER_ROOT/docker/adminuser.properties
cat $WERCKER_ROOT/docker/jdbcurl.properties
- script:
name: Build docker image
code: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
. container-scripts/setEnv.sh docker/domain.properties
docker build --file Dockerfile.weblogic \
$BUILD_ARG \
--build-arg WDT_MODEL=docker/simple-topology.yaml \
--build-arg WDT_VARIABLE=docker/domain.properties \
--build-arg WDT_ARCHIVE=archive.zip \
--force-rm=true \
-t $DOCKER_USERNAME/$WERCKER_APPLICATION_NAME:$WERCKER_GIT_COMMIT .
- script:
name: Push the image to a repository
code: docker push $DOCKER_USERNAME/$WERCKER_APPLICATION_NAME:$WERCKER_GIT_COMMIT
update-domain-in-home-image:
box:
id: alpine
cmd: /bin/sh
docker: true
steps:
- script:
name: Install curl and docker
code: apk --no-cache add docker
- script:
name: Create WebLogic credentials
code: |
echo "username=$WLS_ADMIN" > $WERCKER_ROOT/docker/security.properties
echo "password=$WLS_PASSWORD" >> $WERCKER_ROOT/docker/security.properties
ls -la $WERCKER_ROOT/docker/
cat $WERCKER_ROOT/docker/security.properties
- script:
name: Build docker image
code: |
export WEBAPP_WAR="creditscore-1.0.0.war"
export WEBAPP_LOCATION="target"
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker build --file Dockerfile.weblogic.update --no-cache \
--build-arg WEBAPP_LOCATION=$WEBAPP_LOCATION \
--build-arg WEBAPP_WAR=$WEBAPP_WAR \
--build-arg SOURCEIMAGE=$DOCKER_USERNAME/$WERCKER_APPLICATION_NAME:$SOURCEIMAGE_TAG \
--build-arg WLS_ADMINUSER=$WLS_ADMIN \
--build-arg WLS_ADMINPASSWORD=$WLS_PASSWORD \
--force-rm=true \
-t $DOCKER_USERNAME/$WERCKER_APPLICATION_NAME:$WERCKER_GIT_COMMIT .
- script:
name: Push the image to a repository
code: docker push $DOCKER_USERNAME/$WERCKER_APPLICATION_NAME:$WERCKER_GIT_COMMIT