[JIRA] (JENKINS-61047) Matrix: allow to use axis values from variable

10 views
Skip to first unread message

fabian.holler@simplesurance.de (JIRA)

unread,
Feb 11, 2020, 6:10:02 AM2/11/20
to jenkinsc...@googlegroups.com
Fabian Holler created an issue
 
Jenkins / New Feature JENKINS-61047
Matrix: allow to use axis values from variable
Issue Type: New Feature New Feature
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2020-02-11 11:09
Priority: Minor Minor
Reporter: Fabian Holler

Please support to pass in the axis values for matrix builds via a variable.

This would enable to calculate the stages to execute during runtime. This is often needed e.g. when in a monorepository certain stages should only be run for applications that changed in a git commit.

See also: https://issues.jenkins-ci.org/browse/JENKINS-40986?focusedCommentId=381841&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-381841

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

bitwiseman@gmail.com (JIRA)

unread,
Mar 4, 2020, 12:35:04 PM3/4/20
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
Change By: Liam Newman
Please support to pass in the axis values for matrix builds via a variable.

This would enable to calculate the stages to execute during runtime. This is often needed e.g. when in a monorepository certain stages should only be run for applications that changed in a git commit.

See also: https://issues.jenkins-ci.org/browse/JENKINS-40986?focusedCommentId=381841&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-381841

pipeline {
  environment {
     LOW_ERLANG_VER = '19.3.6.8'
     MID_ERLANG_VER = '20.3.8.24'
     HIGH_ERLANG_VER = '22.2'
  }

  stages {
    // ...
    // Other stages that need the values above
    // ...
    stage("Build") {
      matrix {
        axes {
          axis {
            name 'ERLANG_VERSION'
            values "{$env.LOW_ERLANG_VER}", "${env.MID_ERLANG_VER}", "${env.HIGH_ERLANG_VER}"
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

bitwiseman@gmail.com (JIRA)

unread,
Mar 4, 2020, 12:36:03 PM3/4/20
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Mar 4, 2020, 12:36:04 PM3/4/20
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
Please support to pass in the axis values for matrix builds via a variable.

This would enable to calculate the stages to execute during runtime. This is often needed e.g. when in a monorepository certain stages should only be run for applications that changed in a git commit.

See also: https://issues.jenkins-ci.org/browse/JENKINS-40986?focusedCommentId=381841&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-381841

 
{ { code:java}
pipeline {
  environment {
     LOW_ERLANG_VER = '19.3.6.8'
     MID_ERLANG_VER = '20.3.8.24'
     HIGH_ERLANG_VER = '22.2'
  }


  stages {
    // ...
    // Other stages that need the values above
    // ...
    stage("Build") {
      matrix {
        axes {
          axis {
            name 'ERLANG_VERSION'
            values "{$env.LOW_ERLANG_VER}", "${env.MID_ERLANG_VER}", "${env.HIGH_ERLANG_VER}"
}}
{code}

bitwiseman@gmail.com (JIRA)

unread,
Mar 4, 2020, 12:43:02 PM3/4/20
to jenkinsc...@googlegroups.com
Liam Newman commented on New Feature JENKINS-61047
 
Re: Matrix: allow to use axis values from variable

I agree that this would be useful, but there are some technical limitations to consider.

The values in the matrix must be defined at or before the pipeline starts. The matrix structure including stage names needs to be constructed and immutable

This scenarios would be possible for parameters, but would not be guaranteed safe for environment variables. It would work in the example above and as long as the environment variables are literals and are never overridden during the run.
However, these limitations are likely to cause confusion and bad surprises.

wohali@apache.org (JIRA)

unread,
Mar 4, 2020, 1:01:03 PM3/4/20
to jenkinsc...@googlegroups.com
Joan Touzet edited a comment on New Feature JENKINS-61047
That'd be fine by us. Could they be constants - maybe borrowing syntax from Groovy?

{{   }}
{{ final LOW_ERLANG_VER = '19.3.6.8' }}

wohali@apache.org (JIRA)

unread,
Mar 4, 2020, 1:01:03 PM3/4/20
to jenkinsc...@googlegroups.com

wohali@apache.org (JIRA)

unread,
Mar 4, 2020, 1:02:03 PM3/4/20
to jenkinsc...@googlegroups.com
Joan Touzet edited a comment on New Feature JENKINS-61047
That'd be fine by us. Could they be constants - maybe borrowing syntax from Groovy?

{ code:java } }
{{ final LOW_ERLANG_VER = '19.3.6.8'
{code
} }
Reply all
Reply to author
Forward
0 new messages