Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50800

workspace/<jobname>* are not cleaned on SCM change.

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: workflow-job-plugin
    • Labels:
      None
    • Environment:
      jenkins 2.89.3, pipeline 2.5, git 3.7.0
    • Similar Issues:

      Description

      When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

      Why? Because on the change from P4 -> Git, we can observe the following behaviour:

      Setup, Do an admin-like thing and make a git backup of your jenkins master home :

      cd into the Jenkins home directory (e.g., /var/lib/jenkins);
      git init && git add . && git commit -m `initial commit`

      Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
      Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
      Run the job. Now see that most of the jenkins home is blown away.

      This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

      The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory. And cleanup the workspace/<jobname>* (@script in particular) on SCM change.

        Attachments

          Issue Links

            Activity

            mhall4 Matthew Hall created issue -
            mhall4 Matthew Hall made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-38699 [ JENKINS-38699 ]
            mhall4 Matthew Hall made changes -
            Link This issue is related to JENKINS-22795 [ JENKINS-22795 ]
            mhall4 Matthew Hall made changes -
            Description
            When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

            Why? Because on the change from P4 -> Git, we can observe the following behaviour:

            Setup, Do an admin-like thing and make a git backup of your jenkins master home :

            cd into the Jenkins home directory (e.g., /var/lib/jenkins);
            git init && git add . && git commit -m `initial commit`

            Create a Pipeline job that pulls from Perforce. Have it run once.
            Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
            Run the job. Now see that most of the jenkins home is blown away.

            This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

            The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory.

            When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

            Why? Because on the change from P4 -> Git, we can observe the following behaviour:

            Setup, Do an admin-like thing and make a git backup of your jenkins master home :

            cd into the Jenkins home directory (e.g., /var/lib/jenkins);
            git init && git add . && git commit -m `initial commit`

            Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
            Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
            Run the job. Now see that most of the jenkins home is blown away.

            This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

            The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory.

            mhall4 Matthew Hall made changes -
            Description When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

            Why? Because on the change from P4 -> Git, we can observe the following behaviour:

            Setup, Do an admin-like thing and make a git backup of your jenkins master home :

            cd into the Jenkins home directory (e.g., /var/lib/jenkins);
            git init && git add . && git commit -m `initial commit`

            Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
            Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
            Run the job. Now see that most of the jenkins home is blown away.

            This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

            The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory.

            When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

            Why? Because on the change from P4 -> Git, we can observe the following behaviour:

            Setup, Do an admin-like thing and make a git backup of your jenkins master home :

            cd into the Jenkins home directory (e.g., /var/lib/jenkins);
            git init && git add . && git commit -m `initial commit`

            Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
            Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
            Run the job. Now see that most of the jenkins home is blown away.

            This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

            The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory. And cleanup the workspace/<jobname> on SCM change.

            mhall4 Matthew Hall made changes -
            Description When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

            Why? Because on the change from P4 -> Git, we can observe the following behaviour:

            Setup, Do an admin-like thing and make a git backup of your jenkins master home :

            cd into the Jenkins home directory (e.g., /var/lib/jenkins);
            git init && git add . && git commit -m `initial commit`

            Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
            Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
            Run the job. Now see that most of the jenkins home is blown away.

            This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

            The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory. And cleanup the workspace/<jobname> on SCM change.

            When changing a Pipeline job from a Pipeline Perforce to a Pipeline git (just changing the SCM type) the workspace/<jobname>* files and dirs should be cleaned up.

            Why? Because on the change from P4 -> Git, we can observe the following behaviour:

            Setup, Do an admin-like thing and make a git backup of your jenkins master home :

            cd into the Jenkins home directory (e.g., /var/lib/jenkins);
            git init && git add . && git commit -m `initial commit`

            Create a Pipeline job that pulls from Perforce to run a Jenkinsfile. Have it run once.
            Now change the Pipeline job to pull from Git (pretend you migrated your code or something).
            Run the job. Now see that most of the jenkins home is blown away.

            This is because when git encounters problems, git will traverse upwards looking for some usable .git directory. It will wind up in your jenkins home.

            The workaround, is that git or jenkins or pipeline should set "GIT_CEILING_DIRECTORIES" to prevent git from leaving the workspace directory. And cleanup the workspace/<jobname>* (@script in particular) on SCM change.

            markewaite Mark Waite made changes -
            Assignee Mark Waite [ markewaite ]
            abayer Andrew Bayer made changes -
            Component/s workflow-job-plugin [ 21716 ]
            Component/s git-plugin [ 15543 ]
            Component/s pipeline [ 21692 ]

              People

              • Assignee:
                Unassigned
                Reporter:
                mhall4 Matthew Hall
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: