This file contains hidden or 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
package com.example | |
import MavenCoursierResolver._ | |
import coursier.maven.MavenRepository | |
import coursier.{Dependency, Module, Platform, Resolution} | |
import scala.concurrent.duration.DurationInt | |
class MavenCoursierResolver() { |
This file contains hidden or 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/bash | |
BUILDTOOLS_REVISION=1a7c0ec10697afcb87af8a09f12c3f9b9ca56fb2 | |
gopath=$(go env GOPATH) | |
github_go_fetch() { | |
cd /tmp | |
org=$1 | |
repo=$2 | |
revision=$3 |
This file contains hidden or 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
job_name="some-job" //I have multiple jobs with the same simple name under multiple folders | |
lookup_string="something inside the log" // the line we want to look for | |
instance = Jenkins.instance | |
def jobs = instance.allItems.findAll{it.name==job_name} | |
count = 0 | |
for (job in jobs){ | |
lastRun = job.lastCompletedBuild | |
lastBuildLog = lastRun.log | |
if (lastBuildLog.contains(lookup_string)){ | |
println job.fullName + " " + instance.rootUrl + lastRun.url |
This file contains hidden or 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
job_name="some-name" //I have multiple jobs with the same simple name under multiple folders | |
instance = Jenkins.instance | |
def jobs = instance.allItems.findAll{it.name==job_name} | |
count = 0 | |
for (job in jobs){ | |
lastRun = job.lastCompletedBuild | |
if (lastRun==null || lastRun.result != Result.SUCCESS){ | |
println job.fullName + " " + instance.rootUrl + lastRun.url | |
count = count + 1 | |
} |
This file contains hidden or 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
/* | |
Jenkins - If found "lookup_string" in last run of a job - triggers it again with the same parameters | |
*/ | |
job_name="some-job" //I have multiple jobs with the same simple name under multiple folders | |
lookup_string="something inside the log" // the line we want to look for | |
instance = Jenkins.instance | |
def jobs = instance.allItems.findAll{it.name==job_name} | |
count = 0 | |
for (job in jobs){ | |
lastRun = job.lastCompletedBuild |
This file contains hidden or 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 org.jenkinsci.plugins.workflow.job.WorkflowRun | |
import org.jenkinsci.plugins.workflow.support.steps.StageStepExecution | |
projectFullName = 'folder/job-name' | |
dryRun = false | |
if(!(projectFullName in String)) { | |
throw new Exception('PARAMETER ERROR: projectFullName must be a string.') | |
} |
This file contains hidden or 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 com.cloudbees.hudson.plugins.folder.Folder | |
import org.jenkinsci.plugins.workflow.job.WorkflowRun | |
import org.jenkinsci.plugins.workflow.support.steps.StageStepExecution | |
dryRun = true | |
def printIfBuildIsRunning(job){ | |
def item = job.getLastBuild() | |
if(item!=null && item.isBuilding()) { |
This file contains hidden or 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
// Using com.auth0:java-jwt:3.4.0 | |
import com.auth0.jwt.JWT; | |
import com.auth0.jwt.algorithms.Algorithm; | |
// Using com.google.api-client:google-api-client:1.23.0 | |
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; | |
// Using commons-io:commons-io:2.6 | |
import org.apache.commons.io.IOUtils; |
This file contains hidden or 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 java.io.FileInputStream | |
import java.security.interfaces.RSAPrivateKey | |
import java.util.Date | |
import com.auth0.jwt.JWT | |
import com.auth0.jwt.algorithms.Algorithm | |
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential | |
class GCBTokenProvider(privateKey: RSAPrivateKey, privateKeyId: String, serviceName: String, api: String, user: String) { | |
def getToken: String = { |
This file contains hidden or 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 org.apache.commons.codec.digest.{HmacAlgorithms, HmacUtils} | |
class WebHookHandler(webhookSecret:String) { | |
private val hmacDigest = new HmacUtils(HmacAlgorithms.HMAC_SHA_1, webhookSecret) | |
private val xHubSignaturePattern = "sha1=(.+)".r | |
private def validate(xHubSignature: String, body: String): Boolean = { | |
xHubSignature match { | |
case xHubSignaturePattern(sha1) => sha1 == hmacDigest.hmacHex(body) |
OlderNewer