Parameters from jobs are stripped
See original GitHub issueYour checklist for this issue
🚨 Please review the guidelines for contributing to this repository.
-
Jenkins version
-
Plugin version
-
OS
Description
Jenkins version: 2.173 Plugin: 1.11 OS: Docker image (FROM jenkins/jenkins)
Hi,
I’m facing an issue with preconfigured jobs. I have written in yaml PipelineJob with parameters, but when I’m trying to use/pass them into job, in Jenkins they are missing. I don’t really know what’s the issue and which part of configuration is failing. Probably Job DSL plugin which I also use is worth to mention here.
Here’s a part of my yaml configuration:
pipelineJob('Ansible-connection-test') {
parameters {
stringParam('HOST', 'defaultHost', 'Enter host from Ansible inventory where job should be executed')
}
definition {
cps {
script("""\
pipeline {
agent any
stages {
stage ('Checkout') {
steps {
git url: 'git@bitbucket.org:myRepo.git', branch: 'master'
}
}
stage ('Deploy') {
steps {
standardAnsibleDeploy([ansiblePlaybook:'tasks/common/listfiles/main.yml', ansibleExtras: '-e host=${HOST}'])
}
}
}
}""".stripIndent())
}
}
}
And here’s the result what’s being visible in Jenkins:
agent any
stages {
stage ('Checkout') {
steps {
git url: 'git@bitbucket.org:szymonpronos/devops.git', branch: 'master'
}
}
stage ('Deploy') {
steps {
standardAnsibleDeploy([ansiblePlaybook:'tasks/common/listfiles/main.yml', ansibleExtras: '-e host='])
}
}
}
}
Did I made something wrong? Any workaround for that? Currently I have to manually correct all pipeline jobs. Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Parameters from original URL stripped after login
If the user is already logged in, all 4 parameters are retained when the user is directed to the new page. If the...
Read more >Links with URL Parameters are stripped when sending to ...
Links with URL Parameters are stripped when sending to EmailMessage Object via API - Salesforce Developer Community.
Read more >bkill command reference - IBM
Sends the specified signal to specified jobs. You can specify either a name, stripped of the SIG prefix (such as KILL ), or...
Read more >Create, run, and manage Databricks Jobs
See Configure JAR job parameters. ... Whitespace is not stripped inside the curly braces, so {{ job_id }} will not be evaluated.
Read more >Ability to add custom parameters without it being part of method
If you take traditional command line interface there are a lot flags like logging level that is nothing to do with job but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, you’re talking about
${HOST}
Your issue could have been more clear. Please read the section Handling Secrets it specifically says you have to escape
${variables}
You should escape like this:
^${HOST}
JCasC is just trying to be helpful 😆
even the ticket is closed, i leave one comment for escaping since someone will googled here like me.
I use helm chart to deploy the jenkins, so it has another layer to escape for this code. which I end with (
\^${computer.jnlpmac}
)