openshift / jenkins-plugin

Apache License 2.0
81 stars 50 forks source link

only annotate rc with build if checking if dc triggered #102

Closed gabemontero closed 7 years ago

gabemontero commented 7 years ago

@bparees fyi .... last chance to change mind on annotate vs. check dc decision

fixes https://github.com/openshift/jenkins-plugin/issues/101

bparees commented 7 years ago

i discussed it w/ @spadgett, we're ok with "if you don't ask us to verify deployments occurred after your build, the deployment won't be annotated when it occurs" (unless the deployment is explicitly triggered by a "trigger a deployment" step, of course)

gabemontero commented 7 years ago

On Friday, October 28, 2016, Ben Parees notifications@github.com wrote:

i discussed it w/ @spadgett https://github.com/spadgett, we're ok with "if you don't ask us to verify deployments occurred after your build, the deployment won't be annotated when it occurs" (unless the deployment is explicitly triggered by a "trigger a deployment" step, of course)

Ok so you mean trigger a build step followed by trigger a deployment step? If so that would entail somehow transferring a bit of state between steps. I've gone down this path before with jenkins env vars and it doesn't work (they clear things out between steps). Or we have the trigger deploy step query builds that might trigger its deployment. Not exactly enamored with such a change this late in the cycle.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openshift/jenkins-plugin/pull/102#issuecomment-257030168, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbadEVb4OFH89feT0KWRIdwPJX9fQ7lks5q4mWLgaJpZM4Kj3bc .

bparees commented 7 years ago

Ok so you mean trigger a build step followed by trigger a deployment step?

i just meant that if you have an explicit "trigger a deployment" step in your jenkins job, the deployment will be annotated as having been triggered by jenkins. that logic should already be there, unless i'm misremembering what we did.

bparees commented 7 years ago

whatever the case, i'm definitely not suggesting new logic.

gabemontero commented 7 years ago

On Friday, October 28, 2016, Ben Parees notifications@github.com wrote:

Ok so you mean trigger a build step followed by trigger a deployment step?

i just meant that if you have an explicit "trigger a deployment" step in your jenkins job, the deployment will be annotated as having been triggered by jenkins. that logic should already be there, unless i'm misremembering what we did.

Ah yeah I think you right. I'll confirm next time I have the code in front of me prior to merging this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/openshift/jenkins-plugin/pull/102#issuecomment-257063732, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbadFKEOnxV-Pi117G5S9xz7ffdswa1ks5q4qWxgaJpZM4Kj3bc .

gabemontero commented 7 years ago

So just to summarize on the latest code, the "triggered in jenkins" annotations occur: 1) on the Build object here, whenever a build is triggered 2) on the ReplicationController object here, whenever a deployment is triggered 3) on the ReplicationController object here, whenever the user selects to verify after triggering a build that deployments listening for the build output image in fact triggered

gabemontero commented 7 years ago

The pr test failed in some of the new multitag path with service account permissions:

Starting "Tag OpenShift Image" with the source [image stream:tag] "multitag:orig" from the project "extended-test-jenkins-plugin-eg2xp-6vdhc" and destination stream(s) "multitag" with tag(s) "prod" from the project "extended-test-jenkins-plugin-eg2xp-6vdhc".
ERROR: Build step failed with exception
com.openshift.restclient.authorization.ResourceForbiddenException: User "system:serviceaccount:extended-test-jenkins-plugin-eg2xp-6vdhc-jenkins:default" cannot get imagestreams in project "extended-test-jenkins-plugin-eg2xp-6vdhc" User "system:serviceaccount:extended-test-jenkins-plugin-eg2xp-6vdhc-jenkins:default" cannot get imagestreams in project "extended-test-jenkins-plugin-eg2xp-6vdhc"
    at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.createOpenShiftException(ResponseCodeInterceptor.java:106)
    at com.openshift.internal.restclient.okhttp.ResponseCodeInterceptor.intercept(ResponseCodeInterceptor.java:65)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170)
    at okhttp3.RealCall.execute(RealCall.java:60)
    at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:217)
    at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:194)
    at com.openshift.internal.restclient.DefaultClient.execute(DefaultClient.java:183)
    at com.openshift.internal.restclient.DefaultClient.get(DefaultClient.java:291)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftImageTagger.coreLogic(IOpenShiftImageTagger.java:139)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doItCore(IOpenShiftPlugin.java:299)
    at com.openshift.jenkins.plugins.pipeline.model.IOpenShiftPlugin.doIt(IOpenShiftPlugin.java:312)
    at com.openshift.jenkins.plugins.pipeline.OpenShiftBaseStep.perform(OpenShiftBaseStep.java:81)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1738)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Build step 'Tag OpenShift Image' marked build as failure
Finished: FAILURE

@jupierce is that expected or a known issue? Tagging permissions are unrelated to the change I introduced to the plugin.

gabemontero commented 7 years ago

[test]

seeing if the image stream / service account permission item is a flake or consistent

gabemontero commented 7 years ago

not a flake ... seeing the permission issue in this current run with the oc exec test case as well.

going to do some manual regression testing ... if passes, will merge this change, and we can sort out extended test issues separately.

gabemontero commented 7 years ago

manual verification passes (including verifying the annotations show up on both the builds and rc's) - going to merge - will sync up with @jupierce wrt the PR testing / extended tests tomorrow.

jupierce commented 7 years ago

@gabemontero The serviceaccount permission issues seems systemic. It is affecting unrelated extended tests as well: https://ci.openshift.redhat.com/jenkins/job/origin_extended_image_tests/730/testReport/(root)/Extended/_image_ecosystem__jenkins__schedule_jobs_on_pod_slaves_use_of_jenkins_with_kubernetes_plugin_by_creating_slave_from_existing_builder_and_adding_it_to_Jenkins_master/