Skip to content

Instantly share code, notes, and snippets.

View smsantana's full-sized avatar

Saul Moreira smsantana

  • São Paulo
View GitHub Profile
@smsantana
smsantana / build-stages-status.groovy
Created December 4, 2018 17:01 — forked from GuillaumeSmaha/build-stages-status.groovy
Functions to get stages executed and build state
import hudson.model.Action
import com.cloudbees.workflow.flownode.FlowNodeUtil
import com.cloudbees.workflow.rest.external.StatusExt
import org.jenkinsci.plugins.workflow.graph.FlowNode
import org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode
import org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode
import org.jenkinsci.plugins.workflow.actions.LabelAction
@smsantana
smsantana / gist:482fa73f873cdb96f394fac3abfda2a9
Created November 7, 2018 02:44 — forked from michalbcz/gist:4170520
java - https url connection - trust any certificate
import java.net.URL;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
@smsantana
smsantana / Jenkinsfile
Created September 18, 2018 18:31 — forked from HarshadRanganathan/Jenkinsfile
Jenkins Declarative Pipeline Example
def getProjectName() {
return 'JenkinsPipeline'
}
def getJDKVersion() {
return 'jdk1.8.0_101'
}
def getMavenConfig() {
return 'maven-config'
@smsantana
smsantana / setup-users.groovy
Created June 7, 2018 19:04 — forked from johnbuhay/setup-users.groovy
jenkins init.groovy.d script for configuring users
import jenkins.*
import hudson.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
import hudson.model.*
import jenkins.model.*
import hudson.security.*
@smsantana
smsantana / get-latest-tag-on-git.sh
Created March 15, 2018 22:35 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
#!/usr/bin/env ruby
require 'base64'
require 'digest'
require 'openssl'
# Author: @thesubtlety
# Decrypts Jenkins 2 encrypted strings, code change introduced around Jenkins ver 2.44
# Based off work by juyeong, https://gist.github.com/juyeong/081379bd1ddb3754ed51ab8b8e535f7c
@smsantana
smsantana / README.md
Created February 19, 2018 18:03 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
@smsantana
smsantana / install-docker.sh
Created December 28, 2017 13:51 — forked from frgomes/install-docker.sh
Debian - install docker in Debian Jessie
#!/bin/bash
# compiled from https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@smsantana
smsantana / nexus-fetch.sh
Created September 25, 2017 20:02 — forked from gnustavo/nexus-fetch.sh
Bash script to fetch artifacts from Sonatype's Nexus 3
#!/bin/bash
# Original script in:
# http://blog.sonatype.com/2011/01/downloading-artifacts-from-nexus-with-bash/#.VPW0c1PF_v9
# Adapted for Nexus 3
# Define Nexus Configuration
NEXUS_BASE=http://repository.example.com:8081/nexus
usage()
@smsantana
smsantana / jiraRefreshTickets.js
Created May 19, 2016 12:57 — forked from rtrcolin/jiraRefreshTickets.js
Super simple Google Docs integration with Jira Issues/Tickets
// URL for Jira's REST API for issues
var getIssueURL = "https://[Your Jira host]/rest/api/2/issue/";
// Personally I prefer the script to handle request failures, hence muteHTTPExceptions = true
var fetchArgs = {
contentType: "application/json",
headers: {"Authorization":"Basic [Your BASE64 Encoded user:pass]"},
muteHttpExceptions : true
};