Last active
          November 14, 2017 10:50 
        
      - 
      
- 
        Save cccaternberg/3984e4a3d1a84ec6faffbd728ce6c247 to your computer and use it in GitHub Desktop. 
    Jenkins Days
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pipeline { | |
| agent any | |
| stages { | |
| stage('Build') { | |
| steps { | |
| echo 'Hello from Build' | |
| } | |
| } | |
| stage('Test') { | |
| steps { | |
| echo 'Testing Testing 123' | |
| } | |
| } | |
| stage('Deploy') { | |
| steps { | |
| echo 'Deploy some things' | |
| } | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pipeline { | |
| agent { | |
| label 'docker' | |
| } | |
| stages { | |
| stage('Build') { | |
| steps { | |
| echo 'Hello from Build' | |
| } | |
| } | |
| stage('Test') { | |
| steps { | |
| echo 'Testing Testing 123' | |
| } | |
| } | |
| stage('Deploy') { | |
| steps { | |
| echo 'Deploy some things' | |
| } | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pipeline { | |
| agent { | |
| label 'docker' | |
| } | |
| stages { | |
| stage('Build') { | |
| steps { | |
| echo 'Hello from Build' | |
| writeFile(file: 'config', text: 'version=1', encoding: 'UTF-8') | |
| stash(name: 'pom-config', includes: 'config') | |
| } | |
| } | |
| stage('Test') { | |
| environment { | |
| configValue = readFile(encoding: 'UTF-8', file: 'config') | |
| } | |
| steps { | |
| echo 'Testing Testing 123' | |
| unstash 'pom-config' | |
| sh 'echo "$configValue"' | |
| } | |
| } | |
| stage('Deploy') { | |
| steps { | |
| echo 'Deploy some things' | |
| } | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pipeline { | |
| agent { | |
| label 'docker' | |
| } | |
| parameters { | |
| booleanParam(defaultValue: true, description: '', name: 'userFlag') | |
| } | |
| options { | |
| buildDiscarder(logRotator(numToKeepStr:'1')) | |
| } | |
| stages { | |
| stage('Build') { | |
| steps { | |
| echo 'Hello from Build' | |
| writeFile(file: 'config', text: 'version=1', encoding: 'UTF-8') | |
| stash(name: 'pom-config', includes: 'config') | |
| } | |
| } | |
| stage('Test') { | |
| environment { | |
| configValue = readFile(encoding: 'UTF-8', file: 'config') | |
| } | |
| steps { | |
| echo 'Testing Testing 123' | |
| unstash 'pom-config' | |
| sh 'echo "$configValue"' | |
| } | |
| } | |
| stage('Deploy') { | |
| steps { | |
| echo 'Deploy some things' | |
| input 'Do you want to deploy?' | |
| echo 'deployed' | |
| } | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pipeline { | |
| agent { | |
| label 'docker' | |
| } | |
| stages { | |
| stage ("start"){ | |
| steps { | |
| sh "echo start" | |
| } | |
| } | |
| stage("distribute") { | |
| steps { | |
| parallel ( | |
| "jdk-8" : { | |
| node('maven-jdk-8') { | |
| sleep 15 | |
| sh "mvn -version" | |
| } | |
| }, | |
| "docker" : { | |
| node('docker') { | |
| sleep 5 | |
| sh "docker version" | |
| } | |
| } | |
| ) | |
| } | |
| } | |
| stage ("end"){ | |
| steps { | |
| sh "echo end" | |
| } | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pipeline { | |
| agent none | |
| stages { | |
| stage("Build") { | |
| agent { | |
| label 'docker' | |
| } | |
| steps { | |
| echo "Building" | |
| sh "echo 'testtext' > test.txt" | |
| stash includes: 'test.txt', name: 'my-file' | |
| } | |
| } | |
| stage("Checkpoint") { | |
| agent none | |
| steps { | |
| checkpoint 'Completed Build' | |
| } | |
| } | |
| stage("Deploy") { | |
| agent { | |
| label 'docker' | |
| } | |
| steps { | |
| unstash 'my-file' | |
| sh 'cat test.txt' | |
| } | |
| } | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | stage('build') { | |
| echo 'hello from jenkins master' | |
| node ("docker") { | |
| sh 'echo hello from jenkins agent' | |
| } | |
| } | |
| stage('test') { | |
| echo 'test some things' | |
| } | |
| stage('deploy') { | |
| echo 'deploy some things' | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | stage('build') { | |
| node ("docker") { | |
| checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/beedemo/mobile-deposit-api.git']]]) | |
| writeFile encoding: 'UTF-8', file: 'config', text:'version=1' | |
| stash includes: 'pom.xml,config', name: 'pom-config' | |
| } | |
| } | |
| stage('test'){ | |
| node ("maven-jdk-8") { | |
| unstash 'pom-config' | |
| configValue = readFile encoding: 'UTF-8', file: 'config' | |
| echo configValue | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | stage('deploy') { | |
| input message: 'Do you want to deploy?' | |
| node { | |
| echo 'deployed' | |
| } | |
| } | |
| checkpoint 'testing-complete' | |
| stage('approve') { | |
| mail body: "Approval needed for '${env.JOB_NAME}' at '${env.BUILD_URL}'", subject: "${env.JOB_NAME} Approval", to: "[email protected]" | |
| timeout(time: 7, unit: 'DAYS') { | |
| input message: 'Do you want to deploy?', parameters:[string(defaultValue: '', description: 'Provide any comments regarding decision.', name: 'Comments')], submitter: 'admin' | |
| } | |
| } | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | stage ("maven-tool"){ | |
| node { | |
| def mvnHome = tool 'M3' | |
| sh "${mvnHome}/bin/mvn -version" | |
| } | |
| } | |
| stage ("docker-inside"){ | |
| node ("docker") { | |
| docker.image('maven:3.3.3-jdk-8').inside() { | |
| sh 'mvn -version' | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
good one. liked the workshop