Skip to content

Instantly share code, notes, and snippets.

View WoodProgrammer's full-sized avatar

Emir Özbir WoodProgrammer

View GitHub Profile
@WoodProgrammer
WoodProgrammer / find-dead-executors.groovy
Created June 11, 2018 22:56 — forked from malonem/find-dead-executors.groovy
Jenkins script to find dead executors and remove them.
// get handle to build output
def config = new HashMap()
def bindings = getBinding()
config.putAll(bindings.getVariables())
def out = config['out']
for (aSlave in hudson.model.Hudson.instance.slaves) {
// check if executor is dead
execList = aSlave.getComputer().getExecutors()
for( exec in execList ) {
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-medium
spec:
replicas: 3
template:
metadata:
labels:
service: webserver
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-yazi
spec:
replicas: 3
selector:
matchLabels:
service: http-server
strategy:
jenkins:
location:
url: http://jenkins.xxx
clouds:
- kubernetes:
name: kubernetes
skipTlsVerify:
containerCapStr: 100
jenkinsUrl: http://jenkins.xxx
jenkins:
location:
url: https://a.a.a.com:8080
version: '3.3'
services:
#jnlp-agent:
# depends_on:
# - jenkins
# image: jenkins/jnlp-slave
# command: -url http://jenkins:8080
# restart: always
# environment:
jenkins:
location:
url: a.a.a.a:com
systemMessage: "Welcome to the demo setup for Jenkins Configuration as Code plugin. For more information look in the official repo with our demo setup: https://github.com/Praqma/praqma-jenkins-casc"
securityRealm:
local:
allowsSignup: false
users:
- id: demoAdmin
password: ${adminpw:-passw0rd}
jenkins:
location:
url: http://jenkins/
jenkins:
securityRealm: null
authorizationStrategy: Unsecured
clouds:
- kubernetes:
name: kubernetes
serverUrl: asdsada
namespace: aa123
def updateConfigMap(self):
readToken = open("/var/run/secrets/kubernetes.io/serviceaccount/token").read()
token = "Bearer {}".format(readToken)
headers = {"Content-Type": "application/merge-patch+json", "authorization":token}
r = requests.patch("{}/api/v1/namespaces/default/configmaps/nginx".format(self.kubernetes_master), verify=False, headers=headers, json=self.configData)
return r.content