Understanding the groovy syntax in a gradle task definition

Gradle uses AST Transformations to extend the Groovy syntax. The task definition syntax you mention is just one of the transformations Gradle applies. You can find the implementation for that transform here. To answer your specific questions: The individual transforms that Gradle applies are not specifically documented anywhere that I’m aware of. You could however … Read more

Groovy executing shell commands

Ok, solved it myself; def sout = new StringBuilder(), serr = new StringBuilder() def proc=”ls /badDir”.execute() proc.consumeProcessOutput(sout, serr) proc.waitForOrKill(1000) println “out> $sout\nerr> $serr” displays: out> err> ls: cannot access /badDir: No such file or directory

How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?

The latest version of the pipeline sh step allows you to do the following; // Git committer email GIT_COMMIT_EMAIL = sh ( script: ‘git –no-pager show -s –format=\’%ae\”, returnStdout: true ).trim() echo “Git committer email: ${GIT_COMMIT_EMAIL}” Another feature is the returnStatus option. // Test commit message for flags BUILD_FULL = sh ( script: “git log … Read more