Created
October 3, 2018 10:58
-
-
Save rvanbutselaar/623468d14be1df5b3d39d8114bbecf79 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
apiVersion: v1 | |
items: | |
- kind: "BuildConfig" | |
apiVersion: "v1" | |
metadata: | |
name: "pipeline-demo" | |
spec: | |
triggers: | |
- github: | |
secret: 5Mlic4Le | |
type: GitHub | |
- generic: | |
secret: FiArdDBH | |
type: Generic | |
strategy: | |
type: "JenkinsPipeline" | |
jenkinsPipelineStrategy: | |
jenkinsfile: | | |
node { | |
withEnv(['GUID=mydemo']) { | |
stage ("Build") | |
echo '*** Build Starting ***' | |
openshiftBuild bldCfg: 'cotd2', buildName: '', checkForTriggeredDeployments: 'false', commitID: '', namespace: '', showBuildLogs: 'false', verbose: 'false', waitTime: '' | |
openshiftVerifyBuild apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', bldCfg: 'cotd2', checkForTriggeredDeployments: 'false', namespace: '', verbose: 'false' | |
echo '*** Build Complete ***' | |
stage ("Deploy and Verify in Development Env") | |
echo '*** Deployment Starting ***' | |
openshiftDeploy apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', depCfg: 'cotd2', namespace: '', verbose: 'false', waitTime: '' | |
openshiftVerifyDeployment apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', depCfg: 'cotd2', namespace: '', replicaCount: '1', verbose: 'false', verifyReplicaCount: 'false', waitTime: '' | |
echo '*** Deployment Complete ***' | |
echo '*** Service Verification Starting ***' | |
openshiftVerifyService apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', namespace: 'pipeline-${GUID}-dev', svcName: 'cotd2', verbose: 'false' | |
echo '*** Service Verification Complete ***' | |
openshiftTag(srcStream: 'cotd2', srcTag: 'latest', destStream: 'cotd2', destTag: 'testready') | |
stage ('Deploy and Test in Testing Env') | |
echo '*** Deploy testready build in pipeline-${GUID}-test project ***' | |
openshiftDeploy apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', depCfg: 'cotd2', namespace: 'pipeline-${GUID}-test', verbose: 'false', waitTime: '' | |
openshiftVerifyDeployment apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', depCfg: 'cotd2', namespace: 'pipeline-${GUID}-test', replicaCount: '1', verbose: 'false', verifyReplicaCount: 'false', waitTime: '10' | |
sh 'curl http://cotd2-pipeline-${GUID}-test.apps.na39.openshift.opentlc.com/data/ | grep cats -q' | |
stage ('Promote and Verify in Production Env') | |
echo '*** Waiting for Input ***' | |
input 'Should we deploy to Production?' | |
openshiftTag(srcStream: 'cotd2', srcTag: 'testready', destStream: 'cotd2', destTag: 'prodready') | |
echo '*** Deploying to Production ***' | |
openshiftDeploy apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', depCfg: 'cotd2', namespace: 'pipeline-${GUID}-prod', verbose: 'false', waitTime: '' | |
openshiftVerifyDeployment apiURL: 'https://openshift.default.svc.cluster.local', authToken: '', depCfg: 'cotd2', namespace: 'pipeline-${GUID}-prod', replicaCount: '1', verbose: 'false', verifyReplicaCount: 'false', waitTime: '10' | |
sleep 10 | |
sh 'curl http://cotd2-pipeline-${GUID}-prod.apps.na39.openshift.opentlc.com/data/ | grep cats -q' | |
} | |
} | |
kind: List | |
metadata: {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment