Skip to content

Commit 9b2132d

Browse files
authored
Merge pull request #353 from oracle/promote-docker-hub
Create promote-image step
2 parents 8612a81 + 5de9b0b commit 9b2132d

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

wercker.yml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ build:
4646
cp operator/target/weblogic-kubernetes-operator-1.0.jar /operator/weblogic-kubernetes-operator.jar
4747
cp operator/target/lib/*.jar /operator/lib/
4848
export IMAGE_TAG_OPERATOR="${IMAGE_TAG_OPERATOR:-${WERCKER_GIT_BRANCH//[_\/]/-}}"
49-
if [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
49+
if [ "$IMAGE_TAG_OPERATOR" = "develop" ]; then
5050
export IMAGE_TAG_OPERATOR="latest"
51+
elif [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
52+
export IMAGE_TAG_OPERATOR="1.0"
5153
fi
5254
- script:
5355
name: Remove things we do not want in the Docker image in order to reduce size of image
5456
code: |
55-
rpm -e --nodeps tar
56-
rpm -e --nodeps gzip
57+
rpm -e --nodeps tar
58+
rpm -e --nodeps gzip
5759
yum clean all
5860
rm -rf /var/cache/yum
5961
# push the image to Docker using the GIT branch as the tag
@@ -85,14 +87,14 @@ integration-test:
8587
# clean up
8688
yum clean all
8789
88-
# store the artifacts so we can download them easily
90+
# store the artifacts so we can download them easily
8991
tar czvf ${WERCKER_REPORT_ARTIFACTS_DIR}/integration-test-data.tar.gz /pipeline/output/*
9092
}
91-
93+
9294
function finish {
9395
exit_code=$?
9496
export INTEGRATION_TEST_RESULT="$exit_code"
95-
97+
9698
cleanup_and_store
9799
exit 0
98100
}
@@ -160,7 +162,7 @@ integration-test:
160162
echo @@ "LEASE_ID=$LEASE_ID host=$HOST date=`date` user=$USER."
161163
echo @@
162164
echo @@ "Current lease owner (if any):"
163-
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -s
165+
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -s
164166
echo @@
165167
echo @@ "About to try obtain lease:"
166168
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -o "$LEASE_ID" -t $((100 * 60))
@@ -175,8 +177,10 @@ integration-test:
175177
176178
export IMAGE_NAME_OPERATOR="${REPO_REPOSITORY}"
177179
export IMAGE_TAG_OPERATOR="${WERCKER_GIT_BRANCH//[_\/]/-}"
178-
if [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
180+
if [ "$IMAGE_TAG_OPERATOR" = "develop" ]; then
179181
export IMAGE_TAG_OPERATOR="latest"
182+
elif [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
183+
export IMAGE_TAG_OPERATOR="1.0"
180184
fi
181185
export IMAGE_PULL_POLICY_OPERATOR="Always"
182186
export IMAGE_PULL_SECRET_OPERATOR="ocir-registry"
@@ -189,24 +193,24 @@ integration-test:
189193
$WERCKER_SOURCE_DIR/src/integration-tests/bash/run.sh
190194
RUN_SH_RC=$?
191195
192-
if [ "$RUN_SH_RC" = "0" ]; then
196+
if [ "$RUN_SH_RC" = "0" ]; then
193197
echo "run.sh finished successfully"
194198
else
195199
echo "run.sh failed with return code ${RUN_SH_RC}"
196200
exit $RUN_SH_RC
197201
fi
198-
202+
199203
cleanup_and_store
200204
201205
# This pipeline runs java integration tests against a k8s cluster on OCI.
202206
command-timeout: 60
203207
integration-test-java:
204208
steps:
205209
- script:
206-
name: obtain lease on k8s cluster
210+
name: obtain lease on k8s cluster
207211
code: |
208212
#!/bin/bash
209-
213+
210214
cp /etc/hosts $WERCKER_PIPELINE_DIR/hosts
211215
sed -i "$ a ${OCI_K8S_WORKER0_IP} ${OCI_K8S_WORKER0_HOSTNAME}" $WERCKER_PIPELINE_DIR/hosts
212216
cp $WERCKER_PIPELINE_DIR/hosts /etc/hosts
@@ -258,7 +262,7 @@ integration-test-java:
258262
echo @@ "LEASE_ID=$LEASE_ID host=$HOST date=`date` user=$USER."
259263
echo @@
260264
echo @@ "Current lease owner (if any):"
261-
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -s
265+
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -s
262266
echo @@
263267
echo @@ "About to try obtain lease:"
264268
$WERCKER_SOURCE_DIR/src/integration-tests/bash/lease.sh -o "$LEASE_ID" -t $((100 * 60))
@@ -273,26 +277,28 @@ integration-test-java:
273277
274278
export IMAGE_NAME_OPERATOR="${REPO_REPOSITORY}"
275279
export IMAGE_TAG_OPERATOR="${WERCKER_GIT_BRANCH//[_\/]/-}"
276-
if [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
280+
if [ "$IMAGE_TAG_OPERATOR" = "develop" ]; then
277281
export IMAGE_TAG_OPERATOR="latest"
282+
elif [ "$IMAGE_TAG_OPERATOR" = "master" ]; then
283+
export IMAGE_TAG_OPERATOR="1.0"
278284
fi
279285
export IMAGE_PULL_POLICY_OPERATOR="Always"
280286
export IMAGE_PULL_SECRET_OPERATOR="ocir-registry"
281287
export IMAGE_PULL_SECRET_WEBLOGIC="docker-store"
282288
283289
echo "Integration test suite against the test image which is:"
284290
echo "$IMAGE_NAME_OPERATOR:$IMAGE_TAG_OPERATOR"
285-
291+
286292
- script:
287293
name: Install pre-reqs
288294
code: |
289295
yum -y install tar gzip procps
290-
296+
291297
- wercker/maven:
292298
goals: test-compile integration-test
293299
version: 3.5.2
294300
profiles: java-integration-tests
295-
301+
296302
- script:
297303
name: cleanup and store
298304
code: |
@@ -301,28 +307,34 @@ integration-test-java:
301307
# clean up
302308
yum clean all
303309
304-
# store the artifacts so we can download them easily
310+
# store the artifacts so we can download them easily
305311
tar czvf ${WERCKER_REPORT_ARTIFACTS_DIR}/integration-test-data.tar.gz /pipeline/output/*
306312
}
307-
313+
308314
cleanup_and_store
309-
310-
311-
# This pipeline runs quality checks
315+
316+
# This pipeline runs quality checks
312317
quality:
313318
steps:
314319
- script:
315320
name: Install pre-reqs
316321
code: |
317322
yum -y install tar gzip procps
318-
- wercker/maven:
319-
profiles: build-sonar
320-
maven_opts: -Dsonar.login=${SONAR_LOGIN} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.host.url=${SONAR_HOST}
323+
- wercker/maven:
324+
profiles: build-sonar
325+
maven_opts: -Dsonar.login=${SONAR_LOGIN} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.host.url=${SONAR_HOST}
321326
goals: clean install sonar:sonar
322327
cache_repo: true
323328
version: 3.5.2
324329

330+
promote-image:
331+
steps:
332+
- internal/docker-push:
333+
username: $REPO_USERNAME
334+
password: $REPO_PASSWORD
335+
repository: oracle/weblogic-kubernetes-operator
336+
tag: $IMAGE_TAG_OPERATOR
325337

326338
dev:
327339
steps:
328-
- internal/shell
340+
- internal/shell

0 commit comments

Comments
 (0)