Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
Please comment & let me know if you have a fork / fixes you'd like to include.
apiVersion: argoproj.io/v1alpha1 | |
kind: Application | |
metadata: | |
name: applications | |
namespace: argocd | |
finalizers: | |
- resources-finalizer.argocd.argoproj.io | |
spec: | |
destination: | |
namespace: argocd |
import org.kohsuke.github.* | |
/* | |
* This pipeline uses the Jenkins Job DSL plugin to create the multi-branch pipelines | |
* for your Github Organization repositories. | |
* | |
* @see https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin | |
* | |
* It does not consumes 5k requests in 6 minutes, but actually queries the Github API | |
* for the repositories in organization and creates the Multi-Branch Pipelines in Jenkins. |
System.setProperty("org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.defaultImage", "jenkins/jnlp-slave:3.36-2") | |
pipeline { | |
agent { | |
kubernetes { | |
label 'parent-pod' | |
containerTemplate(name: 'jnlp', image: "jenkins/jnlp-slave:3.10-1-alpine",args: '${computer.jnlpmac} ${computer.name}') | |
} | |
} | |
stages { |
pipeline { | |
agent { label 'xxx' } | |
options { timestamps() } | |
environment { | |
KW_PROJECT_NAME = 'xxx' | |
} | |
stages { | |
stage('Checkout') { | |
steps { |
Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
Please comment & let me know if you have a fork / fixes you'd like to include.
Started by user admin | |
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: | |
General error during class generation: 296 | |
java.lang.ArrayIndexOutOfBoundsException: 296 | |
at org.codehaus.groovy.classgen.asm.CallSiteWriter.getCreateArraySignature(CallSiteWriter.java:58) | |
at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:317) | |
at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:307) | |
at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:397) | |
at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:104) |
docker.image('cloudbees/java-build-tools:0.0.6').inside { | |
sshagent(['github-ssh-credentials']) { | |
sh """ | |
git version | |
git config --local user.email \\"[email protected]\\" | |
git config --local user.name \\"Cyrille Le Clerc\\" | |
git clone [email protected]:cyrille-leclerc/a-test-repo.git | |
date &> now.txt |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
=begin | |
Implement dijkstra's algorithm | |
reference | |
https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm | |
V is the number of vertices | |
N is the maximum number of edges attached to a single node. | |
Time complexity: O( V * N * log V) |