From e36db112547d30163bae4b96813dcbd610c78564 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 15:33:33 +0200 Subject: [PATCH 01/11] fix missing master_branches variable --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 28c8e8d..472dbc5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,6 +2,8 @@ @Library('sec_ci_libs@v2-latest') _ +def master_branches = ['master'] as String[] + task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') { stage("Verify author") { From 62515dcb6f2b16943bdb2185b373daf417c42029 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 15:38:21 +0200 Subject: [PATCH 02/11] add repo checkout --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 472dbc5..5632e28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,10 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 user_is_authorized(master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') } + stage('Checkout') { + checkout scm + } + stage("build") { sh 'make build' } From 3e152a929c739c8a91444c1e08603b8d644cdc45 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 15:50:12 +0200 Subject: [PATCH 03/11] add pipeline --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5632e28..7c55622 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,8 @@ def master_branches = ['master'] as String[] +pipeline { + task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') { stage("Verify author") { @@ -34,7 +36,7 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 credentialsId: '4551c307-10ae-40f9-a0ac-f1bb44206b5b', variable: 'DOCKER_HUB_EMAIL'] ]) { - sh "docker login -u '${env.DOCKER_HUB_USERNAME}' -p '${env.DOCKER_HUB_PASSWORD}'" + sh "echo ${env.DOCKER_HUB_PASSWORD} | docker login -u '${env.DOCKER_HUB_USERNAME}' --password-stdin" } sh 'make docker-push' } @@ -52,3 +54,5 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 } } } + +} From eaccd67239e5748f56a024cf8f39f20d9a80f24f Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 15:51:20 +0200 Subject: [PATCH 04/11] add pipeline --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7c55622..6845434 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,10 +4,10 @@ def master_branches = ['master'] as String[] -pipeline { - task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') { + pipeline { + stage("Verify author") { user_is_authorized(master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') } @@ -53,6 +53,6 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 sh 'make release' } } -} + } } From 3f7557d694370facba7b4cce43092f196d060e0a Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 15:52:26 +0200 Subject: [PATCH 05/11] remove pipeline --- Jenkinsfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6845434..0dd992c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,8 +6,6 @@ def master_branches = ['master'] as String[] task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') { - pipeline { - stage("Verify author") { user_is_authorized(master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') } @@ -53,6 +51,4 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 sh 'make release' } } - - } } From 8c290d8d23afdc431f8925247b9f345dc88d66ea Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 16:00:32 +0200 Subject: [PATCH 06/11] use tag condition --- Jenkinsfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0dd992c..730e345 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,15 +40,16 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 } stage("release") { - when { tag "" } - withCredentials([ - [ - $class: 'StringBinding', - credentialsId: 'd146870f-03b0-4f6a-ab70-1d09757a51fc', - variable: 'GITHUB_TOKEN', - ] - ]) { - sh 'make release' + if (buildingTag()) { + withCredentials([ + [ + $class: 'StringBinding', + credentialsId: 'd146870f-03b0-4f6a-ab70-1d09757a51fc', + variable: 'GITHUB_TOKEN', + ] + ]) { + sh 'make release' + } } } } From 9f5c55fe12616f3033a04e0492bcc65ae2e27a31 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 16:12:29 +0200 Subject: [PATCH 07/11] branches list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 730e345..c84e17f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ @Library('sec_ci_libs@v2-latest') _ -def master_branches = ['master'] as String[] +def master_branches = ["master", ] as String[] task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89', '#dcos-security-ci') { From 96f0beb40fd77a79f8ff551ca10662403f18063f Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Fri, 24 May 2019 16:19:55 +0200 Subject: [PATCH 08/11] convert bzip2 to gz --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 684c747..49da096 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,9 @@ docker-test: docker-image github-release: curl -L https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 -o github-release.tar.bz2 - tar xzf github-release.tar.bz2 + # Our jenkins doesn't support .tar.bz2 archivves + bunzip2 -c < github-release.tar.bz2 | gzip -c > github-release.tar.gz + tar xzf github-release.tar.gz mv bin/linux/amd64/github-release . rm -rf bin github-release.tar.bz2 From cd499077d11f1657a355ea055337be66f3abf982 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Tue, 28 May 2019 06:16:10 +0200 Subject: [PATCH 09/11] use correct github token --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c84e17f..8a8f1d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,7 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 withCredentials([ [ $class: 'StringBinding', - credentialsId: 'd146870f-03b0-4f6a-ab70-1d09757a51fc', + credentialsId: 'c674acda-2a3b-497c-88f4-ff5c16f7edc0', variable: 'GITHUB_TOKEN', ] ]) { From 13cd4dc4354102557ae72a85a823a48ce4faf6c8 Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Tue, 28 May 2019 10:49:38 +0200 Subject: [PATCH 10/11] add verbose flag to github-release --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 49da096..70b9ee7 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,6 @@ github-release: rm -rf bin github-release.tar.bz2 release: github-release build - ./github-release release -u $(USER) -r $(REPO) \ + ./github-release -v release -u $(USER) -r $(REPO) \ -t $(TAG) -n $(TAG) - ./github-release upload -u $(USER) -r $(REPO) -t $(TAG) -n $(BIN) -f $(BIN) + ./github-release -v upload -u $(USER) -r $(REPO) -t $(TAG) -n $(BIN) -f $(BIN) From 4854cfbfac357297f336e309eec9106657d8b5bd Mon Sep 17 00:00:00 2001 From: Martin Hrabovcin Date: Tue, 28 May 2019 12:25:03 +0200 Subject: [PATCH 11/11] use env tag name --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a8f1d9..7b06d2b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ task_wrapper('mesos-sec', master_branches, '8b793652-f26a-422f-a9ba-0d1e47eb9d89 } stage("release") { - if (buildingTag()) { + if (env.TAG_NAME) { withCredentials([ [ $class: 'StringBinding',