我知道在Openshift中使用Jenkins时可能会有这种情况,但是当使用纯构建映像时,似乎缺少完整的CI / CD。
对于每次推送到“ master”分支的理想方案是:
简单的Openshift构建设置仅包含粗体项。
我们可以在Openshift中拥有完整的CI / CD吗?还是我们应该在外面做检查? 据我所知,Openshift中仍然缺少有关失败的通知。
答案 0 :(得分:1)
我个人认为,最好使用OpenShift Pipeline Jebkins Plugin。
您可以使用各种方式来实现它自己的CI/CD
,因此这只是一个示例。也许您会因尝试找到自己的CI/CD
配置而经历反复试验。
例如,使用OpenShift Pipeline Jenkins Plugin
进行简单的构建和部署描述。
有关更多详细信息,请参阅here
然后使用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
希望对您有帮助。