Skip to content

Instantly share code, notes, and snippets.

@abayer
abayer / check-updates
Last active September 28, 2018 20:43 — forked from rtyler/check-updates
A simple script to update a pom.xml for the latest updates
#!/usr/bin/env bash
DEPENDS=$(xmlstarlet sel -N x='http://maven.apache.org/POM/4.0.0' \
-t -m x:project/x:dependencies/x:dependency \
-v x:artifactId -o ' ' \
pom.xml)
if [ ! -f update-center.actual.json ]; then
wget https://updates.jenkins.io/update-center.actual.json;
fi;
// assume this is some list of things you're going to do something with
def someList
def parallelBranches = someList.collectEntries { n ->
[(n): {
throttle('category') {
node('some-node') {
// do some things with n
}
}
}]
@abayer
abayer / Jenkinsfile
Created March 16, 2017 15:15
New Declarative Pipeline features in 1.1
pipeline {
agent {
// "node" is a new agent type that works the same as "label" but allows
// additional parameters, such as "customWorkspace" below.
node {
label "some-label"
// This is equivalent to the "ws(...)" step - sets the workspace on the
// agent to a hard-coded path. If it's not an absolute path, it'll be
// relative to the agent's workspace root.
customWorkspace "/use/this/path/instead"
@abayer
abayer / Jenkinsfile
Created February 15, 2017 15:17
An example Declarative Pipeline Jenkinsfile for Feb 15 2017 demo
// A Declarative Pipeline is defined within a 'pipeline' block.
pipeline {
// agent defines where the pipeline will run.
agent {
// This also could have been 'agent any' - that has the same meaning.
label ""
// Other possible built-in agent types are 'agent none', for not running the
// top-level on any agent (which results in you needing to specify agents on
// each stage and do explicit checkouts of scm in those stages), 'docker',
#!groovy
// This is the full syntax for Jenkins Declarative Pipelines as of version 0.8.1.
pipeline {
// Possible agent configurations - you must have one and only one at the top level.
agent any
agent none
agent {
label "whatever"
@abayer
abayer / examplePipeline.groovy
Last active April 1, 2021 08:03 — forked from rsandell/examplePipeline.groovy
Example declarative pipeline
pipeline {
agent none
environment {
MAVEN_OPTS = "-Xmx1024m"
}
parameters {
stringParam(defaultValue: "install", description: "What Maven goal to call", name: "MAVEN_GOAL")
@abayer
abayer / jenkins-git-backup.sh
Last active July 16, 2024 17:17
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master
@abayer
abayer / ContextIntegrationTest.java
Created January 20, 2014 22:25
Integration test for job-dsl-plugin context
package javaposse.jobdsl.plugin;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import static hudson.model.Result.SUCCESS;
import static javaposse.jobdsl.plugin.RemovedJobAction.IGNORE;
http-bio-8080-exec-6" daemon prio=5 tid=10b847800 nid=0x118b8d000 runnable [118b86000]
java.lang.Thread.State: RUNNABLE
at java.util.WeakHashMap.get(WeakHashMap.java:355)
at com.springsource.loaded.ri.ReflectiveInterceptor.getRType(ReflectiveInterceptor.java:829)
at com.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetAnnotation(ReflectiveInterceptor.java:255)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:615)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:845)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:772)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:256)
- locked <7eb3eeed8> (a com.google.inject.internal.InheritingState)
2013-02-21 10:16:32,681 [i/o thread 1] ERROR handlers.BackoffLimitedRetryHandler - Cannot retry after server error, command has exceeded retry limit 5: [method=VirtualMachi
neAsyncClient.deployVirtualMachineInZone, request=GET http://10.20.76.10:8080/client/api?response=json&command=deployVirtualMachine&zoneid=7dbc4787-ec2f-498d-95f0-848c8c81e5
da&templateid=240937c8-d695-419c-9908-5c7b2a07e6f1&serviceofferingid=c376102e-b683-4d43-b583-4eeab4627e65&displayname=bousa-4&name=bousa-4 HTTP/1.1]
2013-02-21 10:16:32,691 [pool-1-thread-98] ERROR reporting.InstanceProvisionerJob - provisionWithRetry error: org.jclouds.http.HttpResponseException: command: GET http://10.20.76.10:8080/client/api?response=json&command=deployVirtualMachine&zoneid=7dbc4787-ec2f-498d-95f0-848c8c81e5da&templateid=240937c8-d695-419c-9908-5c7b2a07e6f1&serviceofferingid=c376102e-b683-4d43-b583-4eeab4627e65&displayname=bousa-4&name=bousa-4 HTTP/1.1 failed with response: HTTP/1.1 534 null; content: [{ "deployvirtualmachineresponse" : {"uuidList