Skip to content

Instantly share code, notes, and snippets.

@goofyahead
goofyahead / Jenkinsfile
Created May 27, 2019 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage c…
View Jenkinsfile
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8-alpine
@goofyahead
goofyahead / Jenkinsfile.groovy
Created Apr 15, 2019 — forked from aerobless/Jenkinsfile.groovy
An example Jenkinsfile for a build pipeline using gradle, junit, selenium, checkstyle
View Jenkinsfile.groovy
pipeline {
agent {
label 'agentId' //The id of the slave/agent where the build should be executed, if it doesn't matter use "agent any" instead.
}
triggers {
cron('H */8 * * *') //regular builds
pollSCM('* * * * *') //polling for changes, here once a minute
}
@goofyahead
goofyahead / mono_sample.java
Last active Oct 23, 2018
Mono usage for coordinator spring boot sample
View mono_sample.java
public class OrderHandlers {
private OrderService orderService;
private KitchenService kitchenService;
private DeliveryService deliveryService;
private AccountingService accountingService;
public OrderHandlers(OrderService orderService,
KitchenService kitchenService,
DeliveryService deliveryService,
AccountingService accountingService) {
this.orderService = orderService;
View android exclusions for coverage
def androidExclusion = [
'**/databinding/**/*.*',
'**/android/databinding/*Binding.*',
'**/BR.*',
'**/R.*',
'**/R$*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*_MembersInjector.*',
'**/Dagger*Component.*',
View sonarqube task for coverage
sonarqube {
properties {
property "sonar.host.url", "http://localhost:9000/"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "myProject"
property "sonar.projectName", "myProject"
property "sonar.projectVersion", "V1.0"
property "sonar.sources", "src/main/java"
property "sonar.tests", ["src/test/java", "src/test/kotlin"]
property "sonar.java.coveragePlugin", "jacoco"
View android coverage task
task codeCoverageReport(type: JacocoReport, dependsOn: 'testStagingDebugUnitTest') {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.enabled = true
html.enabled = true
}
classDirectories = fileTree(
dir: 'build/intermediates/classes/staging/debug/com/yourpackage',
excludes: androidExclusion
@goofyahead
goofyahead / dependencies
Created Jun 26, 2018
jacoco report for android projects
View dependencies
apply plugin: 'org.sonarqube'
apply plugin: 'jacoco'
View gist:89d51f197b24716c69205e4dd21b3edd
package com.example.tsl057.rxjavaplaygroundjava;
import android.util.Log;
import org.junit.Test;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
@goofyahead
goofyahead / gist:ea495ed9772f9b13a1988ba9fb1b061f
Last active Apr 4, 2018
prettify json response with curl
View gist:ea495ed9772f9b13a1988ba9fb1b061f
curl http://10.129.7.183:1337/jsonendpoint -H 'Authorization: XXXXX' | node <<< "var o = $(cat); console.log(JSON.stringify(o, null, 4));"