Note: Git is a prereq
-
Download the openshift-origin-client-tools for your OS: https://github.com/openshift/origin/releases/tag/v3.6.1
-
Fork this repo: https://github.com/danmcp/openshift-jee-sample
-
git clone https://github.com/<userid>/openshift-jee-sample.git
-
cd openshift-jee-sample
-
Login to web console
-
Create a project and give it a unique name
-
Open Metrics URL and accept the cert warnings
-
Add To Project -> Browse Catalog -> Java -> Red Hat JBoss EAP -> Red Hat JBoss EAP 7.0
- Name: somethingcool
- Git Repository URL: https://github.com/<userid>/openshift-jee-sample.git
- Blank out Git Reference and Context Dir
-
oc login
-
oc set env dc/somethingcool AUTO_DEPLOY_EXPLODED=true
-
oc get pods
-
oc rsync target/SampleApp.war/ <pod_name>:/deployments/SampleApp.war --watch
-
Browse to SampleApp/HelloWorld
-
Make a change to HelloWorld and/or HelloWorldHelper.java
-
Browse to SampleApp/HelloWorld
-
oc set env dc/somethingcool DEBUG=true
-
oc get pods
-
oc port-forward <pod_name> 8787:8787
-
oc rsync target/SampleApp.war/ <pod_name>:/deployments/SampleApp.war
-
Set a break point and browse to SampleApp/HelloWorld
-
Change danmcp in pipeline.yaml to be your github login
-
oc create -f https://raw.githubusercontent.com/<userid>/openshift-jee-sample/master/pipeline.yaml
-
Modify Jenkinsfile inside of node(maven):
//stage('build') { // git url: "https://github.com/<userid>/openshift-jee-sample.git" // openshiftBuild(buildConfig: 'somethingcool', showBuildLogs: 'true') //} stage('test') { git url: "https://github.com/<userid>/openshift-jee-sample.git" //sh "mvn verify" sh "mvn clean" } stage('approval') { input "Approve?" } stage('deploy') { openshiftDeploy(deploymentConfig: 'somethingcool') } stage('scale') { openshiftScale(deploymentConfig: 'somethingcool', replicaCount: '2') } stage('system test') { //sh "sleep 10" sh "curl http://somethingcool:8080 | grep WildFly" }
-
git add .
-
git commit -m 'Adding stages'
-
git push origin master