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

matrix does not set variables properly

XMLWordPrintable

      I have got a pipeline, which builds packages for CentOS 8 and CentOS 9 distros. After building package pipleline should upload them to proper repository. Below piece of pipeline code:{}

      {}
      {}        stage("Upload packages") {
                  matrix {
                      axes {
                          axis {
                              name 'CentOS'
                              values 'centos-stream+epel-8-x86_64.cfg', 'centos-stream+epel-9-x86_64.cfg'

      {\{                    }}} {\{                }}}
                      stages("") {
                          stage("Upload RPM package to repository") {
                              steps {
                                  sh "mock -r /etc/mock/${CentOS} --no-clean --enable-network --shell – curl -m 60 -v -u ${NEXUS_CREDS_USR}:${NEXUS_CREDS_PSW} --upload-file /builddir/build/RPMS/*.${env.X_ARCH}.rpm ${env.X_PKG_SUPP_REPO}/repository/emp-sup/\$(rpm --eval %{centos}/%{_arch})/" {\{                        }}}{{                    }

      }}

      {\{                }

      }}

      {\{            }

      }}

      {\{        }

      }}

      Packages should be uploaded to a proper repository uri, which is constructed from output taken from executed commands in these building environments. Each time, when I execute this pipeline, I have got this:

      [2023-05-18T13:04:38.477Z] ++ rpm --eval '%{centos}/%{_arch}' [2023-05-18T13:04:38.478Z] + mock -r /etc/mock/centos-stream+epel-8-x86_64.cfg --no-clean --enable-network --shell – curl -m 60 -v -u **** --upload-file '/builddir/build/RPMS/.x86_64.rpm' http://nexus.loc:8081/repository/sup/8/x86_64/ [2023-05-18T13:04:38.507Z] ++ rpm --eval '%{centos}/%{_arch}' [2023-05-18T13:04:38.507Z] + mock -r /etc/mock/centos-stream+epel-9-x86_64.cfg --no-clean --enable-network --shell – curl -m 60 -v -u **** --upload-file '/builddir/build/RPMS/.x86_64.rpm' http://nexus.loc:8081/repository/sup/8/x86_64/

       

      Commands are executing according to environment, but I got always the same uri:
      http://nexus.loc:8081/repository/sup/8/x86_64/

      But I expected to get this for CentOS 8:
      http://nexus.loc:8081/repository/sup/8/x86_64/

      And this for CentOS 9:

      http://nexus.loc:8081/repository/sup/9/x86_64/

      {{}}

       
      Jenkins 2.405
       

            Unassigned Unassigned
            andyc Andrew
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: