Bug 1397695

Summary: Jenkins job displays failure while existing pods are not deployed by the latest deployment using "Scale OpenShift Deployment" jenkins dsl step
Product: OpenShift Container Platform Reporter: Dongbo Yan <dyan>
Component: ImageStreamsAssignee: Gabe Montero <gmontero>
Status: CLOSED CURRENTRELEASE QA Contact: Wang Haoran <haowang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.4.0CC: aos-bugs, jokerman, mmccomas, tdawson
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: jenkins-plugin incorrectly examined cancelled deployments Consequence: the scale step would be marked as failed when in fact it succeeded Fix: account for canceled deployments when determining the correction replication controller to examine Result: the scale step now works even if the latest deployments were canceled
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-16 21:02:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
jenkins job log none

Description Dongbo Yan 2016-11-23 08:19:12 UTC
Created attachment 1223054 [details]
jenkins job log

Description of problem:
using "Scale OpenShift Deployment" jenkins dsl step to scale deployment, if existing pods are not deployed by the latest deployment, jenkins job will fail

Version-Release number of selected component (if applicable):
brew-pulp.../openshift3/jenkins-1-rhel7   latest              9edb7f9e5157   
brew-pulp.../openshift3/jenkins-2-rhel7   latest              b5b09fbedfc0 
openshift-login	0.9
openshift-pipeline	1.0.36
openshift-sync	0.0.17

openshift v3.4.0.28+dfe3a66
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

How reproducible:
Always

Steps to Reproduce:
1.Setup jenkins server and generate application under project
 $ oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/jenkins/pipeline/samplepipeline.json
 $ oc start-build sample-pipeline
2.wait nodejs-mongodb-example app pod is ready, trigger deployment manually, then cancel the latest deployment
3.create pipeline job, configure pipeline scripts
node{
    stage 'build'
    openshiftScale( depCfg: 'nodejs-mongodb-example',replicaCount: '3', verbose: 'true', verifyReplicaCount: 'false')
}

Actual results:
Jenkins job failed, but scale deployment successfully in fact
# oc get pod
NAME                             READY     STATUS      RESTARTS   AGE
nodejs-mongodb-example-6-6u63e   1/1       Running     0          50m
nodejs-mongodb-example-6-kfmpo   1/1       Running     0          33m
nodejs-mongodb-example-6-luel5   1/1       Running     0          45m

# oc get dc
NAME                     REVISION   DESIRED   CURRENT   TRIGGERED BY
nodejs-mongodb-example   7          3         0         config

# oc get rc
NAME                       DESIRED   CURRENT   READY     AGE
nodejs-mongodb-example-5   0         0         0         37m
nodejs-mongodb-example-6   3         3         3         17m
nodejs-mongodb-example-7   0         0         0         13m

Expected results:
Jenkins job success

Additional info:

Comment 1 Gabe Montero 2016-11-23 18:19:32 UTC
This bug has existed for a while.  The canceled build is fooling the plugin when attempting to find the latest version of the replication controller.

The logic should check phase/status when determining the RC to monitor.

Comment 2 Gabe Montero 2016-11-23 18:21:48 UTC
Note, even if we don't verify the replica count, we still confirm the state of the RC is complete.

Comment 3 Gabe Montero 2016-11-23 18:55:34 UTC
Commit https://github.com/openshift/jenkins-plugin/commit/2da6c4b83ea18768a77b2050732b4e6f1565ff58 addresses this issue.

I'll move the bug to QA once the plugin version and images are updated.

Comment 4 Gabe Montero 2016-11-28 15:24:14 UTC
Jenkins rhel image on brew-pulp now has v1.0.37 of the plugin, which includes the fix for this.

Comment 5 Dongbo Yan 2016-11-29 08:02:26 UTC
Test with
brew-pulp.../openshift3/jenkins-1-rhel7          bdda1c3ed6fd  
brew-pulp.../openshift3/jenkins-2-rhel7          40ed5bbd7488
openshift-login	0.9
openshift-pipeline	1.0.37
openshift-sync	0.1.5

openshift v3.4.0.30+e10cc28
kubernetes v1.4.0+776c994
etcd 3.1.0-rc.0

Comment 6 Troy Dawson 2017-02-16 21:02:35 UTC
This bug was fixed with the latest OCP 3.4.0 that is already released.