jenkins_url + /api/json?tree=jobs[name,color]
jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]
| from apiclient.discovery import build | |
| from apiclient import errors | |
| from httplib2 import Http | |
| from oauth2client import file, client, tools | |
| from email.mime.text import MIMEText | |
| from base64 import urlsafe_b64encode | |
| SENDER = <sender> | |
| RECIPIENT = <recipient> |
| /* | |
| Script to increase the version number of the project and remove snapshots | |
| Using Gmaven: http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code | |
| Execute standalone | |
| $ mvn groovy:execute | |
| <plugin> | |
| <groupId>org.codehaus.gmaven</groupId> |
| FROM ruby:2.3.1 | |
| # Install dependencies | |
| RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
| # Set an environment variable where the Rails app is installed to inside of Docker image: | |
| ENV RAILS_ROOT /var/www/app_name | |
| RUN mkdir -p $RAILS_ROOT | |
| # Set working directory, where the commands will be ran: |
| node { | |
| echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1' | |
| echo 'No quotes, pipeline command in single quotes' | |
| sh 'echo $BUILD_NUMBER' // 1 | |
| echo 'Double quotes are silently dropped' | |
| sh 'echo "$BUILD_NUMBER"' // 1 | |
| echo 'Even escaped with a single backslash they are dropped' | |
| sh 'echo \"$BUILD_NUMBER\"' // 1 | |
| echo 'Using two backslashes, the quotes are preserved' | |
| sh 'echo \\"$BUILD_NUMBER\\"' // "1" |
| #!/usr/bin/env bash | |
| set -o nounset -o errexit -o pipefail | |
| usage() { | |
| cat <<EOM | |
| Usage: | |
| $(basename $0) [OPTIONS] | |
| $(basename $0) [ -j | --jenkins-url | -n | --node-name | -s | -d | --desc | --slave-home | -e | --executors | -sh | --ssh-host | -sp | --ssh-port | |
| | -c | --cred-id | -l | --labels | -u | --user-id | -p | --password | -h | --help ] |
| /* | |
| Parallel processing with ordered output in Go | |
| (you can use this pattern by importing https://github.com/MarianoGappa/parseq) | |
| This example implementation is useful when the following 3 conditions are true: | |
| 1) the rate of input is higher than the rate of output on the system (i.e. it queues up) | |
| 2) the processing of input can be parallelised, and overall throughput increases by doing so | |
| 3) the order of output of the system needs to respect order of input | |
| - if 1 is false, KISS! |
| /* | |
| This snippet is an example of backpressure implementation in Go. | |
| It doesn't run in Go Playground, because it starts an HTTP Server. | |
| The example starts an HTTP server and sends multiple requests to it. The server starts denying | |
| requests by replying an "X" (i.e. a 502) when its buffered channel reaches capacity. | |
| This is not the same as rate-limiting; you might be interested in https://github.com/juju/ratelimit | |
| or https://godoc.org/golang.org/x/time/rate. |