Skip to content

Instantly share code, notes, and snippets.

View JD10NN3's full-sized avatar
🦊

Jonathan Dionne JD10NN3

🦊
View GitHub Profile
@JD10NN3
JD10NN3 / triggers_example_teams_notifications.groovy
Last active August 6, 2021 05:28
Example of a External Jenkins Pipeline triggers configuration that send notification to Teams
/*
This is used as part of a dynamic Jenkins pipeline configuration.
You can reference to this Gist for more details:
https://gist.github.com/JD10NN3/7796639e4d427d474c172d5e6b0fa49a
*/
import groovy.json.JsonOutput
import groovy.json.JsonSlurperClassic
import javax.mail.Address
import javax.mail.Session
@JD10NN3
JD10NN3 / triggers.groovy
Created November 11, 2019 13:54
Example of a External Jenkins Pipeline triggers configuration
/*
This is used as part of a dynamic Jenkins pipeline configuration.
You can reference to this Gist for more details:
https://gist.github.com/JD10NN3/7796639e4d427d474c172d5e6b0fa49a
*/
// If you need some libraries, feel free to import them here.
// import groovy.json.JsonOutput
this.triggersMapping = [
@JD10NN3
JD10NN3 / mapping.groovy
Last active November 11, 2019 12:23
Example of a External Jenkins Pipeline mapping
/*
This is used as part of a dynamic Jenkins pipeline configuration.
You can reference to this Gist for more details:
https://gist.github.com/JD10NN3/7796639e4d427d474c172d5e6b0fa49a
*/
this.map = [
/**
* Sandbox1 mapping
*
@JD10NN3
JD10NN3 / Jenkinsfile
Last active November 11, 2019 13:57
Basic Jenkinsfile that use a external configuration as pipeline mapping
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import hudson.model.Result
import hudson.model.Run
import jenkins.model.CauseOfInterruption.UserInterruption
/*
Jenkins version: 2.150.2
Github API version: v3
@JD10NN3
JD10NN3 / item.njk
Created May 7, 2019 10:20
Disqus and Eleventy, display comments count on an Eleventy Static Website
<li class="list-inline-item pr-2">
<a href="{{ defaultURL | url }}" class="white-text"><i class="fa fa-comments pr-1"></i>
{# little tricks to allow disqus count to work locally #}
<object><a href="{{ site.rootUrl + defaultURL | url }}#disqus_thread" class="white-text">0</a></object>
</a></li>
</li>
@JD10NN3
JD10NN3 / post.njk
Created May 7, 2019 10:16
Eleventy and Disqus, display comments count on an Eleventy static website
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{site.rootUrl}}{{ page.url }}"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = "{{ page.fileSlug }}"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqusShortname }}.disqus.com/embed.js';
@JD10NN3
JD10NN3 / metadatas_site.js
Created May 7, 2019 10:10
Eleventy Metadatas file with disqusShortname and rootUrl to allow the usage of disqus comments
module.exports = {
"title": "Nice website title",
"description": "My website description",
"rootUrl" : "https://website.net",
"disqusShortname" : "myDisqusShortname",
}
@JD10NN3
JD10NN3 / import-openshift-secrets-with-jenkins.groovy
Last active May 6, 2019 10:27
Simple Groovy script to import Openshift Secrets with Jenkins
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import com.cloudbees.plugins.credentials.impl.*;
import com.cloudbees.plugins.credentials.*;
import com.cloudbees.plugins.credentials.domains.*;
import org.jenkinsci.plugins.plaincredentials.*
import org.jenkinsci.plugins.plaincredentials.impl.*
import hudson.util.Secret