Skip to content

Instantly share code, notes, and snippets.

View marcelbirkner's full-sized avatar

Marcel Birkner marcelbirkner

View GitHub Profile
@marcelbirkner
marcelbirkner / controlTrafficLight.sh
Created July 19, 2013 08:49
This script is used to control a USB Traffic Light from Cleware. It runs in an endless loop and uses the Jenkins REST API to poll the specified Jenkins job tp parse the job status. It uses the job status to display different colors on the USB traffic light. - green: build stable - red: build failed / unstable - yellow: building job
#!/bin/sh
# This script is used to control a USB Traffic Light from Cleware. You can buy
# the USB Traffic Light from this shop: http://www.cleware-shop.de
#
# The script uses the REST API and can be used for newer versions of Jenkins that provide a REST API.
#
# Requirements:
#
# The Cleware USB Traffic Light comes with a control software that you can
@marcelbirkner
marcelbirkner / ciSeedJob.groovy
Last active October 21, 2022 13:55
Jenkins Job DSL Seed Job for Continuous Integration Jobs
import groovy.sql.Sql
import java.util.Date
import java.text.SimpleDateFormat
/*
* THIS IS AN EXAMPLE SNIPPET. FOR MORE DETAILS SEE THE FOLLOWING BLOG ARTICLE:
* https://blog.codecentric.de/en/?p=30502
*
* This Jenkins Job DSL Groovy Script creates Continuous Integration (CI) Jobs
* for all Maven & Ant projects that exist on a GitLab Server.
@marcelbirkner
marcelbirkner / jobDslExample.groovy
Created September 24, 2015 20:12
Jenkins Job DSL Example
job('jersey-rest-server') {
scm {
git {
remote {
url('git@github.com:marcelbirkner/jersey-rest-server.git')
}
createTag(false)
}
}
triggers {
@marcelbirkner
marcelbirkner / accessGitLabRestApi.groovy
Created September 24, 2015 20:17
Access GitLab REST API with Groovy
// GitLab Settings
def gitUrl = 'http://git/api/v3'
def privateToken = 'xYxYxYxYxYxYxYxYxYxY'
def currentPage = 1
def projectsPerPage = 100
// Reading projects from GitLab REST API
def projectList = new URL("${gitUrl}/projects/all?page=${currentPage}&per_page=${projectsPerPage}&private_token=${privateToken}")
def projects = new groovy.json.JsonSlurper().parse(projectList.newReader())
projects.each {
@marcelbirkner
marcelbirkner / accessOracleDatabase.groovy
Last active December 10, 2021 03:26
Access Oracle Database with Groovy
import groovy.sql.Sql
// Oracle DB Settings
def dbSchema = ‘schema’
def dbServer = ‘oracleserver’
def dbUser = ‘user’
def dbPassword = 'password'
def dbDriver = 'oracle.jdbc.driver.OracleDriver'
def dbUrl = 'jdbc:oracle:thin:@' + dbServer + ':' + dbSchema
sql = Sql.newInstance( dbUrl, dbUser, dbPassword, dbDriver )
@marcelbirkner
marcelbirkner / accessMySqlDatabase.groovy
Created September 24, 2015 20:20
Access MySQL Database
import groovy.sql.Sql
// MySQL DB Settings
def dbSchema = ‘schema’
def dbServer = ‘mysqlserver’
def dbUser = ‘user’
def dbPassword = 'password'
def dbDriver = 'com.mysql.jdbc.Driver'
def dbUrl = 'jdbc:mysql:@' + dbServer + ':' + dbSchema
sql = Sql.newInstance( dbUrl, dbUser, dbPassword, dbDriver )
@marcelbirkner
marcelbirkner / docker-jenkins-job-dsl.sh
Created September 27, 2015 11:36
Docker Jenkins Job DSL Example
#!/bin/sh
git clone git@github.com:marcelbirkner/docker-jenkins-job-dsl.git
cd docker-jenkins-job-dsl
docker build -t docker-jenkins-job-dsl .
docker run -p=8080:8080 docker-jenkins-job-dsl
@marcelbirkner
marcelbirkner / docker-ci-tool-stack.sh
Created October 2, 2015 15:20
Getting started with docker CI tool stack
git clone git@github.com:marcelbirkner/docker-ci-tool-stack.git
cd docker-ci-tool-stack
docker-compose up
@marcelbirkner
marcelbirkner / docker-compose.yml
Last active February 24, 2024 00:59
CI Tool Stack Docker Compose
nexus:
build: ./nexus
ports:
- "18081:8081"
jenkins:
build: ./jenkins
ports:
- "18080:8080"
links:
@marcelbirkner
marcelbirkner / docker-machine-stop.sh
Created October 4, 2015 09:42
docker-machine stop default
~$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
default virtualbox Stopped
~$ docker-machine stop default