[JIRA] (JENKINS-57930) Pipeline script from SCM does not expand build parameters/env variables for declarative pipeline with yamlFile specified

9 views
Skip to first unread message

hanbingxin49@gmail.com (JIRA)

unread,
Jun 10, 2019, 3:31:02 AM6/10/19
to jenkinsc...@googlegroups.com
jubel han created an issue
 
Jenkins / Bug JENKINS-57930
Pipeline script from SCM does not expand build parameters/env variables for declarative pipeline with yamlFile specified
Issue Type: Bug Bug
Assignee: Carlos Sanchez
Attachments: jks_parameter_branch.png, jks_scm_branch_env.png
Components: kubernetes-plugin
Created: 2019-06-10 07:30
Environment: Jenkins ver. 2.164.3
kubernetes plugin: 1.15.5
pipeline plugin: 2.6
Pipeline declarative plugin: 1.3.8
Labels: declarative-pipeline kubernetes-plugin
Priority: Minor Minor
Reporter: jubel han

Reproduce step:
1. Create a parameterized pipeline job.
2. Add the string parameter called `branch`
2. Configure the pipeline definition to `Get Pipeline script from SCM`.
3. Update the section of `Branches to build` to `*/${branch}` as the parameter added above.
4. Add the following code to the file `Jenkinsfile`.

Unable to find source-code formatter for language: grovvy. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
pipeline {
    agent {
        kubernetes {
            label 'jks-builds'
            yamlFile 'path/to/podTemplate.yaml'
        }
    }

    stages {
        stage('test') {
            steps {
                 echo "test"
        }
    }
}

with the above reproducing steps you will get the following failed messages:

```
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${branch}:refs/remotes/origin/${branch} --prune" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/${branch}
```

however, it works if you remove the directive of `yamlFile` or using the raw yaml string instead.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

hanbingxin49@gmail.com (JIRA)

unread,
Jun 10, 2019, 3:33:03 AM6/10/19
to jenkinsc...@googlegroups.com
jubel han updated an issue
Change By: jubel han
Reproduce step:
1. Create a parameterized pipeline job.
2. Add the string parameter called `branch`
2. Configure the pipeline definition to `Get Pipeline script from SCM`.
3. Update the section of `Branches to build` to `*/${branch}` as the parameter added above.
4. Add the following code to the file `Jenkinsfile`.

{code: grovvy groovy }

pipeline {
    agent {
        kubernetes {
            label 'jks-builds'
            yamlFile 'path/to/podTemplate.yaml'
        }
    }

    stages {
        stage('test') {
            steps {
                 echo "test"
        }
    }
}
{code}


with the above reproducing steps you will get the following failed messages:

```
hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${branch}:refs/remotes/origin/${branch} --prune" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/${branch}
```

however, it works if you remove the directive of `yamlFile` or using the raw yaml string instead.

hanbingxin49@gmail.com (JIRA)

unread,
Jun 10, 2019, 3:34:02 AM6/10/19
to jenkinsc...@googlegroups.com
jubel han updated an issue
Reproduce step:
1. Create a parameterized pipeline job.
2. Add the string parameter called `branch`
2. Configure the pipeline definition to `Get Pipeline script from SCM`.
3. Update the section of `Branches to build` to `*/${branch}` as the parameter added above.
4. Add the following code to the file `Jenkinsfile`.

{code:groovy}

pipeline {
    agent {
        kubernetes {
            label 'jks-builds'
            yamlFile 'path/to/podTemplate.yaml'
        }
    }

    stages {
        stage('test') {
            steps {
                 echo "test"
        }
    }
}
}
{code}

with the above reproducing steps you will get the following failed messages:

{code:java}

hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${branch}:refs/remotes/origin/${branch} --prune" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/${branch}
{code}


however, it works if you remove the directive of `yamlFile` or using the raw yaml string instead.

hanbingxin49@gmail.com (JIRA)

unread,
Jun 10, 2019, 3:34:02 AM6/10/19
to jenkinsc...@googlegroups.com

jenkins-ci@carlossanchez.eu (JIRA)

unread,
Jun 10, 2019, 6:49:02 AM6/10/19
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jul 8, 2019, 2:44:05 PM7/8/19
to jenkinsc...@googlegroups.com
Jesse Glick resolved as Duplicate
Change By: Jesse Glick
Status: Open Resolved
Assignee: Carlos Sanchez
Resolution: Duplicate
Reply all
Reply to author
Forward
0 new messages