jenkinsci / plasticscm-plugin

A plugin for Jenkins to be able to use Plastic SCM
MIT License
16 stars 31 forks source link

Version selector with exact changeset only works on first switch #34

Closed ahatala closed 3 years ago

ahatala commented 4 years ago

The plastic CLI client changed to always sync to latest in branch when issuing "cm update" in version 8.0.16.3470. From change log:

[New] 8.0.16.3470
All platforms – Plastic, Gluon, command line: Now update always goes to latest.
Suppose you switched your workspace to a particular changeset, then decided to update. You were stuck on that changeset, by design.
We thought (for a few years already) that if you had switched to a given changeset, why would you want to jump to latest during an update?
But then we realized it was a true UX pain. Why wouldn't you want to switch to latest?
So, we just changed the behaviour. Now, when you update, you'll always go to latest in the branch, even if you were working on a given changeset or label before.

This causes an issue with the jenkins plugin when using an exact changeset selector. The first time an agent switches to the selector everything works ok (selector needs to be rewritten, so no "cm update" is done). If there is another build with the same selector things go badly wrong: a "cm update" is done, so the checkout is synced to the latest in branch. This can easily happen with multi-stage (or parallel) pipeline builds where more than one stage is scheduled to run on the same agent, but for repro purposes it's sufficient to just run a freestyle job with an exact changeset selector two times in a row with a single agent.

ahatala commented 4 years ago

I accidentally discovered a workaround for this that's probably not how the CLI tool is intended to be used but happens to fix the issue for my present needs: https://github.com/jenkinsci/plasticscm-plugin/pull/33.

knapsu commented 3 years ago

Hi @ahatala . Sorry for not writing to you sooner. It seems I was not receiving any notifications from GitHub about pull requests or bug reports. Clicked "Watch everything" so I will not miss those again.

Proper fix for this is being authored in pull request #35.

knapsu commented 3 years ago

Incorrectly closed this issue as I thought it was a pull request. Reopened until PR #35 is merged.