Skip to content

Conversation

@long76
Copy link

@long76 long76 commented Dec 5, 2025

in current state CloneOptionTrait ignored, this PR allow set depth when you need find branch

Testing done

cheked locally in pipeline with

resolveScm([
        ignoreErrors: false,
        source      : gitSource(
                credentialsId: 'git-cred',
                remote: 'https://....',
                traits: [cloneOption(cloneOption(depth: 1, shallow: true)), gitBranchDiscovery()]
        ),
        targets     : ['main', 'master']
])
17:55:17  Checking for first existing branch from [main, master]...
17:55:17   > git rev-parse --resolve-git-dir /var/jenkins_home/caches/git-xxx/.git # timeout=10
17:55:17  Setting origin to https://site/xxx.git
17:55:17   > git config remote.origin.url https://site/xxx.git # timeout=10
17:55:17  Fetching & pruning origin...
17:55:17  Listing remote references...
17:55:17   > git config --get remote.origin.url # timeout=10
17:55:17   > git --version # timeout=10
17:55:17   > git --version # 'git version 2.52.0'
17:55:17  using GIT_HTTP to set credentials
17:55:17   > git ls-remote -h -- https://site/xxx.git # timeout=10
17:55:17  Fetching upstream changes from origin
17:55:17   > git config --get remote.origin.url # timeout=10
17:55:17  using GIT_HTTP to set credentials
17:55:17   > git fetch --no-tags --force --progress --prune --depth=1 -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
17:55:18  Checking branches...
17:55:18    Checking branch main
17:55:18      Met criteria
17:55:18  Processed 1 branches
17:55:18  Found main at revision xxxx

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@long76 long76 requested a review from a team as a code owner December 5, 2025 14:51
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks! Needs automated tests that confirm the feature works as expected. Needs documentation that describes it so that users have an example they can use.

@long76
Copy link
Author

long76 commented Dec 5, 2025

Needs documentation that describes it so that users have an example they can use.

Pipeline syntax generate code resolveScm with cloneOption trait. Without these chnages trait will be ignored.

@MarkEWaite
Copy link
Contributor

Needs documentation that describes it so that users have an example they can use.

Pipeline syntax generate code resolveScm with cloneOption trait. Without these chnages trait will be ignored.

That is certainly necessary, but I also like to include documentation in the README. People do not always use the syntax generator.

@github-actions github-actions bot added documentation Improvements or additions to documentation tests Automated test addition or improvement labels Dec 7, 2025
@long76 long76 changed the title support decorateContext in CloneOptionTrait implement decorateContext in CloneOptionTrait Dec 7, 2025
@long76 long76 force-pushed the patch-1 branch 4 times, most recently from bedab4f to 9e1906e Compare December 7, 2025 09:59
@long76 long76 requested a review from MarkEWaite December 7, 2025 10:45
@long76
Copy link
Author

long76 commented Dec 7, 2025

Seems it's enough)

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks for adding the documentation. It highlights that the documentation needs a significant addition to describe the differences between a single Pipeline and a Pipeline defined within a multibranch project.

@MarkEWaite
Copy link
Contributor

It is much better for me as a reviewer if you don't force push new changes once we've started reviewing. When a commit is force pushed, the comments may be dissociated from the current push. It is better for me as a reviewer if you push new commits. When the review is complete, it can be squash merged into the master branch before release.

@long76
Copy link
Author

long76 commented Dec 7, 2025

It is much better for me as a reviewer if you don't force push new changes once we've started reviewing. When a commit is force pushed, the comments may be dissociated from the current push. It is better for me as a reviewer if you push new commits. When the review is complete, it can be squash merged into the master branch before release.

i see. will create new commits

@long76 long76 requested a review from MarkEWaite December 7, 2025 15:25
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

I'd prefer to remove the variable.

@long76 long76 requested a review from MarkEWaite December 7, 2025 15:34
@MarkEWaite MarkEWaite added the rfe Improvement or new feature label Dec 7, 2025
@MarkEWaite MarkEWaite changed the title implement decorateContext in CloneOptionTrait Support shallow clone in multibranch Pipeline and resolveScm Dec 7, 2025
@MarkEWaite MarkEWaite removed documentation Improvements or additions to documentation tests Automated test addition or improvement labels Dec 7, 2025
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

I would like to use Java 17 pattern matching instanceof instead of casting the result.

@github-actions github-actions bot added documentation Improvements or additions to documentation tests Automated test addition or improvement labels Dec 7, 2025
@long76 long76 requested a review from MarkEWaite December 7, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation rfe Improvement or new feature tests Automated test addition or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants