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

Add documentation explaining how to copy a file/folder or run a shell script

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      Looking at the documentation at

      https://www.jenkins.io/doc/book/pipeline/

      It's impossible to know:

      • How to run a shell script.
      • How to copy files and folders around. Possibly using wildcards in shell scripts.
      • How to delete a directory.

      Trying to find out how to do these simple things resulted in a waste of time. Google didn't help either.

      You may probably want to add some simple examples explaining how to do simple tasks (copying files, creating zip files, etc.), what "Jenkins plugins" are, which are the most frequently used ones.

      Documentation says:

      sh is a Pipeline step (provided by the Pipeline: Nodes and Processes plugin) that executes the given shell command.

      But then following the link to the "Pipeline: Nodes and Processes"

      https://plugins.jenkins.io/workflow-durable-task-step/

      the user is miserably abandoned with no documentation at all on how to run a process. This in turn results in thousands of wasted hours around the globe.

       

       

       

        Attachments

          Activity

          Hide
          vieiro Antonio Vieiro added a comment -

          For example, it would be interesting to know that in the following excerpt:

           

          sh 'make test'
          

          The 'make test' string is not the script you want to execute, but the Groovy string representation of the script, which is quite a different beast.

          Since this is not documented there, people document it elsewhere, usually after hours and hours of experimentation, accidental file deletion and wasted computing resources. For an example see

          https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4

           

           

          Show
          vieiro Antonio Vieiro added a comment - For example, it would be interesting to know that in the following excerpt:   sh 'make test' The 'make test' string is not the script you want to execute, but the Groovy string representation of the script , which is quite a different beast. Since this is not documented there, people document it elsewhere, usually after hours and hours of experimentation, accidental file deletion and wasted computing resources. For an example see https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4    
          Hide
          ilatypov Ilguiz Latypov added a comment -

          The "Pipeline Steps Reference" link in the bottom left of the "book" page has this hidden gem,

          Pipeline: Nodes and Processes
          
              bat: Windows Batch Script
              node: Allocate node
              powershell: PowerShell Script
              pwsh: PowerShell Core Script
              sh: Shell Script
              ws: Allocate workspace
          

          I have a strong misunderstanding of the benefits of pausing / unpausing / continuation passing. Additionally, after a year of using Jenkins pipelines, I fail to understand the exact delineation between the server-executed and agent-executed code and environments (and how to reconcile those, and if Jenkins needs simplifying this now).

          But the questions in this ticket betray a lack of Groovy experience on behalf of the submitter. I think it's unfair to blame Jenkins for choosing Groovy considering its heritage.

          Show
          ilatypov Ilguiz Latypov added a comment - The "Pipeline Steps Reference" link in the bottom left of the "book" page has this hidden gem, Pipeline: Nodes and Processes bat: Windows Batch Script node: Allocate node powershell: PowerShell Script pwsh: PowerShell Core Script sh: Shell Script ws: Allocate workspace I have a strong misunderstanding of the benefits of pausing / unpausing / continuation passing. Additionally, after a year of using Jenkins pipelines, I fail to understand the exact delineation between the server-executed and agent-executed code and environments (and how to reconcile those, and if Jenkins needs simplifying this now). But the questions in this ticket betray a lack of Groovy experience on behalf of the submitter. I think it's unfair to blame Jenkins for choosing Groovy considering its heritage.
          Hide
          ilatypov Ilguiz Latypov added a comment -

          "make test" or 'make test' will execute (if the Jenkins agent has sh on PATH). Since the ticket presents conclusions without showing the original problem, this smelled the "X/Y problem" to me. Sorry.

          Show
          ilatypov Ilguiz Latypov added a comment - "make test" or 'make test' will execute (if the Jenkins agent has sh on PATH). Since the ticket presents conclusions without showing the original problem, this smelled the "X/Y problem" to me. Sorry.
          Hide
          ilatypov Ilguiz Latypov added a comment -

          I just discovered a "file operations" plugin available in the Jenkins management page. (I found this ticket by searching for the file copy function in Jenkins).

          https://github.com/jenkinsci/file-operations-plugin/blob/master/docs/JOB-DSL.md

          Show
          ilatypov Ilguiz Latypov added a comment - I just discovered a "file operations" plugin available in the Jenkins management page. (I found this ticket by searching for the file copy function in Jenkins). https://github.com/jenkinsci/file-operations-plugin/blob/master/docs/JOB-DSL.md
          Hide
          vieiro Antonio Vieiro added a comment -

          You just discovered the "file operations" plugin available by looking at Google, as thousands of engineers around the world have.

          If you think https://github.com/jenkinsci/file-operations-plugin/blob/master/docs/JOB-DSL.md is the perfect place to explain how to copy a file with Jenkins then I'm perfectly fine with you closing this issue as "Cannot reproduce" or "I don't care what users's problems" are.

           

          Show
          vieiro Antonio Vieiro added a comment - You just discovered the "file operations" plugin available by looking at Google, as thousands of engineers around the world have. If you think https://github.com/jenkinsci/file-operations-plugin/blob/master/docs/JOB-DSL.md is the perfect place to explain how to copy a file with Jenkins then I'm perfectly fine with you closing this issue as "Cannot reproduce" or "I don't care what users's problems" are.  
          Hide
          didier_c Didier Crest added a comment -

          Hi,

           

          This issue is not resolved.

          At the date of 01/12/2021, the section for sh, bash, bat and others are not in this link https://www.jenkins.io/doc/pipeline/steps/workflow-durable-task-step/ anymore.

          I think there is a problem during webpage generation. Because in the github, the jelly section are present. But not on the official documentation.

          Show
          didier_c Didier Crest added a comment - Hi,   This issue is not resolved. At the date of 01/12/2021, the section for sh, bash, bat and others are not in this link https://www.jenkins.io/doc/pipeline/steps/workflow-durable-task-step/ anymore. I think there is a problem during webpage generation. Because in the github, the jelly section are present. But not on the official documentation.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            vieiro Antonio Vieiro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: