Skip to content

Instantly share code, notes, and snippets.

View ThabetAmer's full-sized avatar
🎯
In the search for a new challenge!

Thabet Amer ThabetAmer

🎯
In the search for a new challenge!
View GitHub Profile
@ThabetAmer
ThabetAmer / check-url.groovy
Created January 18, 2020 08:08
Jenkins Groovy function to check URL availability
#!/usr/bin/env groovy
/**
* Checks URL availability via curl
* @author thabet.amer@gmail.com
* @since Jenkins 2.204.1
* @param String url
* @return String Zero if succeeded, error if not.
*
*/
@ThabetAmer
ThabetAmer / get-emoji.groovy
Created January 18, 2020 08:07
Jenkins Groovy function to return an emoji from a pool based on the build status, can be used with Slack notifications
#!/usr/bin/env groovy
/**
* Returns an emoji from a pool based on the build status, can be used with Slack notifications
* @author thabet.amer@gmail.com
* @since Jenkins 2.204.1
* @param String status default 'success'
* @return String emoji
*
*/
@ThabetAmer
ThabetAmer / get-jobs.groovy
Created January 18, 2020 08:03
Groovy/Jenkins function to list all enabled Jenkins jobs by name.
#!/usr/bin/env groovy
/**
* Lists all enabled Jenkins jobs by name.
* @author thabet.amer@gmail.com
* @since Jenkins 2.204.1
* @param Bool includeDisabled to include also disabled jobs, default false (No).
* @return String array of jenkins jobs names
*
*/
@ThabetAmer
ThabetAmer / get-envvars.groovy
Last active January 18, 2020 08:02
Groovy Function for Jenkins pipelines
#!/usr/bin/env groovy
/**
* Reads environment variables from a property file, and loads them into Jenkins ENV
* @author thabet.amer@gmail.com
* @since Jenkins 2.204.1
* @param String path
* @return String array
*
* Example property file: