Skip to content

Instantly share code, notes, and snippets.

@bvcelari
bvcelari / yaml_split.py
Created October 28, 2020 12:10
jcasc split
file1 = open('test-suite-casc-yaml.txt', 'r')
filename = ''
filecontent = []
line = file1.readline()
while True:
# if line is empty
# end of file is reached
if not line:
break
import hudson.license.LicenseManager
import hudson.security.ACL
import jenkins.model.Jenkins
import jenkins.util.groovy.GroovyHookScript
import java.io.File
import java.util.logging.Logger
Logger logger = Logger.getLogger("init.init_01_launch_auto_config.groovy")
ACL.impersonate(ACL.SYSTEM, new Runnable() {
@Override
public void run() {
/*
Script #1 - Tell you the status of your instances
Provides clear output that informs the user if their Jenkins(OC, masters, etc) are ready
to consume the new licenses. A user may run this script multiple times over the course of the
upgrade process (ie to see if the system needs to be updated, to verify its ready to be updated,
and to verify that the update has been completed successfully).
*/
// script version
def _version = "d6a8ab2"
/*
Script #1 - Tell you the status of your instances
Provides clear output that informs the user if their Jenkins(OC, masters, etc) are ready
to consume the new licenses. A user may run this script multiple times over the course of the
upgrade process (ie to see if the system needs to be updated, to verify its ready to be updated,
and to verify that the update has been completed successfully).
*/
// script version
def _version = "d6a8ab2"
/*
Script #1 - Tell you the status of your instances
Provides clear output that informs the user if their Jenkins(OC, masters, etc) are ready
to consume the new licenses. A user may run this script multiple times over the course of the
upgrade process (ie to see if the system needs to be updated, to verify its ready to be updated,
and to verify that the update has been completed successfully).
*/
// script version
def _version = "d6a8ab2"
#Set Env
JENKINS_SOURCE=http://localhost:9999
JENKINS_DESTINATION=http://localhost:8888
SOURCE_FOLDER=Fancy_SourceFolder
DESTINATION_FOLDER=Fancy_DestinationFolder
TEMP_FOLDER=Store_tmp_folder
def all = [ Jenkins.instance ]
all.addAll(Jenkins.instance.nodes)
all.each {
def c = it.toComputer()
println "[$it.nodeName] - $it.numExecutors - $it.assignedLabels - $it.acceptingTasks - $it.nodeProperties - $c.offline"
}
println "----"
Jenkins.instance.queue.items.each {
println "$it.id $it.blocked $it.buildable $it.stuck $it.assignedLabel $it.causes"
}
#Script has one input paramerter, folder where are the top and jstack files
#Script will get all the content from PATH, look for files with topdashHOutput name, check the CPU_USAGE_COLUMN and when the value is higher than HIGH_CPU will chck in the jstak files for the Hex code
import rlcompleter, readline
import sys
import subprocess
print 'Searching in ... :'+ sys.argv[1]
readline.parse_and_bind('tab:complete')
PATH = sys.argv[1]
#pre-requisites...
apt-get install -y openssh-server vim git virtualenv
#####required for docker states... should not be needed, but there is something broken in the salt repo...
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
#Rust Version
if [ "$0" != "" ]; then
RUST_VERSION=$0
else
RUST_VERSION="stable"
fi
#Parity Version
if [ "$1" != "" ]; then
PARITY_VERSION=$1