Skip to content

Instantly share code, notes, and snippets.

@antrew
antrew / keybase.md
Last active November 26, 2020 08:54

Keybase proof

I hereby claim:

  • I am antrew on github.
  • I am andreyv (https://keybase.io/andreyv) on keybase.
  • I have a public key ASCbLnEd2jT5sD3W2uI5XT5I8gohHmW1_moMhhbCzijtPQo

To claim this, I am signing this object:

#!groovy
def handleCheckout = {
sh "echo 'Checking out a merge request...'"
def credentialsId = scm.userRemoteConfigs[0].credentialsId
checkout ([
$class: 'GitSCM',
branches: [[name: "${env.gitlabSourceNamespace}/${env.gitlabSourceBranch}"]],
extensions: [
[$class: 'PruneStaleBranch'],
#!groovy
def handleCheckout = {
checkout ([
$class: 'GitSCM',
branches: scm.branches,
extensions: [
[$class: 'PruneStaleBranch'],
[$class: 'CleanCheckout']
],
#!groovy
def handleCheckout = {
sh "echo 'Checking out given branch...'"
checkout scm
}
node() {
stage('setup') {
sh "env | sort"
def credentialsId = scm.userRemoteConfigs[0].credentialsId
checkout ([
$class: 'GitSCM',
branches: [[name: "${env.gitlabSourceNamespace}/${env.gitlabSourceBranch}"]],
extensions: [
[$class: 'PruneStaleBranch'],
[$class: 'CleanCheckout'],
[
$class: 'PreBuildMerge',
options: [
checkout ([
$class: 'GitSCM',
branches: scm.branches,
extensions: [
[$class: 'PruneStaleBranch'],
[$class: 'CleanCheckout']
],
userRemoteConfigs: scm.userRemoteConfigs
])
@antrew
antrew / Jenkinsfile
Last active February 21, 2021 07:14
#!groovy
def handleCheckout = {
if (env.gitlabMergeRequestId) {
sh "echo 'Merge request detected. Merging...'"
def credentialsId = scm.userRemoteConfigs[0].credentialsId
checkout ([
$class: 'GitSCM',
branches: [[name: "${env.gitlabSourceNamespace}/${env.gitlabSourceBranch}"]],
extensions: [