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
def StandardUsernameCredentials = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class, Jenkins.instance, null, null); | |
for (c in StandardUsernameCredentials) { | |
println(c.id + ": " + c.description) | |
} | |
def StandardUsernamePasswordCredentials = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials.class, Jenkins.instance, null, null); | |
for (c in StandardUsernamePasswordCredentials) { | |
println(c.id + ": " + c.description) | |
} |
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 | |
set -e | |
if [ $(echo "$1" | cut -c1) = "-" ]; then | |
echo "$0: assuming arguments" | |
set -- myapp "$@" | |
fi | |
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "myapp" ]; then |
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
# Dismiss all Microsoft Visual Studio Community 2015 propmpts during installation automatically | |
while (Get-Process | Where-Object {$_.Description -eq "Microsoft Visual Studio Community 2015 with Updates"}) | |
{ | |
Start-Sleep -Seconds 60; | |
$wshell = New-Object -ComObject wscript.shell; | |
$wshell.AppActivate('Visual Studio'); | |
$wshell.SendKeys("{ENTER}") | |
} |
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
# Might be useful in Spring boot apps | |
const postRequest = { | |
url: 'http://<URL>/auth/login', | |
method: 'POST', | |
header: 'Content-Type:application/json', | |
body: { | |
mode: 'application/json', | |
raw: JSON.stringify( | |
{ |
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
import hudson.model.Result | |
import hudson.model.Run | |
import jenkins.model.CauseOfInterruption.UserInterruption | |
def call() { | |
// https://stackoverflow.com/a/49901413/4763512 | |
Run previousBuild = currentBuild.rawBuild.getPreviousBuildInProgress() | |
while (previousBuild != null) { | |
if (previousBuild.isInProgress()) { | |
def executor = previousBuild.getExecutor() |
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
// define the bitbucket project + repos we want to build | |
def bitbucket_project = 'myproj' | |
def bitbucket_repos = ['myrepo1', 'myrepo2'] | |
// create a pipeline job for each of the repos and for each feature branch. | |
for (bitbucket_repo in bitbucket_repos) | |
{ | |
multibranchPipelineJob("${bitbucket_repo}-ci") { | |
// configure the branch / PR sources | |
branchSources { |
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
# Useful references: | |
# | |
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line | |
# https://ss64.com/vb/sendkeys.html | |
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell | |
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/ | |
# | |
# Future enhancements - use events rather than an infinite loop | |
while (1) { | |
$wsh = New-Object -ComObject WScript.Shell |
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
COMMITS=$(git --no-pager log origin/master..HEAD --format="- [%h] %B") | |
API_URL="https://api.telegram.org/bot${BOT_TOKEN}/sendMessage?chat_id=${CHAT_ID}" | |
curl --silent -o /dev/null \ | |
--header "Content-Type: application/json" \ | |
--request POST \ | |
--data "{\"text\": \"${COMMITS}\"}" \ | |
$API_URL |
OlderNewer