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

Allow Workflow Snippet Generator to be used outside of a configuration page

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline

      A user should have a way of accessing the Workflow Snippet Generator without having to create a job. At least, it would be useful to be able to link to a functional Workflow Snippet Generator. Since the available snippets may vary depending on the plugins installed, this is something that needs an active Jenkins instance. Perhaps the scripts could be stored in a shared location that could later be accessed by jobs.

          [JENKINS-31831] Allow Workflow Snippet Generator to be used outside of a configuration page

          Jesse Glick added a comment -

          I do not think it is unreasonable to ask the user to create something Workflow-related to get a GUI link to the page where the tool may be found, but it need not be configure of a WorkflowJob; could also offer it from the configuration screens of multibranch workflows and organization folders using the Jenkinsfile recognizer.

          I would propose just having a top-level page, with a link exposed in various places that opens it in another browser tab, rather than displaying inline in the job configuration screen as is done today. (CJE users also get it in Workflow template transformers.)

          Jesse Glick added a comment - I do not think it is unreasonable to ask the user to create something Workflow-related to get a GUI link to the page where the tool may be found, but it need not be configure of a WorkflowJob ; could also offer it from the configuration screens of multibranch workflows and organization folders using the Jenkinsfile recognizer. I would propose just having a top-level page, with a link exposed in various places that opens it in another browser tab, rather than displaying inline in the job configuration screen as is done today. (CJE users also get it in Workflow template transformers.)

          Patrick Wolf added a comment -

          Would this also include links to the DSL Reference and .gdsl file? jglick

          Patrick Wolf added a comment - Would this also include links to the DSL Reference and .gdsl file? jglick

          Jesse Glick added a comment -

          hrmpw yes this keeps all that functionality in one place.

          Jesse Glick added a comment - hrmpw yes this keeps all that functionality in one place.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition.java
          src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java
          src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/SidepanelAction/action.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslHelp.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReference.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReferenceContent.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/help.html
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/html.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/sidepanel.jelly
          src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/f3958997d201d39a952c6572eb623a8730b822d7
          Log:
          JENKINS-31831 Make Snippetizer UI be displayed in a top-level page.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition.java src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/SidepanelAction/action.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslHelp.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReference.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReferenceContent.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/help.html src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/html.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/sidepanel.jelly src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/f3958997d201d39a952c6572eb623a8730b822d7 Log: JENKINS-31831 Make Snippetizer UI be displayed in a top-level page.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/SidepanelAction/action.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/sidepanel.jelly
          http://jenkins-ci.org/commit/workflow-cps-plugin/d08694dba1b3317298f9879aa67f8228f6120495
          Log:
          JENKINS-31831 Rendering content from PerJobAction so we get the correct ancestors in our path.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/SidepanelAction/action.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/sidepanel.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/d08694dba1b3317298f9879aa67f8228f6120495 Log: JENKINS-31831 Rendering content from PerJobAction so we get the correct ancestors in our path.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition.java
          src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java
          src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslHelp.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReference.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReferenceContent.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/help.html
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/help.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/html.groovy
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/sidepanel.jelly
          src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
          http://jenkins-ci.org/commit/workflow-cps-plugin/55f8ca739f1941215af95db585682b7cdb3dd236
          Log:
          Merge pull request #12 from jglick/Snippetizer-JENKINS-31831

          [FIXED JENKINS-31831] Make Snippetizer UI be displayed in a top-level page

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/891a1bd99a42...55f8ca739f19

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition.java src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslHelp.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReference.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/dslReferenceContent.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/help.html src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/help.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/html.groovy src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/sidepanel.jelly src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/55f8ca739f1941215af95db585682b7cdb3dd236 Log: Merge pull request #12 from jglick/Snippetizer- JENKINS-31831 [FIXED JENKINS-31831] Make Snippetizer UI be displayed in a top-level page Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/891a1bd99a42...55f8ca739f19

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProject.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/SCMBinder/config.jelly
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/6dd84f615efda6ccf826f328e553d16ccf4d260f
          Log:
          JENKINS-31831 Show Pipeline Groovy link on Pipeline multibranch projects and organization folders.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProject.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/SCMBinder/config.jelly http://jenkins-ci.org/commit/workflow-multibranch-plugin/6dd84f615efda6ccf826f328e553d16ccf4d260f Log: JENKINS-31831 Show Pipeline Groovy link on Pipeline multibranch projects and organization folders.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProject.java
          src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory.java
          src/main/resources/org/jenkinsci/plugins/workflow/multibranch/SCMBinder/config.jelly
          http://jenkins-ci.org/commit/workflow-multibranch-plugin/4524135f0a935f454eaffb3374b7b7d7d19d2674
          Log:
          Merge pull request #9 from jglick/Snippetizer-JENKINS-31831

          JENKINS-31831 Show Pipeline Groovy link on multibranch projects

          Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/651b56627a5e...4524135f0a93

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProject.java src/main/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectFactory.java src/main/resources/org/jenkinsci/plugins/workflow/multibranch/SCMBinder/config.jelly http://jenkins-ci.org/commit/workflow-multibranch-plugin/4524135f0a935f454eaffb3374b7b7d7d19d2674 Log: Merge pull request #9 from jglick/Snippetizer- JENKINS-31831 JENKINS-31831 Show Pipeline Groovy link on multibranch projects Compare: https://github.com/jenkinsci/workflow-multibranch-plugin/compare/651b56627a5e...4524135f0a93

          squalou jenkins added a comment - - edited

          Guys, seriously, now when actually writing a job, we can't access the snippet generator in the same place ?
          and this is supposed ti be better ?

          Come on, switching tab/windows for copy / paste, are you kidding ?

          now, to access it, I need to have a pipeline job all the same (go wonder why), but I can't properly use it when editing the job. Well done.
          (sorry but I'm a bit furious here).

          I have 2 usecases to expose you :

          • : edit scripts inside the job. Then, the snippet generator as before was just perfect. Now it's a pain to use.
          • : edit a .groovy file stored on a scm, outside jenkins. For this, a snippet generator outside any job would be helpful. It's slightly better now (no need to edit an actual job), but still requires a job to exist (which is not the case when you build your jobs from DSL for instance)

          I hesitate to reopen this one / open another ticket, because I can't see any situation for which it's better now than it was.

          squalou jenkins added a comment - - edited Guys, seriously, now when actually writing a job, we can't access the snippet generator in the same place ? and this is supposed ti be better ? Come on, switching tab/windows for copy / paste, are you kidding ? now, to access it, I need to have a pipeline job all the same (go wonder why), but I can't properly use it when editing the job. Well done. (sorry but I'm a bit furious here). I have 2 usecases to expose you : : edit scripts inside the job. Then, the snippet generator as before was just perfect. Now it's a pain to use. : edit a .groovy file stored on a scm, outside jenkins. For this, a snippet generator outside any job would be helpful. It's slightly better now (no need to edit an actual job), but still requires a job to exist (which is not the case when you build your jobs from DSL for instance) I hesitate to reopen this one / open another ticket, because I can't see any situation for which it's better now than it was.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly
          http://jenkins-ci.org/commit/workflow-cps-plugin/c8319cede23d31fc09e467f7b22e7836b273634f
          Log:
          JENKINS-31831 Amendment to display a link in the config form, since Jenkins 2 suppresses the sidepanel on configure.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/c8319cede23d31fc09e467f7b22e7836b273634f Log: JENKINS-31831 Amendment to display a link in the config form, since Jenkins 2 suppresses the sidepanel on configure.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly
          src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly
          http://jenkins-ci.org/commit/workflow-cps-plugin/bf459ff0487f86d2e581e2ac15ee6bca5a2c9637
          Log:
          Merge pull request #13 from jglick/Snippetizer-link-JENKINS-31831

          JENKINS-31831 Amendment to display a link in the config form

          Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/7d9e3b2024b9...bf459ff0487f

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition/config.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/bf459ff0487f86d2e581e2ac15ee6bca5a2c9637 Log: Merge pull request #13 from jglick/Snippetizer-link- JENKINS-31831 JENKINS-31831 Amendment to display a link in the config form Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/7d9e3b2024b9...bf459ff0487f

          Andrew Melo added a comment -

          I hit the same issue as squalou. It's nice to have the snippet generator outside of a configuration page, but having it next to the actual configuration box was much more convenient to use. Is there any reason it can't be at both locations?

          Andrew Melo added a comment - I hit the same issue as squalou . It's nice to have the snippet generator outside of a configuration page, but having it next to the actual configuration box was much more convenient to use. Is there any reason it can't be at both locations?

          Greg Smith added a comment -

          Could someone associated with this bug give the new url path to get to the snippet generator? Or path through the front page UI to get there?

          With this change in, I can't seem to find the snippet generator anywhere – now that its been removed from the new job page, should it be somewhere else now?

          Greg Smith added a comment - Could someone associated with this bug give the new url path to get to the snippet generator? Or path through the front page UI to get there? With this change in, I can't seem to find the snippet generator anywhere – now that its been removed from the new job page, should it be somewhere else now?

          Mike Kobit added a comment -

          gregcovertsmith It looks like you go to `/pipeline-syntax` - that is the only place I found it. `http://jenkins/job/job-name/pipeline-syntax`

          Mike Kobit added a comment - gregcovertsmith It looks like you go to `/pipeline-syntax` - that is the only place I found it. ` http://jenkins/job/job-name/pipeline-syntax `

          squalou jenkins added a comment - - edited

          gregcovertsmith : other path to access it, from a 'pipeline job', there's a new item on the 'menu' on the top left (under new item, people,build history etc.) called 'Pipeline Syntax'.

          squalou jenkins added a comment - - edited gregcovertsmith : other path to access it, from a 'pipeline job', there's a new item on the 'menu' on the top left (under new item, people,build history etc.) called 'Pipeline Syntax'.

          Greg Smith added a comment -

          Thanks guys - I was able to find the new link.

          I did open a new related bug to this one, as the links are only shown to users who have permissions to edit the configuration of the project. I believe as they are doc references, they should be available to read users of the project.

          https://issues.jenkins-ci.org/browse/JENKINS-36047

          Greg Smith added a comment - Thanks guys - I was able to find the new link. I did open a new related bug to this one, as the links are only shown to users who have permissions to edit the configuration of the project. I believe as they are doc references, they should be available to read users of the project. https://issues.jenkins-ci.org/browse/JENKINS-36047

            jglick Jesse Glick
            kzantow Keith Zantow
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: