Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42999

withCredentials shouldn't require a node context for all possible bindings

    Details

    • Similar Issues:

      Description

      Currently, withCredentials requires a node context to run, regardless of whether the particular binding(s) being used actually need it. Ideally, MultiBinding extensions/implementations would mark that they need a node context (i.e., for a workspace), but since it's already got a defined API, it probably makes more sense to end up marking extensions that don't need a node context, since that won't break any existing extensions. Then BindingStep.Execution can be updated to only error out if there's no node context and one or more of the Binding extensions being used need it.

        Attachments

          Issue Links

            Activity

            Show
            abayer Andrew Bayer added a comment - PR up at  https://github.com/jenkinsci/credentials-binding-plugin/pull/34
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/credentialsbinding/BindingDescriptor.java
            src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep.java
            src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/FileBinding.java
            src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/StringBinding.java
            src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/UsernamePasswordBinding.java
            src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/UsernamePasswordMultiBinding.java
            src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java
            http://jenkins-ci.org/commit/credentials-binding-plugin/44d70a8088c8a75b0639a1c88e0bcb2424d64e15
            Log:
            [FIXED JENKINS-42999] Allow bindings to specify their required context

            Not all bindings require a workspace, and those that don't should be
            able to be used in `withCredentials` outside of a `node` block. This
            adds `BindingDescriptor.getRequiredContext()`, defaulting to the four
            contexts that were previously required by `BindingStep`, but allowing
            override. `BindingStep` will now throw a
            `MissingContextVariableException` if any of the `MultiBinding`s used
            have a required context that cannot be satisfied, as well as the
            normal potential `MissingContextVariableException` for `BindingStep.DescriptorImpl.getRequiredContext()`.

            In addition, bumped `workflow-step-api` to 2.9 and moved `BindingStep`
            and friends to non-deprecated code paths while I was here.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/org/jenkinsci/plugins/credentialsbinding/BindingDescriptor.java src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep.java src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/FileBinding.java src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/StringBinding.java src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/UsernamePasswordBinding.java src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/UsernamePasswordMultiBinding.java src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java http://jenkins-ci.org/commit/credentials-binding-plugin/44d70a8088c8a75b0639a1c88e0bcb2424d64e15 Log: [FIXED JENKINS-42999] Allow bindings to specify their required context Not all bindings require a workspace, and those that don't should be able to be used in `withCredentials` outside of a `node` block. This adds `BindingDescriptor.getRequiredContext()`, defaulting to the four contexts that were previously required by `BindingStep`, but allowing override. `BindingStep` will now throw a `MissingContextVariableException` if any of the `MultiBinding`s used have a required context that cannot be satisfied, as well as the normal potential `MissingContextVariableException` for `BindingStep.DescriptorImpl.getRequiredContext()`. In addition, bumped `workflow-step-api` to 2.9 and moved `BindingStep` and friends to non-deprecated code paths while I was here.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                abayer Andrew Bayer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: