Skip to content

Instantly share code, notes, and snippets.

View cvakiitho's full-sized avatar
🌈
Focusing

Tomáš Hartmann cvakiitho

🌈
Focusing
View GitHub Profile
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src * 'unsafe-inline' 'unsafe-eval'; font-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';")
@cvakiitho
cvakiitho / gist:956c69ff83e3b034f552d9e9b9db9128
Created November 9, 2021 15:30
jenkins run sh via script console
println new ProcessBuilder( 'sh', '-c', 'date').redirectErrorStream(true).start().text
@cvakiitho
cvakiitho / gist:2c4e3263be9bb57ab0813b4948da7269
Last active October 5, 2023 13:26
Jenkins script to kill all zombie jobs - jobs with MAX_SURVABILITY -
def x = 0
for (job in Hudson.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob)) {
try{
def isZombie = job.getLastBuild().dump()==~ /.*state=null.*/
def isRunning = job.getLastBuild().completed
if(!isRunning && isZombie ){
x = x +1
println "Candidate for Zombie: ${job}"
job.getLastBuild().doKill()
@cvakiitho
cvakiitho / gist:3c1cf58eb6a5becf30ad81a6efc12d21
Last active July 16, 2021 10:53
remove branch indexing from build queue jenkins
import hudson.model.*
import jenkins.model.Jenkins
def timer = 5000 //5s timer
def counter = 12 * 10 // 10 minutes reruns
for (i = 0; i <counter; i++) {
def q = Jenkins.instance.queue
@cvakiitho
cvakiitho / script-approval.groovy
Created June 10, 2021 12:25
Script to get hash from groovy script for script-approval
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
class Scratch {
public static void main(String[] args) {
String language = "groovy";
String script ='''
'''
@cvakiitho
cvakiitho / script.groovy
Created May 25, 2021 13:58
Jenkins trigger all branch jobs in organization
// https://javadoc.jenkins.io/jenkins/model/Jenkins.html#getItemByFullName-java.lang.String-
def organization = Hudson.instance.getItemByFullName('S4-FIORI-CORE-1 GitHub Quality')
if (!organization) throw new Exception("No organization by that name")
// https://javadoc.jenkins.io/plugin/cloudbees-folder/com/cloudbees/hudson/plugins/folder/AbstractFolder.html#getItems--
def jobs = organization.getItems()
jobs.each {
// find the sub-job that's named "master"
// https://javadoc.jenkins.io/hudson/model/Item.html#getName--
main = it.items.find { it.getName() == "main" }
// if found, schedule a build with 0 quiet period
println "\nfunctions\n***********"
println this.steps.functions.collect { k,v -> v.getFunctionName()}
println "\nstepClassNames\n***********"
println this.steps.stepClassNames.collect { k,v -> v.getFunctionName()}
println "\nunreportedAmbiguousFunctions\n***********"
println this.steps.unreportedAmbiguousFunctions.collect { k,v -> v.getFunctionName() }
println "\nallGlobalVariables\n***********"
@cvakiitho
cvakiitho / github.js
Created March 15, 2021 17:10
Github Graphql branch protection rule
const fetch = require('node-fetch');
let url = 'https://<>.corp/api/graphql';
let options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic <base64 token>'
},
@cvakiitho
cvakiitho / uiveri5APICheatsheet.md
Last active August 20, 2021 00:53 — forked from javierarques/protractorAPICheatsheet.md
UIVeri5 API Cheatsheet

UIVeri5 API cheatsheet

it uses protractor beneath, so this is a good resource: http://angular.github.io/protractor/#/api

Notes:

  • Most commands return promises, so you only resolve their values through using jasmine expect API or using .then(function()) structure.

  • Promises are resolved by WebdriverJS promise manager . If you want to schedule non-api made promise into the chain, you have to use one of:

map "o" newTab