Skip to content

Instantly share code, notes, and snippets.

@AshCoolman
Last active January 31, 2018 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshCoolman/202a645ac8c55bf21646e163da861cd9 to your computer and use it in GitHub Desktop.
Save AshCoolman/202a645ac8c55bf21646e163da861cd9 to your computer and use it in GitHub Desktop.
Jenkins cheatsheet.md

Sections

Contains Directives or Steps

  • agent - where env will execute
  • post - run once Pipeline or stage has run. Supports blocks always (regardless), changed (different completion status), failure, success, unstable (Pipeline or stage run status == "unstable" e.g. test failures), aborted
  • stages/steps - sequence of stage directives e.g. stage('Deploy staging') { steps { ... } }
  • environment - env vars
  • options - config Pipeline (or Stage)
  • params - params called with trigger, available via params object
  • triggers - automated ways Pipeline started e.g. webhook, CRON
  • tools - binaries to install & +PATH
  • input - prompt user
  • when - condition for stage execution
  • stage

Parallel

Nested stages executed in parallel

Steps

Artifacts

        stage('Test') {
            steps {
                sh './genCustomReports.html'
                sh './genJUnitReports.html'
            }
        }
    }
    post {
        always {
            archiveArtifacts artifacts: 'build/reports/**/customReport-*.html', fingerprint: true
            junit 'build/reports/junit/**/*.xml'
        }
    }

Hello world setup

  1. https://getintodevops.com/blog/the-simple-way-to-run-docker-in-docker-for-ci
  2. https://jenkins.io/doc/pipeline/tour/hello-world/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment