Skip to content

Instantly share code, notes, and snippets.

View sirrapa's full-sized avatar

Armand Parris sirrapa

View GitHub Profile
#!/bin/bash
## Checkout
git checkout --orphan latest_branch
## Add all the files
git add -A
## Commit the changes
git commit -am "Initial"
@sirrapa
sirrapa / DecryptJenkinsCredentials.groovy
Last active October 14, 2019 19:55
Iterate and decrypt credentials (Security Breach!!!!)
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class,
Jenkins.instance,
null,
null
)
for(c in creds) {
println(String.format("%s --> %s: %s",c, c.id, c.description))
// if(c instanceof com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey){
@sirrapa
sirrapa / JenkinsAgentCleaner.groovy
Last active November 29, 2018 07:25
Groovy script for cleaning up ghost workspaces left on slaves after a job has been deleted. Must be run strictly on the master instance.
import hudson.FilePath;
// Initialize dryRun parameter to TRUE if not given as script parameter
dryRun = true;
if( dryRun == true ) {
println "** Execute a dryRun - no files will ever be deleted **";
}
// shortcut to Jenkins instance
@sirrapa
sirrapa / jenkins_clear_job_links.sh
Created June 5, 2018 09:56
Delete all lastxxxx links for all jenkins jobs
@sirrapa
sirrapa / calico_commands.bash
Last active October 14, 2019 14:27
Calico: Handy commands
# Check if the calico-node container is running
docker ps | grep calico
#The **calicoctl** command allows to check the status of the network workloads.
#Check the status of Calico nodes
calicoctl node status
# Show the configured network subnet for containers
calicoctl get ippool -o wide
xmllint --xpath '//views' ../../jenkins-ahonline-master/config.xml
@sirrapa
sirrapa / get_installed_plugins.groovy
Last active June 14, 2018 08:00
Get a list of installed jenkins plugins with name and version pair
List<String> jenkinsPlugins = new ArrayList<String>(Jenkins.instance.pluginManager.plugins);
jenkinsPlugins.sort { it.shortName }
.each { plugin ->
println (" - ${plugin.shortName}:${plugin.version}")
}