[JIRA] (JENKINS-52939) Need to lint pipeline from UI, and also parse parameters

1 view
Skip to first unread message

rodrigc@FreeBSD.org (JIRA)

unread,
Aug 8, 2018, 2:04:02 PM8/8/18
to jenkinsc...@googlegroups.com
Craig Rodrigues created an issue
 
Jenkins / Bug JENKINS-52939
Need to lint pipeline from UI, and also parse parameters
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: blueocean-plugin, pipeline-model-definition-plugin
Created: 2018-08-08 18:03
Priority: Major Major
Reporter: Craig Rodrigues

I create a lot of pipelines where I specify the parameters inside the pipeline like this:

 

pipeline {
    agent any;
    parameters {
        string(defaultValue: 'master',
               description: 'Portworx docker tag',
               name: 'BRANCH')
    }
    stages {
        stage("Do stuff") {
            steps {
                sh "echo blah"
            }
        }
    }
} 

 

It would be very handy if:

 

1.  There was a way to invoke the linter for a Pipeline from the classic UI and the blueocean UI.  Right now, this method is a bit clunky to use: https://jenkins.io/doc/book/pipeline/development/#linter

2.  It would be good if there was an option in the classic UI and blueocean UI to Reload or Update a pipeline.  If this option could lint the pipeline, and update the parameters from the pipeline into the job, that would be very useful.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

rodrigc@FreeBSD.org (JIRA)

unread,
Aug 8, 2018, 2:04:02 PM8/8/18
to jenkinsc...@googlegroups.com
Craig Rodrigues updated an issue
Change By: Craig Rodrigues
I create a lot of pipelines where I specify the parameters inside the pipeline like this:

 
{noformat}

pipeline {
    agent any;
    parameters {
        string(defaultValue: 'master',
               description: ' Portworx docker tag SCM branch ',

               name: 'BRANCH')
    }
    stages {
        stage("Do stuff") {
            steps {
                sh "echo blah"
            }
        }
    }
} {noformat}

 

It would be very handy if:

 

