Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail Jenkins job with OCP problems #98

Open
chrira opened this issue Mar 2, 2021 · 0 comments
Open

Fail Jenkins job with OCP problems #98

chrira opened this issue Mar 2, 2021 · 0 comments

Comments

@chrira
Copy link
Member

chrira commented Mar 2, 2021

Fail Build:

        stage('build application') {
            steps {
                script {
                    openshift.withCluster(env.OPENSHIFT_CLUSTER) {
                        openshift.withCredentials(env.OPENSHIFT_CREDENTIALS) {
                            openshift.withProject(env.OPENSHIFT_PROJECT) {
                                echo "Hello from project ${openshift.project()} in cluster ${openshift.cluster()}"
                                def bcSelector = openshift.selector("BuildConfig", [ app : env.APP_LABEL ]) // select build
                                def build = bcSelector.startBuild()
                                def result = build.logs('-f')
                                ctx.echo("oc startBuild action: ${result.actions[0].cmd}")
                                ctx.echo("oc startBuild status: ${result.status}")
                                if (build.object().status.phase == 'Failed') {
                                    ctx.fail("openshift build ${build.object().metadata.name} failed")
                                }
                            }
                        }
                    }
                }
            }
        }

Add Build timeout to OpenShift Build and add same timeout to Build Stage in Jenkins.

Add same behavior to apply and rollout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant