Skip to content

Instantly share code, notes, and snippets.

Avatar
🏭
Focusing

Tomáš Hartmann cvakiitho

🏭
Focusing
View GitHub Profile
@cvakiitho
cvakiitho / gist:2c4e3263be9bb57ab0813b4948da7269
Last active Aug 24, 2021
Jenkins script to kill all zombie jobs - jobs with MAX_SURVABILITY -
View gist:2c4e3263be9bb57ab0813b4948da7269
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 Jul 16, 2021
remove branch indexing from build queue jenkins
View gist:3c1cf58eb6a5becf30ad81a6efc12d21
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 Jun 10, 2021
Script to get hash from groovy script for script-approval
View script-approval.groovy
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
Jenkins trigger all branch jobs in organization
View script.groovy
// 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
View gist:06e09b0a1e098944eb9c5de02321ad4d
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 Mar 15, 2021
Github Graphql branch protection rule
View github.js
const fetch = require('node-fetch');
let url = 'https://<>.corp/api/graphql';
let options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic <base64 token>'
},
View uiveri5APICheatsheet.md

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:

@cvakiitho
cvakiitho / docker-ce-rhel.sh
Last active Nov 2, 2017
get-docker without rhel check
View docker-ce-rhel.sh
#!/bin/sh
set -e
# This script is meant for quick & easy install via:
# $ curl -fsSL get.docker.com -o get-docker.sh
# $ sh get-docker.sh
#
# For test builds (ie. release candidates):
# $ curl -fsSL test.docker.com -o test-docker.sh
# $ sh test-docker.sh
View firefox-crasher.py
from selenium import webdriver
driver = webdriver.Remote(
command_executor='http://localhost:4444/wd/hub',
desired_capabilities=webdriver.DesiredCapabilities.FIREFOX
)
# driver = webdriver.Firefox()
driver.get("https://sapui5.hana.ondemand.com/#docs/guide/95d113be50ae40d5b0b562b84d715227.html")