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

SimpleBuildStep to receive EnvVars

    Details

    • Similar Issues:

      Description

      SimpleBuildStep.perform needs to be given an EnvVars argument. Otherwise there is no way for an implementation to observe any local environment variable settings.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            This is blocking our company from …

            If you implement Step directly there are no restrictions.

            Could the solution be as easy as …

            No, that is not how it would work.

            Show
            jglick Jesse Glick added a comment - This is blocking our company from … If you implement Step directly there are no restrictions. Could the solution be as easy as … No, that is not how it would work.
            Hide
            dbrooks David Brooks added a comment -

            Jesse Glick The header of our class is

            public class IntrepidBuilder extends Builder implements SimpleBuildStep

            since we want our plugin to be compatible with both Freestyle and Pipelines. How might we update this to still allow the end user to use the "pipeline syntax generator" to call our build step?

            Show
            dbrooks David Brooks added a comment - Jesse Glick The header of our class is public class IntrepidBuilder extends Builder implements SimpleBuildStep since we want our plugin to be compatible with both Freestyle and Pipelines. How might we update this to still allow the end user to use the "pipeline syntax generator" to call our build step?
            Hide
            jglick Jesse Glick added a comment -

            Currently if you want to access environment variables, you cannot; you must implement Step instead.

            Show
            jglick Jesse Glick added a comment - Currently if you want to access environment variables, you cannot; you must implement Step instead.
            Hide
            jeremym Jeremy Marshall added a comment -

            How come the CHANGE_URL env variable is defined in multi-branch pipeline jobs (PRs) and this is accessible by adding to a publish/post step

            public boolean prepare(final Run<?, ?> run) {
            Map<String, String> env = null;
            try {
                env = getEnvironment(run, new LogTaskListener(LOGGER, Level.INFO));
                env.forEach((k, v) -> log("key: " + k + " value:" + v)); 
                .
                .
                .

            but GIT_URL and GIT_BRANCH is not?

            I'm trying to push from the warnings post step to the PR in Github. So far I can do it from a freestyle job and a PR in a multi branch pipeline but not in a standard pipeline, mainly because I can't derive the github url or github branch

             

            Show
            jeremym Jeremy Marshall added a comment - How come the CHANGE_URL env variable is defined in multi-branch pipeline jobs (PRs) and this is accessible by adding to a publish/post step public boolean prepare( final Run<?, ?> run) { Map< String , String > env = null ; try { env = getEnvironment(run, new LogTaskListener(LOGGER, Level.INFO)); env.forEach((k, v) -> log( "key: " + k + " value:" + v)); . . . but GIT_URL and GIT_BRANCH is not? I'm trying to push from the warnings post step to the PR in Github. So far I can do it from a freestyle job and a PR in a multi branch pipeline but not in a standard pipeline, mainly because I can't derive the github url or github branch  
            Hide
            jglick Jesse Glick added a comment -

            Jeremy Marshall CHANGE_URL is defined in branch-api. GIT_URL etc. are map keys in the return value of git / checkout, done in JENKINS-26100.

            Show
            jglick Jesse Glick added a comment - Jeremy Marshall CHANGE_URL is defined in branch-api . GIT_URL etc. are map keys in the return value of git / checkout , done in JENKINS-26100 .

              People

              • Assignee:
                Unassigned
                Reporter:
                jglick Jesse Glick
              • Votes:
                3 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated: