Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1. Setup a project
2. Add groovy SDK support:
https://www.bonusbits.com/wiki/HowTo:Add_Groovy_SDK_to_IntelliJ_IDEA
3. Download http://(yourjenkinsurl)/job/(yourpipelinejob)/pipeline-syntax/gdsl
- this will give you the .gdsl file - download this to the src folder of your project.
4. Finally follow this step - right click on the src folder -> Mark directory as -> Sources Root
5. Now create a .groovy file and begin writing, the autocompletion will work.
references:
http://stackoverflow.com/questions/41062514/use-gdsl-file-in-a-java-project-in-intellij
@arehmandev

This comment has been minimized.

Copy link
Owner Author

commented Apr 12, 2017

Another link:

https://st-g.de/2016/08/jenkins-pipeline-autocompletion-in-intellij

and an example declarative pipeline to play around with:

pipeline {
    agent  {
        label "abdul-executor"
    }

    environment {
        DISABLE_AUTH = 'true'
        DB_ENGINE    = 'sqlite'
    }

    stages {
        stage('Build') {
            steps {
                sh 'echo $DB_ENGINE'
            }
        }
        stage('Test') {
            steps {
                sh 'echo $DISABLE_AUTH'
            }
        }
    }
@rmpestano

This comment has been minimized.

Copy link

commented Nov 8, 2017

Hi, thank you for the tips.

One missing step, at least needed here (idea 2017.2), is to associate Jenkinsfile with groovy in Settings > Editor > File types:

filetype

@pathob

This comment has been minimized.

Copy link

commented Nov 10, 2017

@arehmandev It is not working for declarative pipelines for me. The generated GDSL file does not contain methods like 'pipeline'. Am I missing anything?

@rmpestano

This comment has been minimized.

Copy link

commented Nov 13, 2017

Hi @pathob,
Same problem here, I've made auto completion work but declarative dsl is missing. Looking at this issue looks like Jenkins isn't generating a declarative pipeline GDSL yet.

@forresthopkinsa

This comment has been minimized.

Copy link

commented Nov 21, 2017

Keep voting on that Jira task

@ggarcia24

This comment has been minimized.

Copy link

commented Feb 21, 2018

Just as an FYI for the folks that are coming from Google like myself I've created a GDSL that supports the declarative pipeline, Hope this can help someone 😄

https://gist.github.com/ggarcia24/fc5acec3288812b34c64a4f2b8f9bca9

@ranma2913

This comment has been minimized.

Copy link

commented Jun 11, 2019

Just as an FYI for the folks that are coming from Google like myself I've created a GDSL that supports the declarative pipeline, Hope this can help someone

https://gist.github.com/ggarcia24/fc5acec3288812b34c64a4f2b8f9bca9

This worked wonderfully. I added some more to it here: https://gist.github.com/ranma2913/6c2424a5bda07d12d034502fb4b0b7c2 I forked it, so how do I open a pull request? Is that not possible with gist?

@amitrintzler

This comment has been minimized.

Copy link

commented Jun 18, 2019

thanks!
do you have more updated file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.