Skip to content

Instantly share code, notes, and snippets.

View gruberro's full-sized avatar

Robert Gruber gruberro

  • Munich, Germany
View GitHub Profile
@gabor-farkas
gabor-farkas / Jenkinsfile
Created February 5, 2019 08:54
Setting Github commit status in a declarative Jenkins pipeline with curl in sh
void setBuildStatus(String message, String context, String state) {
// add a Github access token as a global 'secret text' credential on Jenkins with the id 'github-commit-status-token'
withCredentials([string(credentialsId: 'github-commit-status-token', variable: 'TOKEN')]) {
// 'set -x' for debugging. Don't worry the access token won't be actually logged
// Also, the sh command actually executed is not properly logged, it will be further escaped when written to the log
sh """
set -x
curl \"https://api.github.com/repos/org/repo/statuses/$GIT_COMMIT?access_token=$TOKEN\" \
-H \"Content-Type: application/json\" \
-X POST \
@alcaeus
alcaeus / README.md
Last active April 19, 2021 14:26
Enable GPG for git commits

Enable GPG for git commits

Generate a key

  1. Install gpg and gpg-agent: brew install gpg gpg-agent
  2. Generate a new key: run gpg --gen-key and follow the instructions
  3. Write down the ID of the key. To do this, run gpg --list-keys. The output will look like this:
pub   4096R/E9468C9A 2016-04-20 [expires: 2016-07-19]
uid Andreas B.