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.
| ################### INSTALL METRICSBEAT ###################### | |
| wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
| echo 'deb https://artifacts.elastic.co/packages/oss-6.x/apt stable main' | sudo tee /etc/apt/sources.list.d/beats.list | |
| sudo apt-get update && sudo apt-get install metricbeat | |
| sudo metricbeat keystore create | |
| echo "${elastic_pw}" | sudo bin/metricbeat-keystore add ES_PASSWORD | |
| # echo "setup.dashboards.enabled: true" >> /etc/metricbeat/metricbeat.yml | |
| cat <<EOT >> /etc/metricbeat/metricbeat.yml | |
| output.elasticsearch: |
| apiVersion: argoproj.io/v1alpha1 | |
| kind: Application | |
| metadata: | |
| name: root-app | |
| namespace: argocd | |
| finalizers: | |
| - resources-finalizer.argocd.argoproj.io | |
| spec: | |
| destination: | |
| namespace: argocd |
| 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 \\"cleclerc@cloudbees.com\\" | |
| git config --local user.name \\"Cyrille Le Clerc\\" | |
| git clone git@github.com: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