forked from openshift-labs/devops-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8239a8b
commit a9c9f8e
Showing
10 changed files
with
242 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ FROM registry.access.redhat.com/openshift3/jenkins-slave-maven-rhel7 | |
|
||
MAINTAINER Siamak Sadeghianfar <[email protected]> | ||
|
||
ENV GRADLE_VERSION=3.4.1 | ||
ENV GRADLE_VERSION=3.6 | ||
|
||
USER root | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,46 @@ | ||
apiVersion: v1 | ||
kind: BuildConfig | ||
metadata: | ||
annotations: | ||
pipeline.alpha.openshift.io/uses: '[{"name": "cart", "namespace": "", "kind": "DeploymentConfig"}]' | ||
name: cart-pipeline | ||
spec: | ||
strategy: | ||
jenkinsPipelineStrategy: | ||
jenkinsfile: |- | ||
node('maven') { | ||
stage('Build') { | ||
openshiftBuild(buildConfig: 'cart', showBuildLogs: 'true') | ||
pipeline { | ||
agent any | ||
stages { | ||
stage('Build') { | ||
steps { | ||
script { | ||
openshift.withCluster() { | ||
openshift.withProject() { | ||
openshift.startBuild("cart", "--follow") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Deploy') { | ||
steps { | ||
script { | ||
openshift.withCluster() { | ||
openshift.withProject() { | ||
dc = openshift.selector("dc", "cart") | ||
dc.rollout().latest() | ||
timeout(10) { | ||
dc.rollout().status("-w") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Test') { | ||
steps { | ||
sh "curl -s -X POST http://cart:8080/api/cart/dummy/666/1" | ||
sh "curl -s http://cart:8080/api/cart/dummy | grep 'Dummy Product'" | ||
} | ||
} | ||
} | ||
stage('Deploy') { | ||
openshiftDeploy(deploymentConfig: 'cart') | ||
openshiftVerifyDeployment(deploymentConfig: "cart", replicaCount: 1, verifyReplicaCount: true) | ||
} | ||
stage('Test') { | ||
sh "curl -s -X POST http://cart.dev.svc.cluster.local:8080/api/cart/dummy/666/1" | ||
sh "curl -s http://cart.dev.svc.cluster.local:8080/api/cart/dummy | grep 'Dummy Product'" | ||
} | ||
} | ||
} | ||
type: JenkinsPipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,51 @@ | ||
node('maven') { | ||
stage('Build App') { | ||
git url: "http://gogs.lab-infra.svc.cluster.local:3000/developer/cart-service.git" | ||
sh "mvn clean package -s src/main/config/settings.xml" | ||
pipeline { | ||
agent { | ||
label 'maven' | ||
} | ||
stage('Integration Test') { | ||
sh "mvn verify -s src/main/config/settings.xml" | ||
stages { | ||
stage('Build App') { | ||
steps { | ||
sh "mvn clean package -s src/main/config/settings.xml" | ||
} | ||
} | ||
stage('Integration Test') { | ||
steps { | ||
sh "mvn verify -s src/main/config/settings.xml" | ||
} | ||
} | ||
stage('Build Image') { | ||
steps { | ||
script { | ||
openshift.withCluster() { | ||
openshift.withProject() { | ||
openshift.startBuild("cart", "--from-file=target/cart.jar", "--follow") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Deploy') { | ||
steps { | ||
script { | ||
openshift.withCluster() { | ||
openshift.withProject() { | ||
dc = openshift.selector("dc", "cart") | ||
dc.rollout().latest() | ||
timeout(10) { | ||
dc.rollout().status("-w") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Component Test') { | ||
steps { | ||
script { | ||
sh "curl -s -X POST http://cart:8080/api/cart/dummy/666/1" | ||
sh "curl -s http://cart:8080/api/cart/dummy | grep 'Dummy Product'" | ||
} | ||
} | ||
} | ||
} | ||
stage('Build Image') { | ||
sh "oc start-build cart --from-file=target/cart.jar --follow" | ||
} | ||
stage('Deploy') { | ||
openshiftDeploy deploymentConfig: 'cart' | ||
openshiftVerifyDeployment deploymentConfig: "cart", replicaCount: 1, verifyReplicaCount: true | ||
} | ||
stage('Component Test') { | ||
sh "curl -s -X POST http://cart.dev.svc.cluster.local:8080/api/cart/dummy/666/1" | ||
sh "curl -s http://cart.dev.svc.cluster.local:8080/api/cart/dummy | grep 'Dummy Product'" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,63 @@ | ||
node('maven') { | ||
stage('Build App') { | ||
git url: "http://gogs.lab-infra.svc.cluster.local:3000/developer/cart-service.git" | ||
sh "mvn clean package -s src/main/config/settings.xml" | ||
} | ||
stage('Integration Test') { | ||
sh "mvn verify -s src/main/config/settings.xml" | ||
} | ||
stage('Build Image') { | ||
sh "oc start-build cart --from-file=target/cart.jar --follow" | ||
} | ||
stage('Deploy') { | ||
openshiftDeploy depCfg: 'cart' | ||
openshiftVerifyDeployment depCfg: 'cart', replicaCount: 1, verifyReplicaCount: true | ||
} | ||
stage('Component Test') { | ||
sh "curl -s -X POST http://cart.dev.svc.cluster.local:8080/api/cart/dummy/666/1" | ||
sh "curl -s http://cart.dev.svc.cluster.local:8080/api/cart/dummy | grep 'Dummy Product'" | ||
} | ||
stage('Approve') { | ||
timeout(time:15, unit:'MINUTES') { | ||
input message:'Approve Deploy to Prod?' | ||
pipeline { | ||
agent { | ||
label 'maven' | ||
} | ||
stages { | ||
stage('Build App') { | ||
steps { | ||
sh "mvn clean package -s src/main/config/settings.xml" | ||
} | ||
} | ||
stage('Integration Test') { | ||
steps { | ||
sh "mvn verify -s src/main/config/settings.xml" | ||
} | ||
} | ||
stage('Build Image') { | ||
steps { | ||
script { | ||
openshift.withCluster() { | ||
openshift.withProject() { | ||
openshift.startBuild("cart", "--from-file=target/cart.jar", "--follow") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Deploy') { | ||
steps { | ||
script { | ||
openshift.withCluster() { | ||
openshift.withProject() { | ||
dc = openshift.selector("dc", "cart") | ||
dc.rollout().latest() | ||
timeout(10) { | ||
dc.rollout().status("-w") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Component Test') { | ||
steps { | ||
script { | ||
sh "curl -s -X POST http://cart:8080/api/cart/dummy/666/1" | ||
sh "curl -s http://cart:8080/api/cart/dummy | grep 'Dummy Product'" | ||
} | ||
} | ||
} | ||
stage('Promote to Prod') { | ||
steps { | ||
timeout(time:15, unit:'MINUTES') { | ||
input message: "Approve Promotion to Prod?", ok: "Promote" | ||
} | ||
script { | ||
openshift.withCluster() { | ||
openshift.tag("dev-XX/cart:latest", "prod-XX/cart:prod") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Promote') { | ||
openshiftTag srcStream: 'cart', srcTag: 'latest', namespace: 'dev', destStream: 'cart', destTag: 'prod', destinationNamespace: 'prod' | ||
sleep 10 | ||
openshiftVerifyDeployment depCfg: 'cart', replicaCount: 1, verifyReplicaCount: true, namespace: 'prod' | ||
} | ||
|
||
stage('End-To-End Test') { | ||
sh "curl -s -X POST http://cart.prod.svc.cluster.local:8080/api/cart/dummy/444434/1" | ||
sh "curl -s http://cart.prod.svc.cluster.local:8080/api/cart/dummy | grep 'Pebble Smart Watch'" | ||
} | ||
} | ||
} |
Oops, something went wrong.