Skip to content

Instantly share code, notes, and snippets.

View visitbethel's full-sized avatar

Bananaman visitbethel

  • FreeIT
  • The Springs CO
View GitHub Profile
#!/bin/bash
# BUILD library which contains all modules of the package
echo "Build package.o from module1.c and module2.c"
gcc -c -o module1.o module1.c
gcc -c -o module2.o module2.c
ld -o package.o -r module1.o module2.o
symbols=(`nm package.o`)
for((i=0;i<${#symbols[*]};i=i+1)) do
if [ "${symbols[$i]}" != "T" ]; then continue; fi
@visitbethel
visitbethel / Jenkins Pipeline Scheduling
Last active February 2, 2017 17:37
Jenkins Pipeline Scheduling
properties(
[
pipelineTriggers([cron('*/2 * * * *')])
],
[
$class : 'ParametersDefinitionProperty',
strategy
]
)
@visitbethel
visitbethel / Jenkins Pipeline Log Rotator
Last active February 2, 2017 17:41
Jenkins Pipeline Log Rotator
properties([
[
$class : 'jenkins.model.BuildDiscarderProperty',
strategy: [
$class : 'LogRotator',
numToKeepStr: '200'
]
]
])
@visitbethel
visitbethel / Jenkins Pipeline Github Property
Created February 2, 2017 17:40
Jenkins Pipeline Github Property
properties([
[
$class : 'GithubProjectProperty',
displayName : '',
projectUrlStr: "${GITHUB_PROJECT_URL}"
]
])
@visitbethel
visitbethel / Jenkins Pipeline Triggers
Created February 2, 2017 17:42
Jenkins Pipeline Triggers
properties(
[
pipelineTriggers([cron('*/2 * * * *')])
]
)
@visitbethel
visitbethel / Jenkins Pipeline GitSCM
Created February 2, 2017 17:52
Jenkins Pipeline GitSCM
=====> https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L161
@DataBoundConstructor
public GitSCM(
List<UserRemoteConfig> userRemoteConfigs,
List<BranchSpec> branches,
Boolean doGenerateSubmoduleConfigurations,
Collection<SubmoduleConfig> submoduleCfg,
@CheckForNull GitRepositoryBrowser browser,
@CheckForNull String gitTool,
node {
// Change `url` value to your own
stage('Get Tags') {
// Change `message` value to the message you want to display
// Change `description` value to the description you want
def selectedProperty = inputParamsString('hello')
println "Property: $selectedProperty"
@visitbethel
visitbethel / Jenkins Pipeline Input Dropdown
Created February 2, 2017 17:58
Jenkins Pipeline Input Dropdown
// Change `url` value to your own
def inputParams=new URL('http://maven.com/sefs/sefs-scm.txt').text
// Change `message` value to the message you want to display
// Change `description` value to the description you want
def selectedProperty = input( id: 'userInput', message: 'Choose properties file',
parameters: [ [
$class: 'ChoiceParameterDefinition',
choices: inputParams,
description: 'Properties',
node {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'mylogin',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh '''
set +x
curl -u $USERNAME:$PASSWORD https://private.server/ > output
'''
}
}
@visitbethel
visitbethel / Jenksin Pipeline JSON Config Slurp to Avoid Serializa
Created February 3, 2017 17:57
Jenksin Pipeline JSON Config Slurp to Avoid Serializable
import groovy.json.JsonSlurperClassic
@NonCPS
def jsonParse(def json) {
new groovy.json.JsonSlurperClassic().parseText(json)
}
node('master') {
def config = jsonParse(readFile("config.json"))