jx convert jenkinsfile is a plugin for Jenkins X to assist in converting from the legacy
Jenkinsfile-based pipelines to the modern jenkins-x.yml-based pipelines. It will attempt to convert an existing
Jenkinsfile into the equivalent jenkins-x.yml in the same directory, letting the user know if there are parts
of the existing Jenkinsfile which cannot be converted.
Directives in the Jenkinsfile which cannot be automatically converted will be noted in the jenkins-x.yml with
comments showing the Jenkinsfile snippet, and steps which cannot be converted will be noted with comments and
replaced by echo ... && exit 1 in the actual pipeline execution.
If the Jenkinsfile contains code outside of the pipeline { ... } block, or unknown Declarative directives,
jx convert jenkinsfile will exit with an error.
Installation
Download the jx-convert-jenkinsfile binary and place it in a directory in your PATH:
jx convert jenkinsfile
jx convert jenkinsfileis a plugin for Jenkins X to assist in converting from the legacyJenkinsfile-based pipelines to the modernjenkins-x.yml-based pipelines. It will attempt to convert an existingJenkinsfileinto the equivalentjenkins-x.ymlin the same directory, letting the user know if there are parts of the existingJenkinsfilewhich cannot be converted.Directives in the
Jenkinsfilewhich cannot be automatically converted will be noted in thejenkins-x.ymlwith comments showing theJenkinsfilesnippet, and steps which cannot be converted will be noted with comments and replaced byecho ... && exit 1in the actual pipeline execution.If the
Jenkinsfilecontains code outside of thepipeline { ... }block, or unknown Declarative directives,jx convert jenkinsfilewill exit with an error.Installation
Download the
jx-convert-jenkinsfilebinary and place it in a directory in yourPATH:Linux
macOS
You can now invoke the tool by running
jx convert jenkinsfile.Usage
Run
jx convert jenkinsfile, optionally specifying--dir ...to look for theJenkinsfilein a different directory than the current one.Reporting issues
Please create an issue in the jx project with the
area/jenkinsfile-converterlabel for any issues or feature requests for this tool.