[JIRA] (JENKINS-41090) Roundtrip Jenkinsfile should have nice formatting

1 view
Skip to first unread message

jdumay@cloudbees.com (JIRA)

unread,
Jan 15, 2017, 5:53:01 PM1/15/17
to jenkinsc...@googlegroups.com
James Dumay created an issue
 
Jenkins / Story JENKINS-41090
Roundtrip Jenkinsfile should have nice formatting
Issue Type: Story Story
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Jan/15 10:52 PM
Priority: Minor Minor
Reporter: James Dumay

When this Jenkinsfile is roundtripped

pipeline {
    agent { docker 'java' }
    stages {
        stage ('Build') {
            steps {
              sh 'mvn clean source:jar package'
            }
        }
    }
    post {
        always {
            junit '**/target/surefire-reports/TEST-*.xml'
            archive '**/target/*.jar'
        }
    }
}

Is formatted as:

pipeline {
  agent {
    docker 'java'}
    
    stages {
      stage('Build') {
        steps {
          sh('mvn clean source:jar package')
        }
      }
      
    }
    
    post {
      always {
        junit('**/target/surefire-reports/TEST-*.xml')
        archive('**/target/*.jar')
        
      }
      
    }
    
  }
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

jdumay@cloudbees.com (JIRA)

unread,
Jan 15, 2017, 5:54:02 PM1/15/17
to jenkinsc...@googlegroups.com
James Dumay updated an issue
Change By: James Dumay
When this Jenkinsfile is roundtripped :

{code}

pipeline {
    agent { docker 'java' }
    stages {
        stage ('Build') {
            steps {
              sh 'mvn clean source:jar package'
            }
        }
    }
    post {
        always {
            junit '**/target/surefire-reports/TEST-*.xml'
            archive '**/target/*.jar'
        }
    }
}
{code}

Is formatted as:
{code}

pipeline {
  agent {
    docker 'java'}
    
    stages {
      stage('Build') {
        steps {
          sh('mvn clean source:jar package')
        }
      }
      
    }
    
    post {
      always {
        junit('**/target/surefire-reports/TEST-*.xml')
        archive('**/target/*.jar')
        
      }
      
    }
    
  }
{code}

It would be good to avoid extra new lines and consistently write out brace locations

andrew.bayer@gmail.com (JIRA)

unread,
Jan 15, 2017, 5:56:01 PM1/15/17
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Story JENKINS-41090
 
Re: Roundtrip Jenkinsfile should have nice formatting

Yup, the agent related curly is a definite bug, as are the superfluous newlines.

jdumay@cloudbees.com (JIRA)

unread,
Jan 15, 2017, 7:07:01 PM1/15/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 17, 2017, 1:13:02 PM1/17/17
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Story JENKINS-41090
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Jan 17, 2017, 3:42:02 PM1/17/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 17, 2017, 3:42:02 PM1/17/17
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Jan 19, 2017, 5:51:05 PM1/19/17
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Jan 19, 2017, 5:51:05 PM1/19/17
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Story JENKINS-41090
 
Re: Roundtrip Jenkinsfile should have nice formatting

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTAgent.java
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.java
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStages.java
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.java
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/d255da0cd72c0e20e97a31d0072b3bf7bb35bd50
Log:
[FIXED JENKINS-41090, JENKINS-41089] Groovy serialization cleanup

Get rid of superfluous newlines, make sure we have a newline after
'label "foo"', don't serialize unneeded parentheses for single unnamed
arguments for steps/functions.

scm_issue_link@java.net (JIRA)

unread,
Jan 19, 2017, 5:51:06 PM1/19/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTAgent.java
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.java
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStages.java
pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.java

pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ModelConverterActionStepsTest.java
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/b4d556f9075974bcb93c615cf7f59920e12915ef
Log:
Merge pull request #95 from abayer/jenkins-41090

[FIXED JENKINS-41090, JENKINS-41089] Groovy serialization cleanup

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:57 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages