Personally, I think you had better use the OpenShift Pipeline Jebkins Plugin for your use.
It can be implemented your own CI/CD
using various ways, so it's a just sample. Maybe you would undergo trial and error for finding your own CI/CD
configurations.
For example, simple build and deploy description using OpenShift Pipeline Jenkins Plugin
.
For more details, refer here
And post notification for the job result is configured using Cleaning up and notifications.
apiVersion: v1
kind: BuildConfig
metadata:
labels:
name: your-pipeline
name: your-pipeline
spec:
runPolicy: Serial
strategy:
jenkinsPipelineStrategy:
jenkinsfile: |-
node(''){
stage('some unit tests') {
sh 'git clone https://github.com/yourproject/yourrepo'
sh 'python -m unittest tests/unittest_start_and_result_mailing.py'
}
stage('Build using your-yourconfig'){
openshiftBuild(namespace: 'your-project', bldCfg: 'your-buildconfig', showBuildLogs: 'true')
}
stage('Deployment using your-deploymentconfig'){
openshiftDeploy(namespace: 'your-project', depCfg: 'your-deploymentconfig')
}
stage('Verify Deployment status'){
openshiftVerifyDeployment(namespace: 'your-project', depCfg: 'your-deploymentconfig', verifyReplicaCount: 'true')
}
}
post {
always {
echo 'One way or another, I have finished'
deleteDir() /* clean up our workspace */
}
success {
echo 'I succeeeded!'
}
unstable {
echo 'I am unstable :/'
}
failure {
echo 'I failed :('
}
changed {
echo 'Things were different before...'
}
}
type: JenkinsPipeline
triggers:
- github:
secret: gitsecret
type: GitHub
- generic:
secret: genericsecret
type: Generic
I hope it help you.