This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cassert> | |
#include <iomanip> | |
#include <iostream> | |
#include <cstdlib> | |
#include <string> | |
#include <regex> | |
#include <map> | |
#include <vector> | |
#include <iterator> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hopefully, this is useful to someone else. Using the Slack Notification plugin it is trivially | |
// easy to send a Slack message from within a build pipeline. What may not be so easy is to send | |
// one from within a Groovy script build step inside a freestyle build, or from within another | |
// plugin. Personally, I hate having to reinvent the wheel, especially where making HTTP requests | |
// is concerned. So how do we leverage the Slack plugin for this scenario? Read on ... | |
// This is the main thing we need - the `StandardSlackService` class, exposed by the Slack | |
// Notification plugin. | |
import jenkins.plugins.slack.StandardSlackService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a simple usage case for retrieving a "secret text" or "token" credential | |
// from the global Jenkins credentials, and, if found, making it available as | |
// cleartext for use within a Groovy script or within a plugin. Obviously, this | |
// should NOT BE USED for mischevous purposes ... | |
import com.cloudbees.plugins.credentials.SystemCredentialsProvider | |
import hudson.util.Secret | |
def allCredentials = SystemCredentialsProvider.instance.credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cannot use System.getenv(keyName) nor System.getenv(). These do not include all of the build | |
// parameters, nor do they include Jenkins-specific environment values. The following will give | |
// access to all of that data, plus the system environment variables: | |
// Get access to the script binding context | |
def binding = this.getProperty('binding') | |
// Get the executing build | |
def build = binding.getVariable('build') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function do_something { | |
local my_arg=$1 | |
# do something here ... | |
} | |
# Iterate over array of values, processing each in turn. | |
# Assumes that there are no holes in the array (no unassigned | |
# elements). |