Quick reference for finding commits in Git with examples.
git log -p -S "" -- A simple Bash script to export all incidents from PagerDuty month by month basis.
It:
pagerduty-incident-export-12-2021.json, pagerduty-incident-export-01-2022.json, etc.date syntax)I recently worked on a Project that required migrating Jenkins credentials to another credentials store, going to each credential and viewing and subsequently decrypting the credential turned into a real chore and I needed a way to do this all in one go.
Luckily we can access credentialsStore using Jenkins script console, so:
In Jenkins, go to: /script page.
Run the following command:
| def sout = new StringBuilder(), serr = new StringBuilder() | |
| def proc = "ls /var/jenkins_home/jobs".execute() | |
| proc.consumeProcessOutput(sout, serr) | |
| proc.waitForOrKill(30000) | |
| println "out> $sout\nerr> $serr" |
| def sout = new StringBuilder(), serr = new StringBuilder() | |
| def proc = "git config --list".execute() | |
| proc.consumeProcessOutput(sout, serr) | |
| proc.waitForOrKill(30000) | |
| println "out> $sout\nerr> $serr" |
| def numberOfHoursBack = 7 * 24 | |
| def totalBuildTime = | |
| Jenkins.instance.getItems(Job.class).collect { | |
| job -> | |
| job.getBuilds().byTimestamp(System.currentTimeMillis() - numberOfHoursBack * 60 * 60 * 1000, System.currentTimeMillis()) | |
| } | |
| .flatten() | |
| .collect { | |
| build -> build.getDuration() |
| type itemMap<T> = { | |
| [itemName: string]: T | |
| } | |
| type Environments = { | |
| [x: string]: Environment | |
| } | |
| export enum Environment { | |
| /* eslint-disable no-unused-vars */ |