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.lang.reflect.*; | |
import jenkins.model.Jenkins; | |
import jenkins.model.*; | |
import org.jenkinsci.plugins.scriptsecurity.scripts.*; | |
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.*; | |
scriptApproval = ScriptApproval.get() | |
alreadyApproved = new HashSet<>(Arrays.asList(scriptApproval.getApprovedSignatures())) | |
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
#NonCPS | |
def getBuildUser() { | |
return currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserId() | |
} | |
@NonCPS | |
def getBuildUserName() { | |
return currentBuild.rawBuild.getCause(Cause.UserIdCause).getUserName() | |
} |
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
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | |
<!-- localRepository | |
| The path to the local repository maven will use to store artifacts. | |
| | |
| Default: ${user.home}/.m2/repository --> | |
<localRepository>E:/devsetup/M2</localRepository> |
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.instance.getAllItems(Job.class).each{ | |
println it.name + " - " + it.class + '\n' | |
} |
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.instance.getAllItems(Job.class).each{ | |
println it.name + " - " + it.class + '\n' | |
} |
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 hudson.FilePath | |
import hudson.model.Node | |
import hudson.model.Slave | |
import jenkins.model.Jenkins | |
Jenkins jenkins = Jenkins.instance | |
for (Node node in jenkins.nodes) { | |
// Make sure slave is online | |
if (!node.toComputer().online) { | |
println "Node '$node.nodeName' is currently offline - skipping workspace cleanup" |
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.instance.pluginManager.plugins.each{ | |
plugin -> | |
println ("${plugin.getDisplayName()} | ${plugin.getShortName()} : ${plugin.getVersion()}") | |
} |
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
MyCustomResource: | |
DependsOn: SnsTopic | |
Type: "Custom::TestLambdaCrossStackRef" | |
Properties: | |
ServiceToken: !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:myTestLambda" | |
StackName: !Ref "AWS::StackName" | |
SnsTopicArn: !Ref SnsTopic | |
SuccessRoleArn: !GetAtt "SnSSuccessfulRole.Arn" | |
FailureRoleArn: !GetAtt "SnSFailedRole.Arn" |
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
for (aSlave in hudson.model.Hudson.instance.slaves) { | |
if (aSlave.getComputer().isOffline()) { | |
aSlave.getComputer().setTemporarilyOffline(true,null); | |
aSlave.getComputer().doDoDelete(); | |
} | |
} |