[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Erik Nummela commented on JENKINS-49946 Re: input step cannot access environment blocks This simple pipeline results in values of null where the environment variables should be pipeline { agent any environment { PROJECT = "my-project" } stages { stage('Approval') { input { message "Do you want to release a new version of ${env.PROJECT} to AWS (revision: ${env.GIT_COMMIT})?" ok "Yes, proceed" } steps { echo "Starting to deploy ${env.PROJECT}." } } } } Which produces the following output on approval Do you want to release a new version of null to AWS (revision: null)? Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188938.1520330051000.2673.1557964920352%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Erik Nummela edited a comment on JENKINS-49946 Re: input step cannot access environment blocks This simple pipeline results in values of *null* where the environment variables should be{code:java} pipeline {agent anyenvironment {PROJECT = "my-project"}stages {stage('Approval') {input { message "Do you want to release a new version of ${env.PROJECT} to AWS (revision: ${env.GIT_COMMIT})?" ok "Yes, proceed"}steps { echo "Starting to deploy ${env.PROJECT}."}}}}{code}Which produces the following output on approval invoking the pipeline {code:java}Do you want to release a new version of null to AWS (revision: null)?{code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188938.1520330051000.2680.1557964920443%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Erik Nummela reopened an issue See https://issues.jenkins-ci.org/browse/JENKINS-49946?focusedCommentId=355332=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-355332 Jenkins / JENKINS-49946 input step cannot access environment blocks Change By: Erik Nummela Resolution: Won't Fix Status: Resolved Reopened Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188938.1520330051000.2666.1557964440469%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Erik Nummela assigned an issue to Andrew Bayer Jenkins / JENKINS-49946 input step cannot access environment blocks Change By: Erik Nummela Assignee: ipleten Andrew Bayer Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188938.1520330051000.2660.1557964260297%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Ben Wolin commented on JENKINS-49946 Re: input step cannot access environment blocks I have this problem also. Would really like to have a way to use the environment in inputs Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title I P commented on JENKINS-49946 Re: input step cannot access environment blocks Could this be re-opened and addressed properly, please? Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title I P assigned an issue to I P Jenkins / JENKINS-49946 input step cannot access environment blocks Change By: I P Assignee: Andrew Bayer I P Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Daren Smith commented on JENKINS-49946 Re: input step cannot access environment blocks I'm surprised this issue has been closed. I cannot determine a way to display any dynamic values in the input directive for declarative pipeline. I really like that this has been added, but the inability to use dynamic values in it really limits the usefulness. As other user have stated: A globally scoped environment variable results in null when used A defined groovy string that is overridden in a subsequent stage results in the originally set value The recommendation for a nested stage results in an error because only steps or parallel are allowed keyword in a stage. Changing to stages to parallel allows it to work, but still results in a null value for the env var just as the globally scoped env var did. For now it appears we are stuck utilizing another stage without an agent to get the desired result, but that is not very clean and defeats the purpose that the declarative input directive was meant to solve. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Marc Smith commented on JENKINS-49946 Re: input step cannot access environment blocks Hi Andrew, here is an example pipeline that does NOT work. Please note the environment block is global so it should be available. pipeline { agent any environment { SEM_VER = "1.1.0" } stages { stage('Approval') { input { message "✅ All Unit tests passed, Deploy ${SEM_VER}?" id 'Approve & Deploy Build' } steps { echo 'Deploying the build...' } } } } I get groovy.lang.MissingPropertyException: No such property: SEM_VER for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:264) at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292) at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) at WorkflowScript.run(WorkflowScript:11) at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/var/jenkins_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:59) at WorkflowScript.run(WorkflowScript:1) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58) at
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Andrew Bayer resolved as Won't Fix As I commented above, this is a deliberate decision on ordering - we have chosen to have input process before environment for a stage, because you may want to have the environment reference something in the workspace or something submitted from input. If you need to define a single stage environment variable and reference it in that stage's input, you can wrap the stage inside a parent stage where you define the environment variable, like this: stage("parent") { environment { FOO = "bar" } stages { stage("child") { input { message "Continue with ${FOO}?" } ... } } } Jenkins / JENKINS-49946 input step cannot access environment blocks Change By: Andrew Bayer Status: Open Resolved Resolution: Won't Fix Add Comment
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Andrew Bayer commented on JENKINS-49946 Re: input step cannot access environment blocks Part of this another ordering issue, like JENKINS-49947: either we can have input results available when evaluating its stage's environment or the other way around, but not both. But top-level environment variables should be available to input - that's a bug. Can you provide a simple Jenkinsfile reproducing this? Thanks! Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Andrew Bayer assigned an issue to Andrew Bayer Jenkins / JENKINS-49946 input step cannot access environment blocks Change By: Andrew Bayer Assignee: Andrew Bayer Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Andrew Bayer updated an issue Jenkins / JENKINS-49946 input step cannot access environment blocks Change By: Andrew Bayer Component/s: pipeline-model-definition-plugin Component/s: pipeline Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49946) input step cannot access environment blocks
Title: Message Title Andreas Klemp created an issue Jenkins / JENKINS-49946 input step cannot access environment blocks Issue Type: Bug Assignee: Unassigned Components: pipeline Created: 2018-03-06 09:54 Environment: Jenkins 2.89.4 Labels: pipeline input environment Priority: Minor Reporter: Andreas Klemp The input step in declarative pipeline (JENKINS-48379) cannot access the environment blocks. Thus, dynamic data (e.g. version number) cannot be used in the input dialog. Also defining options in the input and checking the result requires redundant values, because they cannot be reused. Access to $JOB_NAME and ${env.JOB_NAME} is working. Access to $myVar is not working. It leads to a "no such property" exception. It doesn't matter if the variable is declared in the global or stage-local environment block. Access to ${env.myVar} is not working. The value is null. It doesn't matter if the variable is declared in the global or stage-local environment block.