1.  There was a way to invoke the linter for a Pipeline from the classic UI and the blueocean UI.  Right now, this method is a bit clunky to use: [https://jenkins.io/doc/book/pipeline/development/#linter]

2.  It would be good if there was an option in the classic UI and blueocean UI to *Reload* or *Update* a pipeline.  If this option could lint the pipeline, and update the parameters from the pipeline into the job, that would be very useful.

rodrigc@FreeBSD.org (JIRA)

unread,
Aug 9, 2018, 2:25:03 PM8/9/18
to jenkinsc...@googlegroups.com
Craig Rodrigues commented on Bug JENKINS-52939
 
Re: Need to lint pipeline from UI, and also parse parameters

From IRC discussion:

https://botbot.me/freenode/jenkins/2018-08-08/?msg=103071157&page=3

10:31 am rodrigc In the UI for a pipeline, if I had a thing to click on like "Update" or "Reload"
10:31 am abayer That's very intriguing.
10:31 am rodrigc which ran the linter, and updated the parameters in the job, that would do mostly what I need
10:31 am abayer That could maybe work.
10:31 am Like, that seems legitimately viable.
10:32 am abayer Hit the button, it'll get the Pipeline script (either from the job config or from SCM), validate it, update job properties (which includes parameters) based on the parsed Pipeline script…it's really plausible. 

rodrigc@FreeBSD.org (JIRA)

unread,
Aug 10, 2018, 4:32:01 AM8/10/18
to jenkinsc...@googlegroups.com

A workaround for this problem is shown here: https://dev.to/pencillr/jenkins-pipelines-and-their-dirty-secrets-2

where you can put the following stage in your pipeline:

 

stages {
        stage("parameterizing") {
            steps {
                script {
                    if ("${params.Invoke_Parameters}" == "Yes") {
                        currentBuild.result = 'ABORTED'
                        error('DRY RUN COMPLETED. JOB PARAMETERIZED.')
                    }
                }
            }
        }
}

 

rodrigc@FreeBSD.org (JIRA)

unread,
Aug 10, 2018, 4:32:02 AM8/10/18
to jenkinsc...@googlegroups.com

It would be good to fix the Jenkins and Blue Ocean UI so as to eliminate the need for this workaround.

rodrigc@FreeBSD.org (JIRA)

unread,
Sep 10, 2018, 12:12:01 AM9/10/18
to jenkinsc...@googlegroups.com

It looks like the Blue Ocean Pipeline Editor has some code which calls the pipeline validation URL:

https://github.com/jenkinsci/blueocean-plugin/blob/master/blueocean-pipeline-editor/src/main/j/services/PipelineValidator.js#L115

 

It would be good if there was a way to call the functions in this code outside of the Pipeline editor.

 

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

rodrigc@FreeBSD.org (JIRA)

unread,
Sep 10, 2018, 12:19:02 AM9/10/18
to jenkinsc...@googlegroups.com
Craig Rodrigues edited a comment on Bug JENKINS-52939
It looks like the Blue Ocean Pipeline Editor has some code which calls the pipeline validation URL:

[  

https://github.com/jenkinsci/blueocean-plugin/blob/ master 1510403599e366d124cce71232cdb3aff5423edd /blueocean-pipeline-editor/src/main/ j js /services/PipelineValidator.js#L115 ]

 

It would be good if there was a way to call the functions in this code outside of the Pipeline editor.

 

kzantow@cloudbees.com (JIRA)

unread,
Sep 14, 2018, 9:00:06 AM9/14/18
to jenkinsc...@googlegroups.com

kzantow@cloudbees.com (JIRA)

unread,
Sep 14, 2018, 9:12:03 AM9/14/18
to jenkinsc...@googlegroups.com

kzantow@cloudbees.com (JIRA)

unread,
Sep 14, 2018, 9:12:06 AM9/14/18
to jenkinsc...@googlegroups.com
Keith Zantow commented on Improvement JENKINS-52939
 
Re: Need to lint pipeline from UI, and also parse parameters

Craig Rodrigues yes, I mentioned there is a validation function already. If you load the editor, you can simply copy/paste a declarative pipeline - E.g. go to http://<jenkins-host>/blue/organizations/jenkins/pipeline-editor/ then press Ctrl-S / Cmd-S on windows/osx to get a text area to paste the pipeline into. It doesn't validate every bit of the pipeline, though, but does a good job of linting it:

kzantow@cloudbees.com (JIRA)

unread,
Sep 14, 2018, 9:15:02 AM9/14/18
to jenkinsc...@googlegroups.com

I'd suggest to add a different ticket for Updating Input Parameters. It's currently a limitation of pipeline itself, nothing to do with blue ocean or jenkins ui per se.

bitwiseman@gmail.com (JIRA)

unread,
Mar 27, 2020, 8:05:03 PM3/27/20
to jenkinsc...@googlegroups.com
Liam Newman updated an issue
 
Change By: Liam Newman
Component/s: blueocean-plugin
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

bitwiseman@gmail.com (JIRA)

unread,
Mar 27, 2020, 8:13:02 PM3/27/20
to jenkinsc...@googlegroups.com
Liam Newman commented on Improvement JENKINS-52939
 
Re: Need to lint pipeline from UI, and also parse parameters

Craig Rodrigues 
I completely agree with what you are asking for here, but this is at least two independent issues.  Both/All  of the issues are valid and worth fixing, but by mushing them together it makes them less well defined and harder to make progress on. Would you mind if we scope this down to just being able to call the linter from the Web UI? 

The problem of "reloading" the pipeline and refreshing parameters is related, but is actually a harder problem to solve. 

rodrigc@FreeBSD.org (JIRA)

unread,
Mar 28, 2020, 5:21:02 PM3/28/20
to jenkinsc...@googlegroups.com

When I originally filed this ticket, I thought Blue Ocean was the future direction of Jenkins.

However, if you can expose a link on the classic UI, where I can just click it and it will run the linter on the
pipeline in the current job, whether it is a Pipeline from SCM, or just a Pipeline,
that would be a huge usability improvement. Liam Newman thanks!

rodrigc@FreeBSD.org (JIRA)

unread,
Mar 28, 2020, 5:22:04 PM3/28/20
to jenkinsc...@googlegroups.com
Craig Rodrigues edited a comment on Improvement JENKINS-52939
When I originally filed this ticket, I thought Blue Ocean was the future direction of Jenkins.

However, if you can expose a link on the classic UI, where I can just click it and it will run the linter on the
pipeline in the current job, whether it is a Pipeline from SCM, or just a Pipeline,
that would be a huge usability improvement.  [~bitwiseman] thanks!

The existing way of invoking the linter is convoluted and confusing!
I can't be bothered to figure out how to do it, and neither can most users of Pipeline.  Make it easier!
Reply all
Reply to author
Forward
0 new messages