NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| import collections | |
| def dict_merge(dct, merge_dct): | |
| """ Recursive dict merge. Inspired by :meth:``dict.update()``, instead of | |
| updating only top-level keys, dict_merge recurses down into dicts nested | |
| to an arbitrary depth, updating keys. The ``merge_dct`` is merged into | |
| ``dct``. | |
| :param dct: dict onto which the merge is executed | |
| :param merge_dct: dct merged into dct | 
| import asyncio | |
| from datetime import datetime, timezone | |
| import os | |
| def utc_now(): | |
| # utcnow returns a naive datetime, so we have to set the timezone manually <sigh> | |
| return datetime.utcnow().replace(tzinfo=timezone.utc) | |
| class Terminator: | |
| pass | 
| package example.postgres.audit; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import java.sql.CallableStatement; | |
| import java.sql.Connection; | |
| import java.sql.PreparedStatement; | |
| import java.sql.SQLException; | |
| import java.sql.Savepoint; | 
| //The global script scope | |
| def ctx = context(scope: scriptScope()) | |
| //What things can be on the script scope | |
| contributor(ctx) { | |
| method(name: 'pipeline', type: 'Object', params: [body: Closure]) | |
| property(name: 'params', type: 'org.jenkinsci.plugins.workflow.cps.ParamsVariable') | |
| property(name: 'env', type: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder') | |
| property(name: 'currentBuild', type: 'org.jenkinsci.plugins.workflow.cps.RunWrapperBinder') | |
| property(name: 'scm', type: 'org.jenkinsci.plugins.workflow.multibranch.SCMVar') | 
/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉
~/.ssh/config, set each ssh key for each repository as in this exemple: