From 0943c34c65145df434d7fb0e0e42caaa148b9c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:17:42 +0200 Subject: [PATCH 1/7] chore: archive releases in Jenkins UI --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 24c775b59d..0dd6fb931c 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -294,7 +294,7 @@ def generateStep(Map args = [:]){ } } } finally { - archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/.github/releases/download/**" + archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/dist/**" } } } From 9ecb634ee7bc42a03c6453bdf3aba5b1fb2882be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:22:42 +0200 Subject: [PATCH 2/7] chore: simplify release process on Jenkins --- .ci/.package.yaml | 8 -------- .ci/Jenkinsfile | 38 +++++++------------------------------- 2 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 .ci/.package.yaml diff --git a/.ci/.package.yaml b/.ci/.package.yaml deleted file mode 100644 index 915d741ef7..0000000000 --- a/.ci/.package.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -OSS: - - "darwin" - - "linux" - -PLATFORM: - - "386" - - "amd64" diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 0dd6fb931c..1305250498 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -221,16 +221,13 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}") { - script { - def matrix = readYaml(file: '.ci/.package.yaml') - def parallelTasks = [:] - matrix['OSS'].each { oss -> - matrix['PLATFORM'].each { platform -> - parallelTasks["${oss}-${platform}"] = generateStep(oss: "${oss}", platform: "${platform}") - } - } - parallel(parallelTasks) - } + sh '' + sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash', returnStatus: true) + } + } + post { + always { + archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/dist/**" } } } @@ -279,27 +276,6 @@ def doNotifyBuildResult(boolean slackNotify) { notifyBuildResult(analyzeFlakey: true, jobName: getFlakyJobName(withBranch: "${env.JOB_BASE_NAME}"), prComment: true, slackHeader: header, slackChannel: "${channels}", slackComment: true, slackNotify: slackNotify) } - -def generateStep(Map args = [:]){ - def oss = args.get('oss') - def platform = args.get('platform') - return { - withNode(labels: 'ubuntu-18.04 && immutable && docker', sleepMax: 20, forceWorkspace: true){ - try { - deleteDir() - unstash 'source' - dir("${BASE_DIR}/cli") { - withEnv(["GOOS=${oss}", "GOARCH=${platform}"]) { - sh script: 'make build', label: 'Create releases' - } - } - } finally { - archiveArtifacts allowEmptyArchive: true, artifacts: "${BASE_DIR}/cli/dist/**" - } - } - } -} - def generateFunctionalTestStep(Map args = [:]){ def platform = args.get('platform') def suite = args.get('suite') From ec43a44c97cfa2831b4c491c3e2fc6f45820394a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:26:48 +0200 Subject: [PATCH 3/7] chore: remove garbage --- .ci/Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 1305250498..2aaefc75bd 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -221,7 +221,6 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}") { - sh '' sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash', returnStatus: true) } } From e157eded7657dbba300b4e0a193c4ffb59a1fd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:28:06 +0200 Subject: [PATCH 4/7] chore: support retrying fetching the goreleaser script It will also retry in the case the release command fails --- .ci/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 2aaefc75bd..4f93b00931 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -221,7 +221,9 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}") { - sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash', returnStatus: true) + retryWithSleep(retries: 2, seconds: 5, backoff: true) { + sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash', returnStatus: true) + } } } post { From a4021073e110e84bf1c327f9c2f3f0b6e5be4c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:35:49 +0200 Subject: [PATCH 5/7] chore: set GITHUB_TOKEN --- .ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 4f93b00931..cfab95111f 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -221,6 +221,7 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}") { + setEnvVar("GITHUB_TOKEN", getGithubToken()) retryWithSleep(retries: 2, seconds: 5, backoff: true) { sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash', returnStatus: true) } From d3d7b4c8c410bd32ce2a52c6b128982194b2b524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:42:39 +0200 Subject: [PATCH 6/7] chore: ensure workspace is clean in the worker --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index cfab95111f..ec80a6dfce 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -223,7 +223,7 @@ pipeline { dir("${BASE_DIR}") { setEnvVar("GITHUB_TOKEN", getGithubToken()) retryWithSleep(retries: 2, seconds: 5, backoff: true) { - sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash', returnStatus: true) + sh(label: 'Release binaries with gorelease', script: 'curl -sL https://git.io/goreleaser | bash -s -- --rm-dist', returnStatus: true) } } } From feef7ca897475f6e94c53d7862b9dc13a6d2ddd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 1 Apr 2021 09:51:20 +0200 Subject: [PATCH 7/7] chore: add release information for goreleaser --- .goreleaser.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 9d658ea8b4..ad0a24fbc3 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -35,3 +35,30 @@ changelog: exclude: - '^docs:' - '^test:' + +# https://goreleaser.com/customization/release/ +release: + # Repo in which the release will be created. + # Default is extracted from the origin remote URL or empty if its private hosted. + # Note: it can only be one: either github, gitlab or gitea + github: + owner: elastic + name: e2e-testing + + # If set to true, will not auto-publish the release. + # Default is false. + draft: true + + # If set to auto, will mark the release as not ready for production + # in case there is an indicator for this in the tag e.g. v1.0.0-rc1 + # If set to true, will mark the release as not ready for production. + # Default is false. + prerelease: auto + + # You can change the name of the release. + # Default is `{{.Tag}}` + name_template: "{{.Tag}}" + + # You can disable this pipe in order to not upload any artifacts. + # Defaults to false. + disable: false