opendevstack / ods-jenkins-shared-library

Shared Jenkins library which all ODS projects & components use - provisioning, SonarQube code scanning, Nexus publishing, OpenShift template based deployments and repository orchestration
Apache License 2.0
70 stars 57 forks source link

Release manager workspace checkout sits on stale data (e.g. deleted tags) #855

Open clemensutschig opened 2 years ago

clemensutschig commented 2 years ago

https://github.com/opendevstack/ods-jenkins-shared-library/blob/master/vars/odsOrchestrationPipeline.groovy#L69-L75

this creates a LOT of problems - e.g. if you remove a tag in bitbucket - and it's left here - it will be pushed back later by

https://github.com/opendevstack/ods-jenkins-shared-library/blob/master/src/org/ods/services/GitService.groovy#L238

We should alwys and only use git as the source of truth

@michaelsauter - was there any reason to not do this? @metmajer fyi - this is the reason why one cannot cleanup doc history

michaelsauter commented 2 years ago

@clemensutschig I cannot remember any situation in which we did not want to clean before checkout. So if cleanup does not happen, I would say it is a bug.

However, the code piece you link calls https://github.com/opendevstack/ods-jenkins-shared-library/blob/master/src/org/ods/services/GitService.groovy#L168-L197, right? That seems to do CleanBeforeCheckout ...

clemensutschig commented 2 years ago

hmm - you are right @michaelsauter - it's weird because e.g. tags that are removed in bitbucket - are still there on every new run .. which is no good ... other ideas? :(

clemensutschig commented 2 years ago

from https://www.jenkins.io/doc/pipeline/steps/workflow-scm-step/ - maybe

$class: 'PruneStaleBranch'
Run "git remote prune" for each remote, to prune obsolete local branches.

and

pruneTags

I am confused why this is NOT happening by default ...

metmajer commented 2 years ago

@clemensutschig @michaelsauter can you add a bit more transparency for me and my team members? I am a bit lost.

metmajer commented 2 years ago

@clemensutschig I need to understand effect and cause rather quickly. Let’s spend a bit on Monday

clemensutschig commented 2 years ago

At least tags that are removed in bitbucket are not cleaned on checkout/clone - the impact is that pushing will recreate them in bitbucket based on this stale data in 'workspace' - the other piece I am worried about is branches that were created and not pushed because of errors and are then pushed later with "intermediate" commits from an earlier run