marcoabreu commented on issue #12784: Improved git reset for CI builds URL: https://github.com/apache/incubator-mxnet/pull/12784#issuecomment-430246873 > We recently had a problem with some buildscripts that would modify some Makefiles for Jetson cross compilation. But for the scope of that run, the modification is valid, right? After the run finishes, the workspace is automatically cleaned up. This means that a subsequent run won't be using these modified files but will get a unmodified version of the repository. > I'm afraid I don't understand what is a "too clean" state. What actions of Jenkins we are invalidating? What situation we are trying to validate by not resetting the repository before a clean build? Let's look at the following SCM log from Jenkins: ``` Cloning the remote Git repository Cloning with configured refspecs honoured and without tags Cloning repository https://github.com/apache/incubator-mxnet.git > git init /home/jenkins_slave/workspace/sanity-lint # timeout=10 Fetching upstream changes from https://github.com/apache/incubator-mxnet.git > git --version # timeout=10 using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/apache/incubator-mxnet.git +refs/pull/12656/head:refs/remotes/origin/PR-12656 +refs/heads/master:refs/remotes/origin/master > git config remote.origin.url https://github.com/apache/incubator-mxnet.git # timeout=10 > git config --add remote.origin.fetch +refs/pull/12656/head:refs/remotes/origin/PR-12656 # timeout=10 > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master # timeout=10 > git config remote.origin.url https://github.com/apache/incubator-mxnet.git # timeout=10 Fetching without tags Fetching upstream changes from https://github.com/apache/incubator-mxnet.git using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/apache/incubator-mxnet.git +refs/pull/12656/head:refs/remotes/origin/PR-12656 +refs/heads/master:refs/remotes/origin/master Merging remotes/origin/master commit 76ae7252a6751275565600d287b7d432b685fd7d into PR head commit 9451518b19406a6d5cc24ab0ea83d9776c078f3c > git config core.sparsecheckout # timeout=10 > git checkout -f 9451518b19406a6d5cc24ab0ea83d9776c078f3c > git merge 76ae7252a6751275565600d287b7d432b685fd7d # timeout=10 > git rev-parse HEAD^{commit} # timeout=10 Merge succeeded, producing 9451518b19406a6d5cc24ab0ea83d9776c078f3c Checking out Revision 9451518b19406a6d5cc24ab0ea83d9776c078f3c (PR-12656) > git config core.sparsecheckout # timeout=10 > git checkout -f 9451518b19406a6d5cc24ab0ea83d9776c078f3c Commit message: "[MXNET-703] Show perf info for TensorRT during tests" ``` As you can see, Jenkins runs ```git merge 76ae7252a6751275565600d287b7d432b685fd7d``` and thus creates a temporary commit that merges the PR with the head of master (in case your PR was not rebased). Your command would delete that commit. > We try to merge a PR into not modified master state. We are not switching any strategies, nor moving HEAD in any way. Unfortunately, you are actually moving HEAD with that action. The PR-merge strategy syncs up the HEAD of the PR (incase it has not been rebased) with the HEAD of master. After the PR-merge strategy has been applied, the HEAD of the PR (during that run) and the HEAD of master are equivalent + the changes of the PR. If we execute your git clean (or run PR-head strategy), the HEAD of the PR will be depending on the base of the PR. This means that the PR might have diverged from master. Think about the message ``` This branch is 66 commits ahead, 1750 commits behind apache:master. ``` The PR-head strategy (which you are enforcing that way) will keep it that way. The PR-merge strategy will make the PR look like ``` This branch is 66 commits ahead of apache:master. ``` Does that make it clearer for you?
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
