Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do a hard reset if tck update fails and try git pull again #3978

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

Mesbah-Alam
Copy link
Contributor

@Mesbah-Alam Mesbah-Alam commented Sep 21, 2022

If there are changes in local tck repo on disc in a Jenkins machine, the default git pull results in a merge conflict and the build fails.

If this merge conflict occurs, this PR will catch it and clean up any local changes by performing a git --reset hard and a git clean, and git pull again.

Related backlog issue: backlog/issues/705

Signed-off-by: Mesbah Alam Mesbah_Alam@ca.ibm.com

@Mesbah-Alam Mesbah-Alam changed the title Do a hard reset if update fails and try update again Do a hard reset if tck update fails and try update again Sep 21, 2022
@Mesbah-Alam Mesbah-Alam force-pushed the fix-jck-update-git-logic branch 8 times, most recently from e0f6496 to c25de62 Compare September 27, 2022 20:47
Signed-off-by: Mesbah Alam <Mesbah_Alam@ca.ibm.com>
@Mesbah-Alam
Copy link
Contributor Author

Mesbah-Alam commented Sep 27, 2022

Step 1: Error reproduced on Grinder_JCK/668:
Step 2: The PR fixes the issue on the same machine : Grinder_JCK/672.

Additional test where local repo is already up-to-date: Grinder_JCK/675.

@Mesbah-Alam Mesbah-Alam marked this pull request as ready for review September 27, 2022 20:55
@Mesbah-Alam Mesbah-Alam changed the title Do a hard reset if tck update fails and try update again Do a hard reset if tck update fails and try git pull again Sep 27, 2022
@smlambert
Copy link
Contributor

Verified in TC Grinder/1815

<exec executable="git" dir="${JCK_ROOT_USED}" failonerror="true">
<arg value="reset" />
<arg value="--hard" />
<arg value="origin/master" />
Copy link
Contributor

@llxia llxia Sep 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need to reset to origin/master, then clean and pull again? Could we just hard reset to ${JCK_GIT_REPO_USED} ${jck_branch} directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tried reset --hard ${JCK_GIT_REPO_USED} ${jck_branch} but that didn't seem to work in our case. The change in the PR had worked. I am not sure about the difference. I think we can merge this and see if the problem ever comes back again - if it does we can try other ways.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea what error we get when we do reset --hard ${JCK_GIT_REPO_USED} ${jck_branch}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen the merge conflict remain after reset --hard ${JCK_GIT_REPO_USED} ${jck_branch}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, here origin = {JCK_GIT_REPO_USED}; e.g. Grinder_JCK/672/console. The git clean is just added as an extra step to clean up any possible garbage left behind after the reset.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try just git reset --hard?
I don't really like hardcoding origin/master since those names are not guaranteed. Especially since master is being renamed to main.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try just git reset --hard? - yes, and that did not get rid of the merge conflict.

"Especially since master is being renamed to main." - do you mean in our internal JCK repos?

Copy link
Contributor

@llxia llxia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked with @Mesbah-Alam , we think it is the best solution so far. We will merge it and monitor the result.

@llxia llxia merged commit e04aee4 into adoptium:master Sep 28, 2022
@Mesbah-Alam Mesbah-Alam deleted the fix-jck-update-git-logic branch February 6, 2023 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants