Bug 1740270

Summary: Jenkins builds are lost when migrating a jenkins persistent pipeline.
Product: OpenShift Container Platform Reporter: Sergio <sregidor>
Component: Migration ToolingAssignee: Scott Seago <sseago>
Status: CLOSED NOTABUG QA Contact: Sergio <sregidor>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.2.0CC: chezhang, jmatthew, rpattath
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-02 18:32:23 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:

Description Sergio 2019-08-12 14:42:29 UTC
Description of problem:
The builds generated before the migration in a jenkins persistent pipeline are deleted after the migration.


Version-Release number of selected component (if applicable):

OCP3
oc v3.11.136
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://...
openshift v3.11.136
kubernetes v1.11.0+d4cacc0

OCP4
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.0+c46cfef", GitCommit:"c46cfef", GitTreeState:"clean", BuildDate:"2019-08-07T23:33:46Z", GoVersion:"go1.12.6", Compiler:"gc", Platform:"linux/amd64"}

velero
    image: quay.io/ocpmigrate/velero:fusor-dev
    imageID: quay.io/ocpmigrate/velero@sha256:b707ae4f22ba1828ca6f9992b190134eaef145364cb57146d84616ccefdafbb7
    image: quay.io/ocpmigrate/migration-plugin:latest
    imageID: quay.io/ocpmigrate/migration-plugin@sha256:d34af290b3c6d808ad360a1f2d41d91e06bff5aa912f9a5a78fed3ea2f0f8f71

    deployment.kubernetes.io/revision: "1"

app migration operator
    image: quay.io/ocpmigrate/mig-operator:olm
    imageID: quay.io/ocpmigrate/mig-operator@sha256:2c48e910cc265cff61772266cea9159b29ff2787c9780194a45c6572c1a742db


How reproducible:


Steps to Reproduce:


1. Deploy a persistent jenkins
   For instance:

$ oc process -f https://raw.githubusercontent.com/sergiordlr/temp-testfiles/master/app_migration/jenkins/jenkins-persistent-template.yml -p STORAGE_CLASS="JENKINS_STORAGECLASS"  -p DISABLE_ADMINISTRATIVE_MONITORS=true | oc create -f -

2. Deploy a jenkins pipeline
   For instance:
$ oc process -f https://raw.githubusercontent.com/sergiordlr/temp-testfiles/master/app_migration/jenkins/jenkins-persistent-template.yml -p STORAGE_CLASS="JENKINS_STORAGECLASS"  -p DISABLE_ADMINISTRATIVE_MONITORS=true | oc create -f -

3.Execute a build in the namespace

$ oc start-build sample-pipeline

We get this:

$ oc get buildconfig
NAME                     TYPE              FROM      LATEST
nodejs-mongodb-example   Source            Git       1
sample-pipeline          JenkinsPipeline             1


4. Migrate the namespace



Actual results:
1. We get this in the target cluster
$ oc get buildconfig
NAME                     TYPE              FROM   LATEST
nodejs-mongodb-example   Source            Git    0
sample-pipeline          JenkinsPipeline          0

2. Jenkins build is not there. I don't see any problem in the volume migration, it was migrated correctly. It's Jenkins who deletes the build, as we can see in the jenkins logs when synchronizing:

NFO: Updated job jenkins-nodejs-test-sample-pipeline from BuildConfig NamespaceName{jenkins-nodejs-test:sample-pipeline} with revision: 138855
Aug 12, 2019 10:55:48 AM io.fabric8.jenkins.openshiftsync.BuildConfigWatcher$1 doRun
INFO: creating BuildConfig watch for namespace jenkins-nodejs-test and resource version 139362
Aug 12, 2019 10:55:49 AM okhttp3.internal.platform.Platform log
INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?
Aug 12, 2019 10:55:49 AM io.fabric8.jenkins.openshiftsync.JenkinsUtils deleteRun
INFO: Deleting run: jenkins-nodejs-test/jenkins-nodejs-test-sample-pipeline #1
Aug 12, 2019 10:55:50 AM io.fabric8.jenkins.openshiftsync.BuildSyncRunListener onDeleted
INFO: onDeleted job/jenkins-nodejs-test/job/jenkins-nodejs-test-sample-pipeline/1/

Expected results:
1. Jenkins builds executed before the migration should be there after migrating.

Additional info:

Comment 1 Zhang Cheng 2019-08-13 02:30:56 UTC
Clarify for reproduce step 2:
Should be:
2. Deploy a jenkins pipeline
   For instance:
# oc process -f https://raw.githubusercontent.com/sergiordlr/temp-testfiles/master/app_migration/jenkins/nodejs_mongo_dev_env/samplepipeline.yaml -p PVC_STORAGECLASS="MONGO_STORAGECLASS" | oc create -f -

Comment 4 Scott Seago 2020-04-02 18:32:23 UTC
I'm closing this as NOTABUG since the stated problem "The builds generated before the migration in a jenkins persistent pipeline are deleted after the migration." is no longer relevant. With a recent change, we're now removing before-migration builds *during* the migration, so they'll never show up on the destination cluster. Jenkins will no longer be deleting them since they won't be restored in the first place.

If there are other issues with Jenkins and migration, then a new BZ is probably appropriate. If there's some need to restore the old builds (and keep them around), then we probably need a larger discussion since there were other problems associated with restoring old builds apart from Jenkins-related issues.