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

Round trip should add/retain file header including groovy she-bang ("#!groovy")

      Most of our existing Pipeline examples include a Groovy she-bang at the top. This helps a wide range of editors properly highlight the code in the Jenkinsfile.

      Even if most comments are not retained or supported, a file header with she-bang should be allowed and maintained.

          [JENKINS-43006] Round trip should add/retain file header including groovy she-bang ("#!groovy")

          James Dumay added a comment -

          bitwiseman remember in the eyes of users a Declarative Jenkinsfile is not a "script" and a shebang would be drawing attention to its groovy origins (we've spent a lot of time removing the stink of groovy from declarative).

          If you've added a shebang, I can see how we might want to preserve that for you. Ill let abayer make that call (the roundtrip is actually controlled by declarative itself - not the editor).

          James Dumay added a comment - bitwiseman remember in the eyes of users a Declarative Jenkinsfile is not a "script" and a shebang would be drawing attention to its groovy origins (we've spent a lot of time removing the stink of groovy from declarative). If you've added a shebang, I can see how we might want to preserve that for you. Ill let abayer make that call (the roundtrip is actually controlled by declarative itself - not the editor).

          Andrew Bayer added a comment -

          So we could always output a shebang at the top of the Jenkinsfile, but we can't only do it if there already was one - as with JENKINS-43005, that would need information that just isn't available to us in the parser.

          Andrew Bayer added a comment - So we could always output a shebang at the top of the Jenkinsfile, but we can't only do it if there already was one - as with JENKINS-43005 , that would need information that just isn't available to us in the parser.

          Liam Newman added a comment -

          abayer
          This also means that any Jenkinsfile (like the ones we use in test) that has license header would have it stripped. That's no good.

          Liam Newman added a comment - abayer This also means that any Jenkinsfile (like the ones we use in test) that has license header would have it stripped. That's no good.

          James Dumay added a comment - - edited

          I just know abayer its going to write the worlds second groovy compliant AST parser any day now....

          But seriously, a big she-bang is going to hint at people that this is actually groovy under the hood and its taken a lot of work to wash that stank off.

          Andrew, maybe it would be good to have another ticket describing the need for "preservation of comments" that has a good description on why this is hard and not feasible to do in the short term. Whenever the shebang or comment preservation comes up, you can close it as a duplicate of that ticket. I've done this for JENKINS-38442 and its a proven way of keeping the noise of endless explanations down and lays out quite clearly that people shouldn't hold their breath for this functionality.

          James Dumay added a comment - - edited I just know abayer its going to write the worlds second groovy compliant AST parser any day now.... But seriously, a big she-bang is going to hint at people that this is actually groovy under the hood and its taken a lot of work to wash that stank off. Andrew, maybe it would be good to have another ticket describing the need for "preservation of comments" that has a good description on why this is hard and not feasible to do in the short term. Whenever the shebang or comment preservation comes up, you can close it as a duplicate of that ticket. I've done this for JENKINS-38442 and its a proven way of keeping the noise of endless explanations down and lays out quite clearly that people shouldn't hold their breath for this functionality.

          Andrew Bayer added a comment -

          jamesdumay - such a ticket exists - JENKINS-38864. =) bitwiseman - Yeah, losing the license headers is a shame, but again...limitations of the tooling we have available to work with, and questions of how much value we'd actually get from the amount of research and work needed to be able to deliver.

          Andrew Bayer added a comment - jamesdumay  - such a ticket exists -  JENKINS-38864 . =) bitwiseman - Yeah, losing the license headers is a shame, but again...limitations of the tooling we have available to work with, and questions of how much value we'd actually get from the amount of research and work needed to be able to deliver.

          Andrew Bayer added a comment -

          I'm fleeing as fast as I can from this. =)

          Andrew Bayer added a comment - I'm fleeing as fast as I can from this. =)

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.

            abayer Andrew Bayer
            bitwiseman Liam Newman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: