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

Hacktoberfest [JENKINS-69731] Enhance @Library annotation to load same version (feature branch name) of library as pipeline script from SCM #19

Open
wants to merge 78 commits into
base: master
Choose a base branch
from

Commits on Sep 29, 2022

  1. LibraryConfiguration: extend with allowBRANCH_NAME for literal use of…

    … @Library('libname@${BRANCH_NAME}') [JENKINS-69731]
    
    To simplify co-existence of feature-branched pipeline scripts with
    feature-branched Jenkins Shared Libraries, allow literal use of
        @Library('libname@${BRANCH_NAME}') _
    lines to load a variant of a trusted (global) library with one case
    of arbitrary branch naming.
    
    This should be permitted by allowBRANCH_NAME checkbox (independent
    of generic allowVersionOverride setting) in the first place.
    
    If enabled, the value of BRANCH_NAME environment variable set by
    the current build's Run object would be queried, and if resolvable -
    verified with retriever.validateVersion() to match the backend
    (Legacy SCM, Modern SCM, and other retrievers like HTTP/ZIP from
    workflow-cps-global-lib-http-plugin).
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    a937477 View commit details
    Browse the repository at this point in the history
  2. LibraryConfigurationTest.java: add tests for LibraryConfiguration.def…

    …aultedVersion() for JENKINS-69731 related behaviors
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    15a252a View commit details
    Browse the repository at this point in the history
  3. SCMSourceRetrieverTest.java: add checkDefaultVersion() for interactio…

    …ns with BRANCH_NAME [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    bf228e4 View commit details
    Browse the repository at this point in the history
  4. SCMSourceRetrieverTest: checkDefaultVersion(): also test non-checkout…

    … of an absent libname@bogusbranch
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    61db728 View commit details
    Browse the repository at this point in the history
  5. LibraryConfiguration: extend with allowBRANCH_NAME_PR to let CHANGE_B…

    …RANCH and CHANGE_TARGET be considered as fallbacks [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    2e3c855 View commit details
    Browse the repository at this point in the history
  6. LibraryConfiguration: defaultedVersion(): for WorkflowRun check getSC…

    …Ms() and handle if it is GitSCM with branches, before looking at envvars [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    0f89b22 View commit details
    Browse the repository at this point in the history
  7. LibraryConfiguration: defaultedVersion(): check for BRANCH_NAME first…

    …; and then it is safer to check getSCMs() not for WorkflowRun, but for the FlowDefinition from WorkflowJob [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    cf3d140 View commit details
    Browse the repository at this point in the history
  8. SCMSourceRetrieverTest: rename checkDefaultVersion() to checkDefaultV…

    …ersionStaticStrings() and limit influence of caller-defined BRANCH_NAME [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    eb73ce4 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3ef66ae View commit details
    Browse the repository at this point in the history
  10. SCMSourceRetrieverTest.java: add checkDefaultVersion_MBP() and checkD…

    …efaultVersion_BRANCH_NAME_notAllowed() cases [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    7ddf8e6 View commit details
    Browse the repository at this point in the history
  11. SCMSourceRetrieverTest.java: optimize tests using MBP to not build sa…

    …me jobs twice [JENKINS-69731]
    jimklimov committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    4f792f6 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    9d95881 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    0694dd1 View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2022

  1. Configuration menu
    Copy the full SHA
    824a204 View commit details
    Browse the repository at this point in the history
  2. SCMSourceRetrieverTest.java: add PoC checkDefaultVersion_MBP_singleBr…

    …anch() - Need help setting up MBP+SingleSCMSource [JENKINS-69731]
    jimklimov committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    553aba3 View commit details
    Browse the repository at this point in the history
  3. LibraryConfiguration: add optional traceBRANCH_NAME toggle, and lots …

    …of trace info about decision making [JENKINS-69731]
    jimklimov committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    bcba445 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6b5255c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a661a13 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9700565 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    30d21b9 View commit details
    Browse the repository at this point in the history
  8. SCMSourceRetrieverTest: separate checkDefaultVersion_inline_BRANCH_NA…

    …ME() from checkDefaultVersion_inline_staticStrings() [JENKINS-69731]
    jimklimov committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    34718a4 View commit details
    Browse the repository at this point in the history
  9. SCMSourceRetrieverTest: add checkDefaultVersion_MBPsingleBranch_BRANC…

    …H_NAME() [JENKINS-69731]
    jimklimov committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    8e92f64 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5dc85dd View commit details
    Browse the repository at this point in the history
  11. SCMSourceRetrieverTest: checkDefaultVersion_inline_BRANCH_NAME(): tes…

    …t that many @Library lines do not confuse list of SCMs for BRANCH_NAME resolution [JENKINS-69731]
    jimklimov committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    a9aa8f1 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    418c572 View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2022

  1. LibraryConfiguration: defaultedVersion(): add allowVersionEnvvar for …

    …@Library('libname@${env.VARNAME}') support [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    54bb3e9 View commit details
    Browse the repository at this point in the history
  2. SCMSourceRetrieverTest: add PoC for checkDefaultVersion_inline_allowV…

    …ersionEnvvar() [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    d47dad5 View commit details
    Browse the repository at this point in the history
  3. help-allowVersionEnvvar.html, help-allowBRANCH_NAME.html: stress that…

    … "Tokens spelled in @Library annotation are not Groovy variables!" [JENKINS-69731]
    
    ...however for simplicity of "naive use" without knowledge of
    the feature added with JENKINS-69731, the markup used for these
    semi-variable version specifications is intentionally similar
    to what "real" Groovy coders would use in their pipeline scripts.
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    811fb82 View commit details
    Browse the repository at this point in the history
  4. SCMSourceRetrieverTest: add checkDefaultVersion_singleBranch_BRANCH_N…

    …AME_doubleQuotes() [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    43d45b8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    38f380f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    68902fd View commit details
    Browse the repository at this point in the history
  7. SCMSourceRetrieverTest: make checkDefaultVersion_inline_allowVersionE…

    …nvvar() useful for at least one realistic use-case [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    dddd3ac View commit details
    Browse the repository at this point in the history
  8. LibraryConfiguration: defaultedVersion(): if there were no SCMs assoc…

    …iated with FlowDefinition of a WorkflowJob, ask in the WorkflowJob itself for completeness [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    48ad0fe View commit details
    Browse the repository at this point in the history
  9. SCMSourceRetrieverTest: extend checkDefaultVersion_inline_allowVersio…

    …nEnvvar() attempts for better test coverage [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    eeba94c View commit details
    Browse the repository at this point in the history
  10. LibraryConfiguration: defaultedVersion(): first check if WorkflowJob …

    …has a BranchJobProperty, then envvar and then associated SCMs [JENKINS-69731]
    jimklimov committed Oct 1, 2022
    Configuration menu
    Copy the full SHA
    ee36d66 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2022

  1. SCMSourceRetrieverTest: checkDefaultVersion_MBPsingleBranch_*(): try …

    …mbp.save() [JENKINS-69731]
    jimklimov committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    83cea07 View commit details
    Browse the repository at this point in the history
  2. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): let devs easily tinker on currently failing part of test setup [JENKINS-69731]
    
    This keeps build requirements and imports in the loop, so compilers and
    IDEs do not complain or optimize away "unused" lines.
    jimklimov committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    cf2c069 View commit details
    Browse the repository at this point in the history
  3. LibraryConfiguration: refactor irky defaultedVersionSCM() helper out …

    …of defaultedVersion() [JENKINS-69731]
    jimklimov committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    6d74aea View commit details
    Browse the repository at this point in the history
  4. LibraryConfiguration and tests: rename traceBRANCH_NAME to more gener…

    …ic and camel-cased traceDefaultedVersion [JENKINS-69731]
    jimklimov committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    6097f6a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    85e96e3 View commit details
    Browse the repository at this point in the history
  6. SCMSourceRetrieverTest: complete the checkDefaultVersion_MBPsingleBra…

    …nch_*() cases [JENKINS-69731]
    jimklimov committed Oct 2, 2022
    Configuration menu
    Copy the full SHA
    4ce1164 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2022

  1. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): add some debug traces [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    ce8b820 View commit details
    Browse the repository at this point in the history
  2. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): add FreeStyle test line for ideas about building on an agent [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    2d4bd48 View commit details
    Browse the repository at this point in the history
  3. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): add envvar injection tests with EnvironmentContributor [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    6767dc2 View commit details
    Browse the repository at this point in the history
  4. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): update comments [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    edd1ddb View commit details
    Browse the repository at this point in the history
  5. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): drop attempts with envinject [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    5190214 View commit details
    Browse the repository at this point in the history
  6. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): add back ecOrig to ecList [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    06a3e09 View commit details
    Browse the repository at this point in the history
  7. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): WorkflowRun only accepts injected envvars if global config does not override them [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    f4c53c7 View commit details
    Browse the repository at this point in the history
  8. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): un-block test with injected envvars [JENKINS-69731]
    jimklimov committed Oct 9, 2022
    Configuration menu
    Copy the full SHA
    d529421 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2022

  1. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): tag debug printouts with build number [JENKINS-69731]
    jimklimov committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    71c51c8 View commit details
    Browse the repository at this point in the history
  2. SCMSourceRetrieverTest: checkDefaultVersion_inline_allowVersionEnvvar…

    …(): play with "built-in" node envvars [JENKINS-69731]
    jimklimov committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    9e20d78 View commit details
    Browse the repository at this point in the history
  3. SCMSourceRetrieverTest: drop separate checkDefaultVersion_inline_allo…

    …wVersionEnvvar_builtIn() [JENKINS-69731]
    jimklimov committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    3cb60c0 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2022

  1. SCMSourceRetrieverTest: add checkDefaultVersion_singleBranch_BRANCH_N…

    …AME_after_staticStrings() for some TDD [JENKINS-69731]
    jimklimov committed Oct 13, 2022
    Configuration menu
    Copy the full SHA
    ba01128 View commit details
    Browse the repository at this point in the history
  2. LibraryConfiguration: defaultedVersionSCM(): avoid WorkflowJob.getSCM…

    …s(), it does not give the answers we are looking for
    jimklimov committed Oct 13, 2022
    Configuration menu
    Copy the full SHA
    863b170 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    dea552f View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2022

  1. Configuration menu
    Copy the full SHA
    70b029c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    786092d View commit details
    Browse the repository at this point in the history
  3. SCMSourceRetrieverTest: refactor new tests with sampleRepo1Content*()…

    … helpers [JENKINS-69731]
    jimklimov committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    be0c051 View commit details
    Browse the repository at this point in the history
  4. SCMSourceRetrieverTest: clarify in surefire log that checkoutDirector…

    …iesAreNotReusedByDifferentScms() is skipped on Windows
    jimklimov committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    d67c2d1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    db74431 View commit details
    Browse the repository at this point in the history
  6. SCMSourceRetrieverTest.java: add checkDefaultVersion_singleBranch_BRA…

    …NCH_NAME_lightweight() [JENKINS-69731]
    jimklimov committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    812d12d View commit details
    Browse the repository at this point in the history
  7. LibraryConfiguration.java: defaultedVersionSCM(): avoid get()ing from…

    … empty array [JENKINS-69731]
    jimklimov committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    6ab574a View commit details
    Browse the repository at this point in the history
  8. LibraryConfiguration.java: defaultedVersionSCM(): check for nuances o…

    …f CpsScmFlowDefinition [JENKINS-69731]
    jimklimov committed Oct 17, 2022
    Configuration menu
    Copy the full SHA
    2d098a5 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2022

  1. LibraryConfiguration.java: further refactor defaultedVersionSCM() to …

    …separate extractDefaultedVersionGitSCM() hack in a scalable manner [JENKINS-69731]
    jimklimov committed Oct 18, 2022
    Configuration menu
    Copy the full SHA
    6379716 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ac9f40a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b95c46a View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2022

  1. LibraryConfiguration.java: extractDefaultedVersionSCMFS(): avoid redu…

    …ndant null-checks (spotbugs) [JENKINS-69731]
    jimklimov committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    a943713 View commit details
    Browse the repository at this point in the history
  2. LibraryConfiguration.java: extractDefaultedVersionSCMFS(): placeholde…

    …r to get runVersion from SCMHead (needs practical confirmation) [JENKINS-69731]
    jimklimov committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    d039e50 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2022

  1. Configuration menu
    Copy the full SHA
    48548ae View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2023

  1. Configuration menu
    Copy the full SHA
    5ab9713 View commit details
    Browse the repository at this point in the history

Commits on Apr 21, 2023

  1. Configuration menu
    Copy the full SHA
    65a7d02 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2023

  1. Configuration menu
    Copy the full SHA
    c2cf4b5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6668195 View commit details
    Browse the repository at this point in the history
  3. SCMSourceRetrieverTest: provide directly a sampleRepoNotifyCommit() t…

    …o work around some GitSampleRepoRule.notifyCommit() issue
    jimklimov committed Aug 26, 2023
    Configuration menu
    Copy the full SHA
    c1082b9 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Configuration menu
    Copy the full SHA
    02cf65b View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2023

  1. Configuration menu
    Copy the full SHA
    7926f8c View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2024

  1. Configuration menu
    Copy the full SHA
    7329664 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2024

  1. Configuration menu
    Copy the full SHA
    b8c4a88 View commit details
    Browse the repository at this point in the history