atiato (12) [Avatar] Offline
I'm facing this issue with Jenkins:

I followed the Book- logged in Jenkins with openshift admin user.

from Book MEAP version below 6.12 figure it is mentioned If you go back to the Dev Build job and click Build Now, Build will fail with below error:

Starting the "Trigger OpenShift Build" step with build config "todo-app-flask-mongo" from the project "dev".
com.openshift.restclient.authorization.ResourceForbiddenException: Resource Forbidden
at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(
at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(
at okhttp3.internal.http.RealInterceptorChain.proceed(
at okhttp3.internal.http.RealInterceptorChain.proceed(
at okhttp3.RealCall.getResponseWithInterceptorChain(
at okhttp3.RealCall.execute(
at com.openshift.internal.restclient.DefaultClient.execute(
at com.openshift.internal.restclient.DefaultClient.execute(
at com.openshift.internal.restclient.DefaultClient.execute(
at com.openshift.internal.restclient.DefaultClient.get(
at com.openshift.jenkins.plugins.pipeline.model.RetryIClient.lambda$get$5(
at com.openshift.jenkins.plugins.pipeline.model.RetryIClient.retry(
at com.openshift.jenkins.plugins.pipeline.model.RetryIClient.get(
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftBuilder.coreLogic(
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(
at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doIt(
at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(
at hudson.tasks.BuildStepMonitor$1.perform(
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(
at hudson.model.Build$
at hudson.model.Build$BuildExecution.doRun(
at hudson.model.AbstractBuild$
at hudson.model.Run.execute(
at hudson.model.ResourceController.execute(
ERROR: "Trigger OpenShift Build" failed
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE
atiato (12) [Avatar] Offline
it works after adding the below :

# Grant Jenkins Access to Projects
oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n dev
oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n prod
oc policy add-role-to-user edit system:serviceaccount:cicd:jenkins -n test

Please add it inside the book , Thanks,
atiato (12) [Avatar] Offline
Another issue appeared when running the pipeline :

the following output failed :

Starting the "Verify OpenShift Build" step with build config "todo-app-flask-mongo" from the project "dev".

Waiting on build "todo-app-flask-mongo-8" to complete followed by a new deployment ...

Operation will timeout after 60000 milliseconds

Exiting "Verify OpenShift Build" unsuccessfully; build "todo-app-flask-mongo-8" has completed with status: [Complete]. However, not all deployments with ImageChange triggers based on this build's output triggered off of the new image.

"Verify OpenShift Build" failed

Note that after I updated jenkins file with the following

checkForTriggeredDeployments: 'false'

then it successfully works.

John Osborne (6) [Avatar] Offline
Thanks I'll investigate. The templates provided include the RoleBindings so that the users do not have to run the policy commands. I'll look into what went wrong.
atiato (12) [Avatar] Offline
Hi ,

Did you check the issue ?

Omar Atia
John Osborne (6) [Avatar] Offline
Yes! I think I finally figured it out. I had trouble with this one because some people were able it and some people were not.

I'm about to patch the template now so that those commands don't need to be in the text.
atiato (12) [Avatar] Offline
Ok great , Thanks.
John Osborne (6) [Avatar] Offline
I'm actually going to have to update the book with the commands. When you run "oc policy add-role-to-user" it's creating a RoleBinding API Object in the dev account that allows the jenkins serviceaccount to edit the project. However, when I'm adding the API Object to the template it's still getting put into the cicd project even though I explicity call it dev.

I'll just update the text to include the commands. I really appreciate your help on finding this!