From f06da91619d78004615d025e07532ebcaf4962ce Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 16 Jul 2019 17:00:57 +0200 Subject: [PATCH 01/72] Added job configuration for Jenkins pipelines --- ...tic+elasticsearch-js+jenkins-pipelines.yml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml diff --git a/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml b/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml new file mode 100644 index 000000000..e6f53aaa6 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml @@ -0,0 +1,51 @@ +--- +- job: + project-type: multibranch + logrotate: + daysToKeep: 30 + numToKeep: 100 + number-to-keep: '5' + days-to-keep: '1' + concurrent: true + node: linux + script-path: Jenkinsfile + scm: + - github: + branch-discovery: all + discover-pr-forks-strategy: merge-current + discover-pr-forks-trust: permission + discover-pr-origin: merge-current + discover-tags: true + repo: elasticsearch-js + repo-owner: elastic + credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken + ssh-checkout: + credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba + build-strategies: + - tags: + ignore-tags-older-than: -1 + ignore-tags-newer-than: -1 + - regular-branches: true + - change-request: + ignore-target-only-changes: false + clean: + after: true + before: true + prune: true + shallow-clone: true + depth: 3 + do-not-fetch-tags: true + submodule: + disable: false + recursive: true + parent-credentials: true + timeout: 100 + timeout: '15' + use-author: true + wipe-workspace: 'True' + periodic-folder-trigger: 1d + prune-dead-branches: true + publishers: + - email: + recipients: infra-root+build@elastic.co + From d5c2dfba41f61da2721841df83d07ea4f702b10a Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 17 Jul 2019 11:21:42 +0200 Subject: [PATCH 02/72] Added job name --- .ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml b/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml index e6f53aaa6..9ca82a9b4 100644 --- a/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml +++ b/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml @@ -1,5 +1,8 @@ --- - job: + name: elastic+elasticsearch-js+jenkins-pipelines + display-name: 'elastic / elasticsearch-js # jenkins-pipelines' + description: Testing the elasticsearch-js jenkins-pipelines branch. project-type: multibranch logrotate: daysToKeep: 30 From f9c236f4e4116c705db70559951be83e64c2c460 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 11:38:24 +0200 Subject: [PATCH 03/72] Added basic Jenkinsfile --- Jenkinsfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..03232d367 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,41 @@ +pipeline { + agent any + + stages { + stage('Install dependencies') { + steps { + echo 'Install dependencies' + } + } + + stage('License check') { + steps { + echo 'License check' + } + } + + stage('Linter') { + steps { + echo 'Linter' + } + } + + stage('Unit test') { + steps { + echo 'Unit test' + } + } + + stage('OSS integration test') { + steps { + echo 'OSS integration test' + } + } + + stage('xPack integration test') { + steps { + echo 'xPack integration test' + } + } + } +} From bd32b66e368dcff7aa342b7bbd99d87481090b92 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 14:10:06 +0200 Subject: [PATCH 04/72] Updated Jenkinsfile --- Jenkinsfile | 64 ++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03232d367..c446aa714 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,41 +1,41 @@ pipeline { - agent any + agent any - stages { - stage('Install dependencies') { - steps { - echo 'Install dependencies' - } - } + stages { + stage('Install dependencies') { + steps { + echo 'Install dependencies' + } + } - stage('License check') { - steps { - echo 'License check' - } - } + stage('License check') { + steps { + echo 'License check' + } + } - stage('Linter') { - steps { - echo 'Linter' - } - } + stage('Linter') { + steps { + echo 'Linter' + } + } - stage('Unit test') { - steps { - echo 'Unit test' - } - } + stage('Unit test') { + steps { + echo 'Unit test' + } + } - stage('OSS integration test') { - steps { - echo 'OSS integration test' - } - } + stage('OSS integration test') { + steps { + echo 'OSS integration test' + } + } - stage('xPack integration test') { - steps { - echo 'xPack integration test' - } - } + stage('xPack integration test') { + steps { + echo 'xPack integration test' + } } + } } From 8f59d7bfaf481920b147b079d0203e030d18ca4d Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 14:39:57 +0200 Subject: [PATCH 05/72] Updated Jenkinsfile --- Jenkinsfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c446aa714..31024c90b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,22 +1,33 @@ pipeline { - agent any + agent { + docker { + image 'node:10-alpine' + } + } stages { + stage('System info') { + steps { + node --version + npm --version + } + } + stage('Install dependencies') { steps { - echo 'Install dependencies' + npm install } } stage('License check') { steps { - echo 'License check' + npm run license-checker } } stage('Linter') { steps { - echo 'Linter' + npm run lint } } From 9baf56a36ebe54fdf7c9698b53025bd25847c1c2 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 22 Jul 2019 14:42:05 +0200 Subject: [PATCH 06/72] Updated Jenkinsfile --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 31024c90b..466c84b06 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,26 +8,26 @@ pipeline { stages { stage('System info') { steps { - node --version - npm --version + sh 'node --version' + sh 'npm --version' } } stage('Install dependencies') { steps { - npm install + sh 'npm install' } } stage('License check') { steps { - npm run license-checker + sh 'npm run license-checker' } } stage('Linter') { steps { - npm run lint + sh 'npm run lint' } } From 166ec82f97dbbe2d91e04a537d6f550e4ffabfae Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 26 Jul 2019 13:12:58 +0100 Subject: [PATCH 07/72] [wip] Move from docker agent to labels (#924) * Move from docker agent to labels * Update Jenkinsfile * Update Jenkinsfile * Update Jenkinsfile * Update Jenkinsfile Co-Authored-By: Victor Martinez --- Jenkinsfile | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 466c84b06..e34284f71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,33 +1,58 @@ pipeline { - agent { - docker { - image 'node:10-alpine' - } + agent { + label 'linux && immutable' } stages { - stage('System info') { - steps { - sh 'node --version' - sh 'npm --version' - } - } - stage('Install dependencies') { steps { - sh 'npm install' + script { + docker.image('node:10-alpine').inside(){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh '''node --version + npm --version''' + sh 'npm install' + } + } + } } } stage('License check') { steps { - sh 'npm run license-checker' + script { + docker.image('node:10-alpine').inside(){ + sh 'npm run license-checker' + } + } } } stage('Linter') { steps { - sh 'npm run lint' + script { + docker.image('node:10-alpine').inside(){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh 'npm run lint' + } + } + } } } From f77a2d5dfea8b2e432e87ad02da03ff3cf0d3f71 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 14:35:55 +0200 Subject: [PATCH 08/72] Updated Jenkinsfile --- Jenkinsfile | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e34284f71..f4fdfdcc0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,11 +1,47 @@ +#!/usr/bin/env groovy + +library identifier: 'apm@current', +retriever: modernSCM( + [$class: 'GitSCMSource', + credentialsId: 'f94e9298-83ae-417e-ba91-85c279771570', + id: '37cf2c00-2cc7-482e-8c62-7bbffef475e2', + remote: 'git@github.com:elastic/apm-pipeline-library.git']) + pipeline { - agent { + agent { label 'linux && immutable' } + options { + timeout(time: 1, unit: 'HOURS') + buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30')) + timestamps() + ansiColor('xterm') + disableResume() + durabilityHint('PERFORMANCE_OPTIMIZED') + } + + triggers { + issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*') + } + stages { + stage('Checkout') { + agent { label 'master || immutable' } + options { skipDefaultCheckout() } + steps { + deleteDir() + gitCheckout(basedir: "src/github.com/elastic/elasticsearch-js", githubNotifyFirstTimeContributor: true) + stash allowEmpty: true, name: 'source', useDefaultExcludes: false + } + } + stage('Install dependencies') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } steps { + deleteDir() + unstash 'source' script { docker.image('node:10-alpine').inside(){ withEnv([ @@ -27,7 +63,11 @@ pipeline { } stage('License check') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } steps { + deleteDir() + unstash 'source' script { docker.image('node:10-alpine').inside(){ sh 'npm run license-checker' @@ -37,7 +77,11 @@ pipeline { } stage('Linter') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } steps { + deleteDir() + unstash 'source' script { docker.image('node:10-alpine').inside(){ withEnv([ @@ -57,18 +101,24 @@ pipeline { } stage('Unit test') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } steps { echo 'Unit test' } } stage('OSS integration test') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } steps { echo 'OSS integration test' } } stage('xPack integration test') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } steps { echo 'xPack integration test' } From d6eeecbc5b355ad9779c7a9028f1da8305e2dae1 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 14:50:08 +0200 Subject: [PATCH 09/72] Added env variables and stash dependencies --- Jenkinsfile | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f4fdfdcc0..dfcb54be3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,6 +12,11 @@ pipeline { label 'linux && immutable' } + environment { + REPO = 'elasticsearch-js' + BASE_DIR = "src/github.com/elastic/${env.REPO}" + } + options { timeout(time: 1, unit: 'HOURS') buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30')) @@ -31,7 +36,7 @@ pipeline { options { skipDefaultCheckout() } steps { deleteDir() - gitCheckout(basedir: "src/github.com/elastic/elasticsearch-js", githubNotifyFirstTimeContributor: true) + gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) stash allowEmpty: true, name: 'source', useDefaultExcludes: false } } @@ -43,7 +48,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image('node:10-alpine').inside(){ + docker.image('node:10-alpine').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){ withEnv([ /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ 'npm_config_cache=npm-cache', @@ -56,6 +61,7 @@ pipeline { sh '''node --version npm --version''' sh 'npm install' + stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } } @@ -67,10 +73,20 @@ pipeline { options { skipDefaultCheckout() } steps { deleteDir() - unstash 'source' + unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside(){ - sh 'npm run license-checker' + docker.image('node:10-alpine').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh 'npm run license-checker' + } } } } @@ -81,9 +97,9 @@ pipeline { options { skipDefaultCheckout() } steps { deleteDir() - unstash 'source' + unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside(){ + docker.image('node:10-alpine').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){ withEnv([ /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ 'npm_config_cache=npm-cache', From cdaab03fea64ea122eedb2f183dab49de2a82224 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 15:12:54 +0200 Subject: [PATCH 10/72] Debug ls --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index dfcb54be3..2aa016924 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,6 +58,7 @@ pipeline { */ 'HOME=.', ]) { + sh 'ls' sh '''node --version npm --version''' sh 'npm install' @@ -85,6 +86,7 @@ pipeline { */ 'HOME=.', ]) { + sh 'ls' sh 'npm run license-checker' } } From d42531c4d0f7bad7904631f3c0d014ddfc4e42d2 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 15:27:17 +0200 Subject: [PATCH 11/72] Debug ls --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2aa016924..0c417b1e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,6 +62,7 @@ pipeline { sh '''node --version npm --version''' sh 'npm install' + sh 'ls' stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } From ef1e4b1151fd84986ebff1d3c2989beeee319830 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 15:56:39 +0200 Subject: [PATCH 12/72] Updated dir handling --- Jenkinsfile | 85 +++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0c417b1e1..cf79f1deb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,6 +37,7 @@ pipeline { steps { deleteDir() gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) + sh 'ls' stash allowEmpty: true, name: 'source', useDefaultExcludes: false } } @@ -48,22 +49,24 @@ pipeline { deleteDir() unstash 'source' script { - docker.image('node:10-alpine').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh 'ls' - sh '''node --version - npm --version''' - sh 'npm install' - sh 'ls' - stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false + docker.image('node:10-alpine').inside(){ + dir("${BASE_DIR}"){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh 'ls' + sh '''node --version + npm --version''' + sh 'npm install' + sh 'ls' + stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false + } } } } @@ -77,18 +80,20 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh 'ls' - sh 'npm run license-checker' + docker.image('node:10-alpine').inside(){ + dir("${BASE_DIR}"){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh 'ls' + sh 'npm run license-checker' + } } } } @@ -102,17 +107,19 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside("-v ${WORKSPACE}/${BASE_DIR}:/app"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh 'npm run lint' + docker.image('node:10-alpine').inside(){ + dir("${BASE_DIR}"){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh 'npm run lint' + } } } } From b3ef2e0a69a0d148c3c731ba1b63ba8ab3f62fec Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 16:13:25 +0200 Subject: [PATCH 13/72] Added unit test step --- Jenkinsfile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cf79f1deb..03e4f41ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,8 +36,7 @@ pipeline { options { skipDefaultCheckout() } steps { deleteDir() - gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) - sh 'ls' + gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false) stash allowEmpty: true, name: 'source', useDefaultExcludes: false } } @@ -60,11 +59,9 @@ pipeline { */ 'HOME=.', ]) { - sh 'ls' sh '''node --version npm --version''' sh 'npm install' - sh 'ls' stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } @@ -91,7 +88,6 @@ pipeline { */ 'HOME=.', ]) { - sh 'ls' sh 'npm run license-checker' } } @@ -130,7 +126,27 @@ pipeline { agent { label 'docker && immutable' } options { skipDefaultCheckout() } steps { - echo 'Unit test' + deleteDir() + unstash 'source-dependencies' + script { + docker.image('node:10-alpine').inside(){ + dir("${BASE_DIR}"){ + withEnv([ + /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ + 'npm_config_cache=npm-cache', + /* set home to our current directory because other bower + * nonsense breaks with HOME=/, e.g.: + * EACCES: permission denied, mkdir '/.config' + */ + 'HOME=.', + ]) { + sh 'npm run test:unit' + sh 'npm run test:behavior' + sh 'npm run test:types' + } + } + } + } } } From 48527b4b4b6312b53ea8dcc19a5b29d287c01a5c Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 16:34:16 +0200 Subject: [PATCH 14/72] Updated agent handling and moved environment settings --- Jenkinsfile | 83 +++++++++++++++++------------------------------------ 1 file changed, 26 insertions(+), 57 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03e4f41ed..f0384d08d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ retriever: modernSCM( pipeline { agent { - label 'linux && immutable' + label 'docker && immutable' } environment { @@ -32,7 +32,6 @@ pipeline { stages { stage('Checkout') { - agent { label 'master || immutable' } options { skipDefaultCheckout() } steps { deleteDir() @@ -42,28 +41,21 @@ pipeline { } stage('Install dependencies') { - agent { label 'docker && immutable' } options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = "npm-cache" + } steps { deleteDir() unstash 'source' script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh '''node --version - npm --version''' - sh 'npm install' - stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false - } + sh '''node --version + npm --version''' + sh 'npm install' + stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } } @@ -71,25 +63,18 @@ pipeline { } stage('License check') { - agent { label 'docker && immutable' } options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = "npm-cache" + } steps { deleteDir() unstash 'source-dependencies' script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh 'npm run license-checker' - } + sh 'npm run license-checker' } } } @@ -97,25 +82,18 @@ pipeline { } stage('Linter') { - agent { label 'docker && immutable' } options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = "npm-cache" + } steps { deleteDir() unstash 'source-dependencies' script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh 'npm run lint' - } + sh 'npm run lint' } } } @@ -123,27 +101,20 @@ pipeline { } stage('Unit test') { - agent { label 'docker && immutable' } options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = "npm-cache" + } steps { deleteDir() unstash 'source-dependencies' script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - withEnv([ - /* Override the npm cache directory to avoid: EACCES: permission denied, mkdir '/.npm' */ - 'npm_config_cache=npm-cache', - /* set home to our current directory because other bower - * nonsense breaks with HOME=/, e.g.: - * EACCES: permission denied, mkdir '/.config' - */ - 'HOME=.', - ]) { - sh 'npm run test:unit' - sh 'npm run test:behavior' - sh 'npm run test:types' - } + sh 'npm run test:unit' + sh 'npm run test:behavior' + sh 'npm run test:types' } } } @@ -151,7 +122,6 @@ pipeline { } stage('OSS integration test') { - agent { label 'docker && immutable' } options { skipDefaultCheckout() } steps { echo 'OSS integration test' @@ -159,7 +129,6 @@ pipeline { } stage('xPack integration test') { - agent { label 'docker && immutable' } options { skipDefaultCheckout() } steps { echo 'xPack integration test' From 19734328bce7bae536d5033a858a25428be7f3b5 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 16:55:26 +0200 Subject: [PATCH 15/72] Updated es docker scripts --- scripts/es-docker-platinum.sh | 78 ++++++++++++++++++++++++----------- scripts/es-docker.sh | 32 +++++++++----- 2 files changed, 74 insertions(+), 36 deletions(-) diff --git a/scripts/es-docker-platinum.sh b/scripts/es-docker-platinum.sh index 03171a275..1b33a986d 100755 --- a/scripts/es-docker-platinum.sh +++ b/scripts/es-docker-platinum.sh @@ -10,31 +10,59 @@ testnodekey="/.ci/certs/testnode.key" cacrt="/.ci/certs/ca.crt" # pass `--clean` to reemove the old snapshot -if [ "$1" != "" ]; then +if [ "$1" == "--clean" ]; then docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') fi -exec docker run \ - --rm \ - -e "node.attr.testattr=test" \ - -e "path.repo=/tmp" \ - -e "repositories.url.allowed_urls=http://snapshot.*" \ - -e "discovery.type=single-node" \ - -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \ - -e "ELASTIC_PASSWORD=changeme" \ - -e "xpack.security.enabled=true" \ - -e "xpack.license.self_generated.type=trial" \ - -e "xpack.security.http.ssl.enabled=true" \ - -e "xpack.security.http.ssl.verification_mode=certificate" \ - -e "xpack.security.http.ssl.key=certs/testnode.key" \ - -e "xpack.security.http.ssl.certificate=certs/testnode.crt" \ - -e "xpack.security.http.ssl.certificate_authorities=certs/ca.crt" \ - -e "xpack.security.transport.ssl.enabled=true" \ - -e "xpack.security.transport.ssl.key=certs/testnode.key" \ - -e "xpack.security.transport.ssl.certificate=certs/testnode.crt" \ - -e "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt" \ - -v "$repo$testnodecrt:/usr/share/elasticsearch/config/certs/testnode.crt" \ - -v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \ - -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ - -p 9200:9200 \ - docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT +if [ "$1" == "--detach" ]; then + exec docker run \ + --rm \ + -e "node.attr.testattr=test" \ + -e "path.repo=/tmp" \ + -e "repositories.url.allowed_urls=http://snapshot.*" \ + -e "discovery.type=single-node" \ + -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \ + -e "ELASTIC_PASSWORD=changeme" \ + -e "xpack.security.enabled=true" \ + -e "xpack.license.self_generated.type=trial" \ + -e "xpack.security.http.ssl.enabled=true" \ + -e "xpack.security.http.ssl.verification_mode=certificate" \ + -e "xpack.security.http.ssl.key=certs/testnode.key" \ + -e "xpack.security.http.ssl.certificate=certs/testnode.crt" \ + -e "xpack.security.http.ssl.certificate_authorities=certs/ca.crt" \ + -e "xpack.security.transport.ssl.enabled=true" \ + -e "xpack.security.transport.ssl.key=certs/testnode.key" \ + -e "xpack.security.transport.ssl.certificate=certs/testnode.crt" \ + -e "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt" \ + -v "$repo$testnodecrt:/usr/share/elasticsearch/config/certs/testnode.crt" \ + -v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \ + -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ + -p 9200:9200 \ + --detach \ + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT +else + exec docker run \ + --rm \ + -e "node.attr.testattr=test" \ + -e "path.repo=/tmp" \ + -e "repositories.url.allowed_urls=http://snapshot.*" \ + -e "discovery.type=single-node" \ + -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \ + -e "ELASTIC_PASSWORD=changeme" \ + -e "xpack.security.enabled=true" \ + -e "xpack.license.self_generated.type=trial" \ + -e "xpack.security.http.ssl.enabled=true" \ + -e "xpack.security.http.ssl.verification_mode=certificate" \ + -e "xpack.security.http.ssl.key=certs/testnode.key" \ + -e "xpack.security.http.ssl.certificate=certs/testnode.crt" \ + -e "xpack.security.http.ssl.certificate_authorities=certs/ca.crt" \ + -e "xpack.security.transport.ssl.enabled=true" \ + -e "xpack.security.transport.ssl.key=certs/testnode.key" \ + -e "xpack.security.transport.ssl.certificate=certs/testnode.crt" \ + -e "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt" \ + -v "$repo$testnodecrt:/usr/share/elasticsearch/config/certs/testnode.crt" \ + -v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \ + -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ + -p 9200:9200 \ + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT +fi diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index 794e77684..79fe84b58 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -5,17 +5,27 @@ # the latest snapshot. # pass `--clean` to reemove the old snapshot -if [ "$1" != "" ]; then +if [ "$1" == "--clean" ]; then docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') fi -exec docker run \ - --rm \ - -e "node.attr.testattr=test" \ - -e "path.repo=/tmp" \ - -e "repositories.url.allowed_urls=http://snapshot.*" \ - -e "discovery.type=single-node" \ - -p 9200:9200 \ - --network=elastic \ - --name=elasticsearch \ - docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT +if [ "$1" == "--detach" ]; then + exec docker run \ + --rm \ + -e "node.attr.testattr=test" \ + -e "path.repo=/tmp" \ + -e "repositories.url.allowed_urls=http://snapshot.*" \ + -e "discovery.type=single-node" \ + -p 9200:9200 \ + --detach \ + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT +else + exec docker run \ + --rm \ + -e "node.attr.testattr=test" \ + -e "path.repo=/tmp" \ + -e "repositories.url.allowed_urls=http://snapshot.*" \ + -e "discovery.type=single-node" \ + -p 9200:9200 \ + docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT +fi From 859d42e5744e919c6257d2ae294fa22c0990fb47 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 16:55:35 +0200 Subject: [PATCH 16/72] Added oss integration step --- Jenkinsfile | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f0384d08d..e15669389 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,7 @@ pipeline { options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" - npm_config_cache = "npm-cache" + npm_config_cache = 'npm-cache' } steps { deleteDir() @@ -66,7 +66,7 @@ pipeline { options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" - npm_config_cache = "npm-cache" + npm_config_cache = 'npm-cache' } steps { deleteDir() @@ -85,7 +85,7 @@ pipeline { options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" - npm_config_cache = "npm-cache" + npm_config_cache = 'npm-cache' } steps { deleteDir() @@ -104,7 +104,7 @@ pipeline { options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" - npm_config_cache = "npm-cache" + npm_config_cache = 'npm-cache' } steps { deleteDir() @@ -123,8 +123,23 @@ pipeline { stage('OSS integration test') { options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + } steps { - echo 'OSS integration test' + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + sh './scripts/es-docker.sh --detach' + } + script { + docker.image('node:10-alpine').inside(){ + dir("${BASE_DIR}"){ + sh 'npm run test:integration' + } + } + } } } From 0ac3d248df81439f9c708abf72d5e8ff7a035506 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 17:08:12 +0200 Subject: [PATCH 17/72] Refactor oss integration test step --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e15669389..bd177230c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -130,13 +130,12 @@ pipeline { steps { deleteDir() unstash 'source-dependencies' - dir("${BASE_DIR}"){ - sh './scripts/es-docker.sh --detach' - } script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - sh 'npm run test:integration' + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + sh(label: 'Integration test', script: 'npm run test:integration') + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } } From c82418fb4e4359468b2b0875feb5eec3433665c9 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 17:12:31 +0200 Subject: [PATCH 18/72] Debug logs --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bd177230c..02d17f83b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -133,9 +133,10 @@ pipeline { script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') - sh(label: 'Integration test', script: 'npm run test:integration') - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') + // sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + // sh(label: 'Integration test', script: 'npm run test:integration') + // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } } From aeb6b0ff6bef1296e789874cbffee190100a4563 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 17:39:27 +0200 Subject: [PATCH 19/72] Moved stash outside of script block --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 02d17f83b..14536464b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,10 +55,10 @@ pipeline { sh '''node --version npm --version''' sh 'npm install' - stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } } + stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } From 86fb91dc80e7faceded97e622a85562ce13dec48 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 17:44:15 +0200 Subject: [PATCH 20/72] Updated oss integration test script --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 14536464b..1b09bc741 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -133,10 +133,9 @@ pipeline { script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - // sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') - // sh(label: 'Integration test', script: 'npm run test:integration') - // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + sh(label: 'Integration test', script: 'npm run test:integration') + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } } From 1114b04f3737c29f8c6f1c20402941e650ae3660 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 17:50:00 +0200 Subject: [PATCH 21/72] Debug logs --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1b09bc741..36858c126 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -133,6 +133,7 @@ pipeline { script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ + sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') sh(label: 'Integration test', script: 'npm run test:integration') sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') From dd22f279077f4d009cf152f029085971e1d97bb2 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 26 Jul 2019 17:55:03 +0200 Subject: [PATCH 22/72] Updated path --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 36858c126..919e0e7d5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -134,7 +134,7 @@ pipeline { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + sh(label: 'Start Elasticsearch', script: 'scripts/es-docker.sh --detach') sh(label: 'Integration test', script: 'npm run test:integration') sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } From 595ca63a6abdfdb2e9b83a6c1bedd07a234a127c Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 12:41:40 +0200 Subject: [PATCH 23/72] Try with npm script --- Jenkinsfile | 2 +- package.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 919e0e7d5..7922fd3a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -134,7 +134,7 @@ pipeline { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'Start Elasticsearch', script: 'scripts/es-docker.sh --detach') + sh(label: 'Start Elasticsearch', script: 'npm run elasticsearch -- --detach') sh(label: 'Integration test', script: 'npm run test:integration') sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } diff --git a/package.json b/package.json index 38126cdf7..044d8d81b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "lint": "standard", "lint:fix": "standard --fix", "ci": "npm run license-checker && npm test && npm run test:integration && npm run test:coverage", - "license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause'" + "license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause'", + "elasticsearch": "./scripts/es-docker.sh", + "elasticsearch:xpack": "./scripts/es-docker-platinum.sh" }, "author": { "name": "Tomas Della Vedova", From 9874648b90e57b7bdca3442ccbf0ddc6eff299b4 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 12:48:24 +0200 Subject: [PATCH 24/72] Use BASE_DIR --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7922fd3a2..94585d849 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -134,7 +134,7 @@ pipeline { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'Start Elasticsearch', script: 'npm run elasticsearch -- --detach') + sh(label: 'Start Elasticsearch', script: "${BASE_DIR}/scripts/es-docker.sh --detach") sh(label: 'Integration test', script: 'npm run test:integration') sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } From 2bc64163fd71ee434deec35b297686cb81bb9a95 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 13:34:18 +0200 Subject: [PATCH 25/72] More debug checks --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 94585d849..ff8e8dcf2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -134,7 +134,8 @@ pipeline { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'Start Elasticsearch', script: "${BASE_DIR}/scripts/es-docker.sh --detach") + sh(label: 'debug checks', script: 'cd scripts && cat es-docker.sh') + sh(label: 'Start Elasticsearch', script: "npm run elasticsearch -- --detach") sh(label: 'Integration test', script: 'npm run test:integration') sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } From 96a539589188205d23050831a857de4895df6ef7 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 14:30:36 +0200 Subject: [PATCH 26/72] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ff8e8dcf2..53bf72b2b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,7 +131,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside(){ + docker.image('node:10-alpine').inside("-v \$(which docker):\$(which docker) -v /var/run/docker.sock:/var/run/docker.sock"){ dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') sh(label: 'debug checks', script: 'cd scripts && cat es-docker.sh') From ba5e7ef683faaee405a6fe2befb4e73f25c84ad4 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 14:42:42 +0200 Subject: [PATCH 27/72] Fix --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 53bf72b2b..6d440fbb1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,7 +131,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside("-v \$(which docker):\$(which docker) -v /var/run/docker.sock:/var/run/docker.sock"){ + docker.image('node:10-alpine').inside("-v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock"){ dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') sh(label: 'debug checks', script: 'cd scripts && cat es-docker.sh') From 5a422a7b01ee639f3dd8a6822c814ef56b6add4c Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 15:22:22 +0200 Subject: [PATCH 28/72] Updated elasticsearch script and Jenkinsfile --- Jenkinsfile | 9 ++++----- scripts/es-docker.sh | 7 +++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6d440fbb1..b4627a41d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -126,21 +126,20 @@ pipeline { environment { HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' + TEST_ES_SERVER='http://elasticsearch:9200' } steps { deleteDir() unstash 'source-dependencies' + sh(label: 'Start Elasticsearch', script: "npm run elasticsearch -- --detach") script { - docker.image('node:10-alpine').inside("-v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock"){ + docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ - sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'debug checks', script: 'cd scripts && cat es-docker.sh') - sh(label: 'Start Elasticsearch', script: "npm run elasticsearch -- --detach") sh(label: 'Integration test', script: 'npm run test:integration') - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index 79fe84b58..d443ea99a 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -9,6 +9,9 @@ if [ "$1" == "--clean" ]; then docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') fi +# Create the 'elasticì network if doesn't exist +exec docker network ls | grep elastic > /dev/null || docker network create elastic > /dev/null + if [ "$1" == "--detach" ]; then exec docker run \ --rm \ @@ -18,6 +21,8 @@ if [ "$1" == "--detach" ]; then -e "discovery.type=single-node" \ -p 9200:9200 \ --detach \ + --network=elastic \ + --name=elasticsearch docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT else exec docker run \ @@ -27,5 +32,7 @@ else -e "repositories.url.allowed_urls=http://snapshot.*" \ -e "discovery.type=single-node" \ -p 9200:9200 \ + --network=elastic \ + --name=elasticsearch docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT fi From a46bac57c909df0e0f884738a2403b69eba34de1 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 15:26:39 +0200 Subject: [PATCH 29/72] Use the correct context --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b4627a41d..f7c0ba9eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,7 +131,10 @@ pipeline { steps { deleteDir() unstash 'source-dependencies' - sh(label: 'Start Elasticsearch', script: "npm run elasticsearch -- --detach") + dir("${BASE_DIR}"){ + sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') + sh(label: 'Start Elasticsearch', script: "npm run elasticsearch -- --detach") + } script { docker.image('node:10-alpine').inside(){ dir("${BASE_DIR}"){ From affd927f9bcdd5ede4296f47f1c7b9078e2b5aa6 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 15:39:36 +0200 Subject: [PATCH 30/72] Fixes --- Jenkinsfile | 2 +- scripts/es-docker.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f7c0ba9eb..0b44cf344 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -133,7 +133,7 @@ pipeline { unstash 'source-dependencies' dir("${BASE_DIR}"){ sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'Start Elasticsearch', script: "npm run elasticsearch -- --detach") + sh(label: 'Start Elasticsearch', script: "./scripts/es-docker.sh --detach") } script { docker.image('node:10-alpine').inside(){ diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index d443ea99a..ce6760a40 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -22,7 +22,7 @@ if [ "$1" == "--detach" ]; then -p 9200:9200 \ --detach \ --network=elastic \ - --name=elasticsearch + --name=elasticsearch \ docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT else exec docker run \ @@ -33,6 +33,6 @@ else -e "discovery.type=single-node" \ -p 9200:9200 \ --network=elastic \ - --name=elasticsearch + --name=elasticsearch \ docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT fi From 1898e3413cabc37f9d08247b3d3510a86e4dae71 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 15:51:41 +0200 Subject: [PATCH 31/72] Use elastic network --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b44cf344..f68d467c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -136,7 +136,7 @@ pipeline { sh(label: 'Start Elasticsearch', script: "./scripts/es-docker.sh --detach") } script { - docker.image('node:10-alpine').inside(){ + docker.image('node:10-alpine').inside('--network=elastic'){ dir("${BASE_DIR}"){ sh(label: 'Integration test', script: 'npm run test:integration') } From 2b5f47b520b3ce877133bf7403082d18dd6d7ae1 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 16:24:38 +0200 Subject: [PATCH 32/72] Use root user --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f68d467c6..3cb52374d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -136,7 +136,7 @@ pipeline { sh(label: 'Start Elasticsearch', script: "./scripts/es-docker.sh --detach") } script { - docker.image('node:10-alpine').inside('--network=elastic'){ + docker.image('node:10-alpine').inside('--network=elastic --user=root'){ dir("${BASE_DIR}"){ sh(label: 'Integration test', script: 'npm run test:integration') } From cc4e3cf8a55115812c8543a8fa0843b69b22d2cd Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 17:01:36 +0200 Subject: [PATCH 33/72] Add git --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3cb52374d..54a9d9747 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -138,6 +138,7 @@ pipeline { script { docker.image('node:10-alpine').inside('--network=elastic --user=root'){ dir("${BASE_DIR}"){ + sh('Installing git', script: 'apk --no-cache add git') sh(label: 'Integration test', script: 'npm run test:integration') } } From 52032d1d957f519077cbdd01b645c11b2a9a2893 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 17:08:40 +0200 Subject: [PATCH 34/72] Fix script --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 54a9d9747..519210e05 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -138,7 +138,7 @@ pipeline { script { docker.image('node:10-alpine').inside('--network=elastic --user=root'){ dir("${BASE_DIR}"){ - sh('Installing git', script: 'apk --no-cache add git') + sh(label: 'Installing git', script: 'apk --no-cache add git') sh(label: 'Integration test', script: 'npm run test:integration') } } From 1efdc84663127b4ed245d1f8ebd956e911035ce6 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 18:02:28 +0200 Subject: [PATCH 35/72] Comment stage --- Jenkinsfile | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 519210e05..c65e6478c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -121,31 +121,30 @@ pipeline { } } - stage('OSS integration test') { - options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - TEST_ES_SERVER='http://elasticsearch:9200' - } - steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - sh(label: 'check folder', script: 'pwd && ls -la && ls -la scripts') - sh(label: 'Start Elasticsearch', script: "./scripts/es-docker.sh --detach") - } - script { - docker.image('node:10-alpine').inside('--network=elastic --user=root'){ - dir("${BASE_DIR}"){ - sh(label: 'Installing git', script: 'apk --no-cache add git') - sh(label: 'Integration test', script: 'npm run test:integration') - } - } - } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - } - } + // stage('OSS integration test') { + // options { skipDefaultCheckout() } + // environment { + // HOME = "${env.WORKSPACE}" + // npm_config_cache = 'npm-cache' + // TEST_ES_SERVER='http://elasticsearch:9200' + // } + // steps { + // deleteDir() + // unstash 'source-dependencies' + // dir("${BASE_DIR}"){ + // sh(label: 'Start Elasticsearch', script: "./scripts/es-docker.sh --detach") + // } + // script { + // docker.image('node:10-alpine').inside('--network=elastic --user=root'){ + // dir("${BASE_DIR}"){ + // sh(label: 'Installing git', script: 'apk --no-cache add git') + // sh(label: 'Integration test', script: 'npm run test:integration') + // } + // } + // } + // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + // } + // } stage('xPack integration test') { options { skipDefaultCheckout() } From 2a9e350c75ac4c52761840570add84bc2561221d Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 18:20:58 +0200 Subject: [PATCH 36/72] Reenable stage --- Jenkinsfile | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c65e6478c..27a949687 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -121,30 +121,30 @@ pipeline { } } - // stage('OSS integration test') { - // options { skipDefaultCheckout() } - // environment { - // HOME = "${env.WORKSPACE}" - // npm_config_cache = 'npm-cache' - // TEST_ES_SERVER='http://elasticsearch:9200' - // } - // steps { - // deleteDir() - // unstash 'source-dependencies' - // dir("${BASE_DIR}"){ - // sh(label: 'Start Elasticsearch', script: "./scripts/es-docker.sh --detach") - // } - // script { - // docker.image('node:10-alpine').inside('--network=elastic --user=root'){ - // dir("${BASE_DIR}"){ - // sh(label: 'Installing git', script: 'apk --no-cache add git') - // sh(label: 'Integration test', script: 'npm run test:integration') - // } - // } - // } - // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - // } - // } + stage('OSS integration test') { + options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + TEST_ES_SERVER = 'http://elasticsearch:9200' + } + steps { + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + } + script { + docker.image('node:10-alpine').inside('--network=elastic'){ + dir("${BASE_DIR}"){ + sh(label: 'Installing git', script: 'apk --no-cache add git') + sh(label: 'Integration test', script: 'npm run test:integration') + } + } + } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + } + } stage('xPack integration test') { options { skipDefaultCheckout() } From 7df6cbe016fe1a5a069fec309c88adde8cce8234 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 18:26:57 +0200 Subject: [PATCH 37/72] Run the script as root --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 27a949687..c524dcfe0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -135,7 +135,7 @@ pipeline { sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') } script { - docker.image('node:10-alpine').inside('--network=elastic'){ + docker.image('node:10-alpine').inside('--network=elastic --user=root'){ dir("${BASE_DIR}"){ sh(label: 'Installing git', script: 'apk --no-cache add git') sh(label: 'Integration test', script: 'npm run test:integration') From 3755c7dfdecd8528bffd64462b3288046cef4998 Mon Sep 17 00:00:00 2001 From: delvedor Date: Mon, 29 Jul 2019 18:59:16 +0200 Subject: [PATCH 38/72] Added xpack stage --- Jenkinsfile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c524dcfe0..2267cdc30 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,8 +148,26 @@ pipeline { stage('xPack integration test') { options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + TEST_ES_SERVER = 'https://elastic:changeme@localhost:9200' + } steps { - echo 'xPack integration test' + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + } + script { + docker.image('node:10-alpine').inside('--network=elastic --user=root'){ + dir("${BASE_DIR}"){ + sh(label: 'Installing git', script: 'apk --no-cache add git') + sh(label: 'Integration test', script: 'npm run test:integration') + } + } + } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } } From 745a6248d97a031da2879d9740cc5b2da77464d5 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 12:10:03 +0200 Subject: [PATCH 39/72] Use a custom Dockerfile --- .ci/PipelineDockerfile | 7 +++++++ Jenkinsfile | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .ci/PipelineDockerfile diff --git a/.ci/PipelineDockerfile b/.ci/PipelineDockerfile new file mode 100644 index 000000000..d4d9dd858 --- /dev/null +++ b/.ci/PipelineDockerfile @@ -0,0 +1,7 @@ +ARG NODE_JS_VERSION=10 +FROM node:${NODE_JS_VERSION} + +RUN apk --no-cache add git + +# Create app directory +WORKDIR /usr/src/app diff --git a/Jenkinsfile b/Jenkinsfile index 2267cdc30..22ebf8235 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -135,9 +135,8 @@ pipeline { sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') } script { - docker.image('node:10-alpine').inside('--network=elastic --user=root'){ + nodejs() { dir("${BASE_DIR}"){ - sh(label: 'Installing git', script: 'apk --no-cache add git') sh(label: 'Integration test', script: 'npm run test:integration') } } @@ -160,9 +159,8 @@ pipeline { sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') } script { - docker.image('node:10-alpine').inside('--network=elastic --user=root'){ + nodejs() { dir("${BASE_DIR}"){ - sh(label: 'Installing git', script: 'apk --no-cache add git') sh(label: 'Integration test', script: 'npm run test:integration') } } @@ -172,3 +170,10 @@ pipeline { } } } + +def nodejs(Closure body){ + def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=10 ${BASE_DIR}/.ci/PipelineDockerfile") + nodejsDocker.inside('--network=elastic'){ + body() + } +} From 1597c3f02d81839c5a9e568d815a2d6f04fd0a68 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 12:15:53 +0200 Subject: [PATCH 40/72] Use a folder --- .ci/{PipelineDockerfile => docker/Dockerfile} | 0 Jenkinsfile | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .ci/{PipelineDockerfile => docker/Dockerfile} (100%) diff --git a/.ci/PipelineDockerfile b/.ci/docker/Dockerfile similarity index 100% rename from .ci/PipelineDockerfile rename to .ci/docker/Dockerfile diff --git a/Jenkinsfile b/Jenkinsfile index 22ebf8235..5eeac3286 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -172,7 +172,7 @@ pipeline { } def nodejs(Closure body){ - def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=10 ${BASE_DIR}/.ci/PipelineDockerfile") + def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=10 ${BASE_DIR}/.ci/docker") nodejsDocker.inside('--network=elastic'){ body() } From 8037e19a4c70e617a24bf584cb923148775806de Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 12:23:24 +0200 Subject: [PATCH 41/72] Use alpine version --- .ci/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/Dockerfile b/.ci/docker/Dockerfile index d4d9dd858..2f37234ae 100644 --- a/.ci/docker/Dockerfile +++ b/.ci/docker/Dockerfile @@ -1,5 +1,5 @@ ARG NODE_JS_VERSION=10 -FROM node:${NODE_JS_VERSION} +FROM node:${NODE_JS_VERSION}-alpine RUN apk --no-cache add git From 1e0296a2bf8e269e59d286399aae50baac434a35 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 12:49:51 +0200 Subject: [PATCH 42/72] Fix host --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5eeac3286..69e94d54a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -150,7 +150,7 @@ pipeline { environment { HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' - TEST_ES_SERVER = 'https://elastic:changeme@localhost:9200' + TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' } steps { deleteDir() From 653beb641497d5678e7bd3a3a0a63881fec7c78c Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 13:45:10 +0200 Subject: [PATCH 43/72] Updated elasticsearch docker scripts --- scripts/es-docker-platinum.sh | 7 +++++++ scripts/es-docker.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/es-docker-platinum.sh b/scripts/es-docker-platinum.sh index 1b33a986d..930e124cc 100755 --- a/scripts/es-docker-platinum.sh +++ b/scripts/es-docker-platinum.sh @@ -14,6 +14,9 @@ if [ "$1" == "--clean" ]; then docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') fi +# Create the 'elastic' network if doesn't exist +exec docker network ls | grep elastic > /dev/null || docker network create elastic > /dev/null + if [ "$1" == "--detach" ]; then exec docker run \ --rm \ @@ -39,6 +42,8 @@ if [ "$1" == "--detach" ]; then -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ -p 9200:9200 \ --detach \ + --network=elastic \ + --name=elasticsearch \ docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT else exec docker run \ @@ -64,5 +69,7 @@ else -v "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \ -v "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \ -p 9200:9200 \ + --network=elastic \ + --name=elasticsearch \ docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT fi diff --git a/scripts/es-docker.sh b/scripts/es-docker.sh index ce6760a40..76677974e 100755 --- a/scripts/es-docker.sh +++ b/scripts/es-docker.sh @@ -9,7 +9,7 @@ if [ "$1" == "--clean" ]; then docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep '8.0.0-SNAPSHOT') fi -# Create the 'elasticì network if doesn't exist +# Create the 'elastic' network if doesn't exist exec docker network ls | grep elastic > /dev/null || docker network create elastic > /dev/null if [ "$1" == "--detach" ]; then From 8aa12517071f62de6f91a023dc851e6783517559 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 16:50:14 +0200 Subject: [PATCH 44/72] Move nodejsversion to its own variable --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 69e94d54a..fcf447ac0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ #!/usr/bin/env groovy +def nodejsDefaultVersion = '10' + library identifier: 'apm@current', retriever: modernSCM( [$class: 'GitSCMSource', @@ -50,7 +52,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image('node:10-alpine').inside(){ + docker.image("node:${nodejsDefaultVersion}-alpine").inside(){ dir("${BASE_DIR}"){ sh '''node --version npm --version''' @@ -72,7 +74,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside(){ + docker.image("node:${nodejsDefaultVersion}-alpine").inside(){ dir("${BASE_DIR}"){ sh 'npm run license-checker' } @@ -91,7 +93,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image('node:10-alpine').inside(){ + docker.image("node:${nodejsDefaultVersion}-alpine").inside(){ dir("${BASE_DIR}"){ sh 'npm run lint' } @@ -172,7 +174,7 @@ pipeline { } def nodejs(Closure body){ - def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=10 ${BASE_DIR}/.ci/docker") + def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${nodejsDefaultVersion} ${BASE_DIR}/.ci/docker") nodejsDocker.inside('--network=elastic'){ body() } From 868a54fd0043f77133e04a74de9876ac7e90d57d Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 16:55:18 +0200 Subject: [PATCH 45/72] Run unit test in parallel --- Jenkinsfile | 74 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fcf447ac0..7f50e8677 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -103,20 +103,68 @@ pipeline { } stage('Unit test') { + failFast true options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } - steps { - deleteDir() - unstash 'source-dependencies' - script { - docker.image('node:10-alpine').inside(){ - dir("${BASE_DIR}"){ - sh 'npm run test:unit' - sh 'npm run test:behavior' - sh 'npm run test:types' + parallel{ + stage('Node.js v8') { + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + } + steps { + deleteDir() + unstash 'source' + script { + docker.image('node:8-alpine').inside(){ + dir("${BASE_DIR}"){ + sh 'npm install' + sh 'npm run test:unit' + sh 'npm run test:behavior' + sh 'npm run test:types' + } + } + } + } + } + + stage('Node.js v10') { + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + } + steps { + deleteDir() + unstash 'source' + script { + docker.image('node:10-alpine').inside(){ + dir("${BASE_DIR}"){ + sh 'npm install' + sh 'npm run test:unit' + sh 'npm run test:behavior' + sh 'npm run test:types' + } + } + } + } + } + + stage('Node.js v12') { + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + } + steps { + deleteDir() + unstash 'source' + script { + docker.image('node:12-alpine').inside(){ + dir("${BASE_DIR}"){ + sh 'npm install' + sh 'npm run test:unit' + sh 'npm run test:behavior' + sh 'npm run test:types' + } + } } } } From 3f8f28424b28e96617b9972f0e5e942ab7a98d00 Mon Sep 17 00:00:00 2001 From: delvedor Date: Tue, 30 Jul 2019 17:48:53 +0200 Subject: [PATCH 46/72] Use a custom agent for the parallel build --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7f50e8677..2fc7b880f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -107,6 +107,8 @@ pipeline { options { skipDefaultCheckout() } parallel{ stage('Node.js v8') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' @@ -128,6 +130,8 @@ pipeline { } stage('Node.js v10') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' @@ -149,6 +153,8 @@ pipeline { } stage('Node.js v12') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } environment { HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' From 77cf22815277e064b13545587a2e7a3ffcc6e7cb Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 10:06:10 +0200 Subject: [PATCH 47/72] Use env variable --- Jenkinsfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2fc7b880f..9980df2f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,5 @@ #!/usr/bin/env groovy -def nodejsDefaultVersion = '10' - library identifier: 'apm@current', retriever: modernSCM( [$class: 'GitSCMSource', @@ -17,6 +15,7 @@ pipeline { environment { REPO = 'elasticsearch-js' BASE_DIR = "src/github.com/elastic/${env.REPO}" + NODE_JS_DEFAULT_VERSION = '10 } options { @@ -52,7 +51,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image("node:${nodejsDefaultVersion}-alpine").inside(){ + docker.image("node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ sh '''node --version npm --version''' @@ -74,7 +73,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image("node:${nodejsDefaultVersion}-alpine").inside(){ + docker.image("node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ sh 'npm run license-checker' } @@ -93,7 +92,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image("node:${nodejsDefaultVersion}-alpine").inside(){ + docker.image("node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ sh 'npm run lint' } @@ -228,7 +227,7 @@ pipeline { } def nodejs(Closure body){ - def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${nodejsDefaultVersion} ${BASE_DIR}/.ci/docker") + def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") nodejsDocker.inside('--network=elastic'){ body() } From 46fecae55d872795754464778d9de1344da1b36e Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 10:19:51 +0200 Subject: [PATCH 48/72] Fix string --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9980df2f0..460899fcf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { environment { REPO = 'elasticsearch-js' BASE_DIR = "src/github.com/elastic/${env.REPO}" - NODE_JS_DEFAULT_VERSION = '10 + NODE_JS_DEFAULT_VERSION = '10' } options { From 7b016a94ac4572173a4e737effc80a6a1f8f644a Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 11:10:55 +0200 Subject: [PATCH 49/72] Paralellize integration test --- Jenkinsfile | 80 +++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 460899fcf..b9d196d91 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -104,7 +104,7 @@ pipeline { stage('Unit test') { failFast true options { skipDefaultCheckout() } - parallel{ + parallel { stage('Node.js v8') { agent { label 'docker && immutable' } options { skipDefaultCheckout() } @@ -176,51 +176,59 @@ pipeline { } } - stage('OSS integration test') { + stage('Integration test') { + failFast true options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - TEST_ES_SERVER = 'http://elasticsearch:9200' - } - steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') - } - script { - nodejs() { + parallel { + stage('OSS') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + TEST_ES_SERVER = 'http://elasticsearch:9200' + } + steps { + deleteDir() + unstash 'source-dependencies' dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration') + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') } + script { + nodejs() { + dir("${BASE_DIR}"){ + sh(label: 'Integration test', script: 'npm run test:integration') + } + } + } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - } - } - stage('xPack integration test') { - options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' - } - steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') - } - script { - nodejs() { + stage('xPack') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' + } + steps { + deleteDir() + unstash 'source-dependencies' dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration') + sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + } + script { + nodejs() { + dir("${BASE_DIR}"){ + sh(label: 'Integration test', script: 'npm run test:integration') + } + } } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') } } } From 80ae2b071988adc745efc55388df9514f17665da Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 11:58:14 +0200 Subject: [PATCH 50/72] Comment out integration test --- Jenkinsfile | 108 ++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b9d196d91..06c90cfd0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -176,61 +176,61 @@ pipeline { } } - stage('Integration test') { - failFast true - options { skipDefaultCheckout() } - parallel { - stage('OSS') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - TEST_ES_SERVER = 'http://elasticsearch:9200' - } - steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') - } - script { - nodejs() { - dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration') - } - } - } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - } - } + // stage('Integration test') { + // failFast true + // options { skipDefaultCheckout() } + // parallel { + // stage('OSS') { + // agent { label 'docker && immutable' } + // options { skipDefaultCheckout() } + // environment { + // HOME = "${env.WORKSPACE}" + // npm_config_cache = 'npm-cache' + // TEST_ES_SERVER = 'http://elasticsearch:9200' + // } + // steps { + // deleteDir() + // unstash 'source-dependencies' + // dir("${BASE_DIR}"){ + // sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + // } + // script { + // nodejs() { + // dir("${BASE_DIR}"){ + // sh(label: 'Integration test', script: 'npm run test:integration') + // } + // } + // } + // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + // } + // } - stage('xPack') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' - } - steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') - } - script { - nodejs() { - dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration') - } - } - } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - } - } - } - } + // stage('xPack') { + // agent { label 'docker && immutable' } + // options { skipDefaultCheckout() } + // environment { + // HOME = "${env.WORKSPACE}" + // npm_config_cache = 'npm-cache' + // TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' + // } + // steps { + // deleteDir() + // unstash 'source-dependencies' + // dir("${BASE_DIR}"){ + // sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + // } + // script { + // nodejs() { + // dir("${BASE_DIR}"){ + // sh(label: 'Integration test', script: 'npm run test:integration') + // } + // } + // } + // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + // } + // } + // } + // } } } From 3c5fcec7120fc7df2f9ce7e68b2c25f223cf2422 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 12:36:30 +0200 Subject: [PATCH 51/72] Added docker retry and reenabled integration test --- Jenkinsfile | 139 +++++++++++++++++++++++++++++----------------------- 1 file changed, 77 insertions(+), 62 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 06c90cfd0..496a196fc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,7 +51,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image("node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ sh '''node --version npm --version''' @@ -73,7 +73,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image("node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ sh 'npm run license-checker' } @@ -92,7 +92,7 @@ pipeline { deleteDir() unstash 'source-dependencies' script { - docker.image("node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ sh 'npm run lint' } @@ -116,7 +116,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image('node:8-alpine').inside(){ + buildDockerImage(image: 'node:8-alpine').inside(){ dir("${BASE_DIR}"){ sh 'npm install' sh 'npm run test:unit' @@ -139,7 +139,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image('node:10-alpine').inside(){ + buildDockerImage(image: 'node:10-alpine').inside(){ dir("${BASE_DIR}"){ sh 'npm install' sh 'npm run test:unit' @@ -162,7 +162,7 @@ pipeline { deleteDir() unstash 'source' script { - docker.image('node:12-alpine').inside(){ + buildDockerImage(image: 'node:12-alpine').inside(){ dir("${BASE_DIR}"){ sh 'npm install' sh 'npm run test:unit' @@ -176,67 +176,82 @@ pipeline { } } - // stage('Integration test') { - // failFast true - // options { skipDefaultCheckout() } - // parallel { - // stage('OSS') { - // agent { label 'docker && immutable' } - // options { skipDefaultCheckout() } - // environment { - // HOME = "${env.WORKSPACE}" - // npm_config_cache = 'npm-cache' - // TEST_ES_SERVER = 'http://elasticsearch:9200' - // } - // steps { - // deleteDir() - // unstash 'source-dependencies' - // dir("${BASE_DIR}"){ - // sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') - // } - // script { - // nodejs() { - // dir("${BASE_DIR}"){ - // sh(label: 'Integration test', script: 'npm run test:integration') - // } - // } - // } - // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - // } - // } - - // stage('xPack') { - // agent { label 'docker && immutable' } - // options { skipDefaultCheckout() } - // environment { - // HOME = "${env.WORKSPACE}" - // npm_config_cache = 'npm-cache' - // TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' - // } - // steps { - // deleteDir() - // unstash 'source-dependencies' - // dir("${BASE_DIR}"){ - // sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') - // } - // script { - // nodejs() { - // dir("${BASE_DIR}"){ - // sh(label: 'Integration test', script: 'npm run test:integration') - // } - // } - // } - // sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - // } - // } - // } - // } + stage('Integration test') { + failFast true + options { skipDefaultCheckout() } + parallel { + stage('OSS') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + TEST_ES_SERVER = 'http://elasticsearch:9200' + } + steps { + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + } + script { + nodejs() { + dir("${BASE_DIR}"){ + sh(label: 'Integration test', script: 'npm run test:integration') + } + } + } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + } + } + + stage('xPack') { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } + environment { + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' + TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' + } + steps { + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + } + script { + nodejs() { + dir("${BASE_DIR}"){ + sh(label: 'Integration test', script: 'npm run test:integration') + } + } + } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + } + } + } + } } } def nodejs(Closure body){ - def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") + // Sometimes the docker registry fails and has random timeouts + // this block will retry a doker image 3 times before to fail. + retry(3) { + sleep randomNumber(min: 5, max: 10) + def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") + } nodejsDocker.inside('--network=elastic'){ body() } } + +// Sometimes the docker registry fails and has random timeouts +// this function will retry a doker image 3 times before to fail. +def buildDockerImage(args) { + retry(3) { + sleep randomNumber(min: 5, max: 10) + def image = docker.image(args.image) + } + return image +} From 43ebff7607d012a844af10c18705964c0e275945 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 13:28:22 +0200 Subject: [PATCH 52/72] Fix scope --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 496a196fc..a5dae9459 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -237,9 +237,10 @@ pipeline { def nodejs(Closure body){ // Sometimes the docker registry fails and has random timeouts // this block will retry a doker image 3 times before to fail. + def nodejsDocker retry(3) { sleep randomNumber(min: 5, max: 10) - def nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") + nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") } nodejsDocker.inside('--network=elastic'){ body() @@ -249,9 +250,10 @@ def nodejs(Closure body){ // Sometimes the docker registry fails and has random timeouts // this function will retry a doker image 3 times before to fail. def buildDockerImage(args) { + def image retry(3) { sleep randomNumber(min: 5, max: 10) - def image = docker.image(args.image) + image = docker.image(args.image) } return image } From c9905c6d241340242b6ccf1e676e27b8f11cb8af Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 13:56:35 +0200 Subject: [PATCH 53/72] Added retry also for es docker --- Jenkinsfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a5dae9459..95c460e9b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -192,7 +192,10 @@ pipeline { deleteDir() unstash 'source-dependencies' dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + retry(3) { + sleep randomNumber(min: 5, max: 10) + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + } } script { nodejs() { @@ -217,7 +220,10 @@ pipeline { deleteDir() unstash 'source-dependencies' dir("${BASE_DIR}"){ - sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + retry(3) { + sleep randomNumber(min: 5, max: 10) + sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + } } script { nodejs() { From 2387a7f1342b97a8ad3fe92c54bd77e85e113cba Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 14:40:28 +0200 Subject: [PATCH 54/72] Reorganized environment variables --- Jenkinsfile | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 95c460e9b..75373d964 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,8 @@ pipeline { REPO = 'elasticsearch-js' BASE_DIR = "src/github.com/elastic/${env.REPO}" NODE_JS_DEFAULT_VERSION = '10' + HOME = "${env.WORKSPACE}" + npm_config_cache = 'npm-cache' } options { @@ -43,10 +45,6 @@ pipeline { stage('Install dependencies') { options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } steps { deleteDir() unstash 'source' @@ -65,10 +63,6 @@ pipeline { stage('License check') { options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } steps { deleteDir() unstash 'source-dependencies' @@ -84,10 +78,6 @@ pipeline { stage('Linter') { options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } steps { deleteDir() unstash 'source-dependencies' @@ -108,10 +98,6 @@ pipeline { stage('Node.js v8') { agent { label 'docker && immutable' } options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } steps { deleteDir() unstash 'source' @@ -131,10 +117,6 @@ pipeline { stage('Node.js v10') { agent { label 'docker && immutable' } options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } steps { deleteDir() unstash 'source' @@ -154,10 +136,6 @@ pipeline { stage('Node.js v12') { agent { label 'docker && immutable' } options { skipDefaultCheckout() } - environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } steps { deleteDir() unstash 'source' @@ -184,8 +162,6 @@ pipeline { agent { label 'docker && immutable' } options { skipDefaultCheckout() } environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' TEST_ES_SERVER = 'http://elasticsearch:9200' } steps { @@ -212,8 +188,6 @@ pipeline { agent { label 'docker && immutable' } options { skipDefaultCheckout() } environment { - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' } steps { From 0d7c7a4b3d9cd6efde04d14af6795a1b66d4ce8a Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 16:18:58 +0200 Subject: [PATCH 55/72] Use a single function for building docker containers --- Jenkinsfile | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 75373d964..2b7fad677 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -168,13 +168,15 @@ pipeline { deleteDir() unstash 'source-dependencies' dir("${BASE_DIR}"){ + // Sometimes the docker registry fails and has random timeouts + // this block will retry a doker image 3 times before to fail. retry(3) { sleep randomNumber(min: 5, max: 10) sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') } } script { - nodejs() { + buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ dir("${BASE_DIR}"){ sh(label: 'Integration test', script: 'npm run test:integration') } @@ -194,13 +196,15 @@ pipeline { deleteDir() unstash 'source-dependencies' dir("${BASE_DIR}"){ + // Sometimes the docker registry fails and has random timeouts + // this block will retry a doker image 3 times before to fail. retry(3) { sleep randomNumber(min: 5, max: 10) sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') } } script { - nodejs() { + buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ dir("${BASE_DIR}"){ sh(label: 'Integration test', script: 'npm run test:integration') } @@ -214,26 +218,17 @@ pipeline { } } -def nodejs(Closure body){ - // Sometimes the docker registry fails and has random timeouts - // this block will retry a doker image 3 times before to fail. - def nodejsDocker - retry(3) { - sleep randomNumber(min: 5, max: 10) - nodejsDocker = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") - } - nodejsDocker.inside('--network=elastic'){ - body() - } -} - // Sometimes the docker registry fails and has random timeouts // this function will retry a doker image 3 times before to fail. def buildDockerImage(args) { def image retry(3) { sleep randomNumber(min: 5, max: 10) - image = docker.image(args.image) + if (args.fromDockerfile == true) { + image = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") + } else { + image = docker.image(args.image) + } } return image } From 1a27aaffc6c5e33f722112087046c6e4cd06f97a Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 17:09:27 +0200 Subject: [PATCH 56/72] Use a function to define parallel jobs --- Jenkinsfile | 96 ++++++++++++++++++++--------------------------------- 1 file changed, 36 insertions(+), 60 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b7fad677..7d242ded6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,7 @@ pipeline { REPO = 'elasticsearch-js' BASE_DIR = "src/github.com/elastic/${env.REPO}" NODE_JS_DEFAULT_VERSION = '10' + NODE_JS_VERSIONS = '8,10,12' HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' } @@ -51,9 +52,9 @@ pipeline { script { buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ - sh '''node --version - npm --version''' - sh 'npm install' + sh(label: 'System info', script: '''node --version + npm --version''') + sh(label: 'Install dependencies', script: 'npm install') } } } @@ -69,7 +70,7 @@ pipeline { script { buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ - sh 'npm run license-checker' + sh(label: 'Check production dependencies licenses', script: 'npm run license-checker') } } } @@ -84,7 +85,7 @@ pipeline { script { buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ dir("${BASE_DIR}"){ - sh 'npm run lint' + sh(label: 'Lint code with standardjs', script: 'npm run lint') } } } @@ -94,62 +95,14 @@ pipeline { stage('Unit test') { failFast true options { skipDefaultCheckout() } - parallel { - stage('Node.js v8') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - steps { - deleteDir() - unstash 'source' - script { - buildDockerImage(image: 'node:8-alpine').inside(){ - dir("${BASE_DIR}"){ - sh 'npm install' - sh 'npm run test:unit' - sh 'npm run test:behavior' - sh 'npm run test:types' - } - } - } - } - } - - stage('Node.js v10') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - steps { - deleteDir() - unstash 'source' - script { - buildDockerImage(image: 'node:10-alpine').inside(){ - dir("${BASE_DIR}"){ - sh 'npm install' - sh 'npm run test:unit' - sh 'npm run test:behavior' - sh 'npm run test:types' - } - } - } - } - } - - stage('Node.js v12') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - steps { - deleteDir() - unstash 'source' - script { - buildDockerImage(image: 'node:12-alpine').inside(){ - dir("${BASE_DIR}"){ - sh 'npm install' - sh 'npm run test:unit' - sh 'npm run test:behavior' - sh 'npm run test:types' - } - } - } + steps { + script { + def versions = env.NODE_JS_VERSIONS.split(',') + def parallelTasks = [:] + versions.each{ version -> + parallelTasks["Node.js v${version}"] = buildUniTestStage(version: version) } + parallel(parallelTasks) } } } @@ -232,3 +185,26 @@ def buildDockerImage(args) { } return image } + +def buildUniTestStage(args) { + return { + stage("Node.js v${args.version}") { + agent { label 'docker && immutable' } + options { skipDefaultCheckout() } + steps { + deleteDir() + unstash 'source' + script { + buildDockerImage(image: "node:${args.version}-alpine").inside(){ + dir("${BASE_DIR}"){ + sh(label: 'Install dependencies', script: 'npm install') + sh(label: 'Run unit test', script: 'npm run test:unit') + sh(label: 'Run behavior test', script: 'npm run test:behavior') + sh(label: 'Run types test', script: 'npm run test:types') + } + } + } + } + } + } +} From c39c5b4c3d3681ab6ef4654dd650d18497e2dddf Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 17:28:00 +0200 Subject: [PATCH 57/72] Refactored buildUnitTest --- Jenkinsfile | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7d242ded6..8d58defa5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -100,7 +100,7 @@ pipeline { def versions = env.NODE_JS_VERSIONS.split(',') def parallelTasks = [:] versions.each{ version -> - parallelTasks["Node.js v${version}"] = buildUniTestStage(version: version) + parallelTasks["Node.js v${version}"] = buildUnitTest(version: version) } parallel(parallelTasks) } @@ -186,22 +186,18 @@ def buildDockerImage(args) { return image } -def buildUniTestStage(args) { +def buildUnitTest(args) { return { - stage("Node.js v${args.version}") { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - steps { - deleteDir() - unstash 'source' - script { - buildDockerImage(image: "node:${args.version}-alpine").inside(){ - dir("${BASE_DIR}"){ - sh(label: 'Install dependencies', script: 'npm install') - sh(label: 'Run unit test', script: 'npm run test:unit') - sh(label: 'Run behavior test', script: 'npm run test:behavior') - sh(label: 'Run types test', script: 'npm run test:types') - } + node('docker && immutable') { + deleteDir() + unstash 'source' + script { + buildDockerImage(image: "node:${args.version}-alpine").inside(){ + dir("${BASE_DIR}"){ + sh(label: 'Install dependencies', script: 'npm install') + sh(label: 'Run unit test', script: 'npm run test:unit') + sh(label: 'Run behavior test', script: 'npm run test:behavior') + sh(label: 'Run types test', script: 'npm run test:types') } } } From e388c0cb396c19e1bcb2f43ebe98dae5a90ca56a Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 18:16:38 +0200 Subject: [PATCH 58/72] Added test reporting --- Jenkinsfile | 11 +++++++---- package.json | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8d58defa5..f9de5a6b0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,11 +131,12 @@ pipeline { script { buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration') + sh(label: 'Integration test', script: 'npm run test:integration:report') } } } sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } @@ -159,11 +160,12 @@ pipeline { script { buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration') + sh(label: 'Integration test', script: 'npm run test:integration:report') } } } sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } } @@ -195,12 +197,13 @@ def buildUnitTest(args) { buildDockerImage(image: "node:${args.version}-alpine").inside(){ dir("${BASE_DIR}"){ sh(label: 'Install dependencies', script: 'npm install') - sh(label: 'Run unit test', script: 'npm run test:unit') - sh(label: 'Run behavior test', script: 'npm run test:behavior') + sh(label: 'Run unit test', script: 'npm run test:unit:report') + sh(label: 'Run behavior test', script: 'npm run test:behavior:report') sh(label: 'Run types test', script: 'npm run test:types') } } } + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } } diff --git a/package.json b/package.json index 044d8d81b..dd01acfb2 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,11 @@ "scripts": { "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types", "test:unit": "tap test/unit/*.test.js -t 300 --no-coverage", + "test:unit:report": "tap test/unit/*.test.js -t 300 --no-coverage | tap-junit > junit-unit-report.xml", "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage", + "test:behavior:report": "tap test/behavior/*.test.js -t 300 --no-coverage | tap-junit > junit-behavior-report.xml", "test:integration": "tap test/integration/index.js -T --no-coverage", - "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > $WORKSPACE/test-report-junit.xml", + "test:integration:report": "npm run test:integration | tap-junit > junit-integration-report.xml", "test:types": "tsc --project ./test/types/tsconfig.json", "test:coverage": "nyc tap test/unit/*.test.js test/behavior/*.test.js -t 300 && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", @@ -59,7 +61,7 @@ "standard": "^13.0.2", "stoppable": "^1.1.0", "tap": "^14.4.1", - "tap-mocha-reporter": "^4.0.1", + "tap-junit": "^3.1.0", "typescript": "^3.4.5", "workq": "^2.1.0" }, From aadfa15c233ebff34600ac0166dd524477e23cc1 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 19:33:22 +0200 Subject: [PATCH 59/72] Use xunit reporter --- Jenkinsfile | 6 +++--- package.json | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f9de5a6b0..a051f7c3e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -136,7 +136,7 @@ pipeline { } } sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") + xunit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/xunit-*.xml") } } @@ -165,7 +165,7 @@ pipeline { } } sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") + xunit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/xunit-*.xml") } } } @@ -203,7 +203,7 @@ def buildUnitTest(args) { } } } - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") + xunit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/xunit-*.xml") } } } diff --git a/package.json b/package.json index dd01acfb2..5aa63350e 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "scripts": { "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types", "test:unit": "tap test/unit/*.test.js -t 300 --no-coverage", - "test:unit:report": "tap test/unit/*.test.js -t 300 --no-coverage | tap-junit > junit-unit-report.xml", + "test:unit:report": "tap test/unit/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > xunit-unit-report.xml", "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage", - "test:behavior:report": "tap test/behavior/*.test.js -t 300 --no-coverage | tap-junit > junit-behavior-report.xml", + "test:behavior:report": "tap test/behavior/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > xunit-behavior-report.xml", "test:integration": "tap test/integration/index.js -T --no-coverage", - "test:integration:report": "npm run test:integration | tap-junit > junit-integration-report.xml", + "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > xunit-integration-report.xml", "test:types": "tsc --project ./test/types/tsconfig.json", "test:coverage": "nyc tap test/unit/*.test.js test/behavior/*.test.js -t 300 && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", @@ -61,7 +61,7 @@ "standard": "^13.0.2", "stoppable": "^1.1.0", "tap": "^14.4.1", - "tap-junit": "^3.1.0", + "tap-mocha-reporter": "^4.0.1", "typescript": "^3.4.5", "workq": "^2.1.0" }, From 588a55335331e54ad4404b0d0ff08d9427f5f6a3 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 31 Jul 2019 19:34:47 +0200 Subject: [PATCH 60/72] Use junit reporter --- Jenkinsfile | 6 +++--- package.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a051f7c3e..f9de5a6b0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -136,7 +136,7 @@ pipeline { } } sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - xunit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/xunit-*.xml") + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } @@ -165,7 +165,7 @@ pipeline { } } sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - xunit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/xunit-*.xml") + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } } @@ -203,7 +203,7 @@ def buildUnitTest(args) { } } } - xunit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/xunit-*.xml") + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } } diff --git a/package.json b/package.json index 5aa63350e..89d60522e 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "scripts": { "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types", "test:unit": "tap test/unit/*.test.js -t 300 --no-coverage", - "test:unit:report": "tap test/unit/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > xunit-unit-report.xml", + "test:unit:report": "tap test/unit/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > junit-unit-report.xml", "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage", - "test:behavior:report": "tap test/behavior/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > xunit-behavior-report.xml", + "test:behavior:report": "tap test/behavior/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > junit-behavior-report.xml", "test:integration": "tap test/integration/index.js -T --no-coverage", - "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > xunit-integration-report.xml", + "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > junit-integration-report.xml", "test:types": "tsc --project ./test/types/tsconfig.json", "test:coverage": "nyc tap test/unit/*.test.js test/behavior/*.test.js -t 300 && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", From 4bfd37ba91ec66e9dcd32bc4824944797b3900b5 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 1 Aug 2019 13:51:47 +0200 Subject: [PATCH 61/72] Updated reporting --- Jenkinsfile | 12 ++++++++---- package.json | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f9de5a6b0..e65cdccbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -131,7 +131,8 @@ pipeline { script { buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration:report') + sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap') + sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml') } } } @@ -160,7 +161,8 @@ pipeline { script { buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration:report') + sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap') + sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml') } } } @@ -197,9 +199,11 @@ def buildUnitTest(args) { buildDockerImage(image: "node:${args.version}-alpine").inside(){ dir("${BASE_DIR}"){ sh(label: 'Install dependencies', script: 'npm install') - sh(label: 'Run unit test', script: 'npm run test:unit:report') - sh(label: 'Run behavior test', script: 'npm run test:behavior:report') + sh(label: 'Run unit test', script: 'npm run test:unit | tee test-unit.tap') + sh(label: 'Run behavior test', script: 'npm run test:behavior | tee test-behavior.tap') sh(label: 'Run types test', script: 'npm run test:types') + sh(label: 'Generating test reporting', script: '''./node_modules/.bin/tap-mocha-reporter xunit < test-unit.tap > junit-unit.xml +./node_modules/.bin/tap-mocha-reporter xunit < test-behavior.tap > junit-behavior.xml''') } } } diff --git a/package.json b/package.json index 89d60522e..8a6ba449b 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,8 @@ "scripts": { "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types", "test:unit": "tap test/unit/*.test.js -t 300 --no-coverage", - "test:unit:report": "tap test/unit/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > junit-unit-report.xml", "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage", - "test:behavior:report": "tap test/behavior/*.test.js -t 300 --no-coverage | tap-mocha-reporter xunit > junit-behavior-report.xml", "test:integration": "tap test/integration/index.js -T --no-coverage", - "test:integration:report": "npm run test:integration | tap-mocha-reporter xunit > junit-integration-report.xml", "test:types": "tsc --project ./test/types/tsconfig.json", "test:coverage": "nyc tap test/unit/*.test.js test/behavior/*.test.js -t 300 && nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "standard", From c181e020e14efd5e806ed8fb87e497408f9815e5 Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 1 Aug 2019 14:12:31 +0200 Subject: [PATCH 62/72] Pull latest image from docker hub --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index e65cdccbe..f4cb0995c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -185,6 +185,8 @@ def buildDockerImage(args) { image = docker.build('nodejs-image', "--build-arg NODE_JS_VERSION=${env.NODE_JS_DEFAULT_VERSION} ${BASE_DIR}/.ci/docker") } else { image = docker.image(args.image) + // make sure we have the latest available from Docker Hub + image.pull() } } return image From a09dfcebec73cdfe754d90fb65661cfb6800590f Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 1 Aug 2019 15:53:11 +0200 Subject: [PATCH 63/72] Added withGithubNotify --- Jenkinsfile | 138 +++++++++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 62 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f4cb0995c..879dd69c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,39 +38,45 @@ pipeline { stage('Checkout') { options { skipDefaultCheckout() } steps { - deleteDir() - gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false) - stash allowEmpty: true, name: 'source', useDefaultExcludes: false + withGithubNotify(context: 'Checkout') { + deleteDir() + gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false) + stash allowEmpty: true, name: 'source', useDefaultExcludes: false + } } } stage('Install dependencies') { options { skipDefaultCheckout() } steps { - deleteDir() - unstash 'source' - script { - buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ - dir("${BASE_DIR}"){ - sh(label: 'System info', script: '''node --version - npm --version''') - sh(label: 'Install dependencies', script: 'npm install') + withGithubNotify(context: 'Install dependencies') { + deleteDir() + unstash 'source' + script { + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + dir("${BASE_DIR}"){ + sh(label: 'System info', script: '''node --version + npm --version''') + sh(label: 'Install dependencies', script: 'npm install') + } } } + stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } - stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } stage('License check') { options { skipDefaultCheckout() } steps { - deleteDir() - unstash 'source-dependencies' - script { - buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ - dir("${BASE_DIR}"){ - sh(label: 'Check production dependencies licenses', script: 'npm run license-checker') + withGithubNotify(context: 'License check') { + deleteDir() + unstash 'source-dependencies' + script { + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + dir("${BASE_DIR}"){ + sh(label: 'Check production dependencies licenses', script: 'npm run license-checker') + } } } } @@ -80,12 +86,14 @@ pipeline { stage('Linter') { options { skipDefaultCheckout() } steps { - deleteDir() - unstash 'source-dependencies' - script { - buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ - dir("${BASE_DIR}"){ - sh(label: 'Lint code with standardjs', script: 'npm run lint') + withGithubNotify(context: 'Linter') { + deleteDir() + unstash 'source-dependencies' + script { + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + dir("${BASE_DIR}"){ + sh(label: 'Lint code with standardjs', script: 'npm run lint') + } } } } @@ -96,13 +104,15 @@ pipeline { failFast true options { skipDefaultCheckout() } steps { - script { - def versions = env.NODE_JS_VERSIONS.split(',') - def parallelTasks = [:] - versions.each{ version -> - parallelTasks["Node.js v${version}"] = buildUnitTest(version: version) + withGithubNotify(context: 'Unit test') { + script { + def versions = env.NODE_JS_VERSIONS.split(',') + def parallelTasks = [:] + versions.each{ version -> + parallelTasks["Node.js v${version}"] = buildUnitTest(version: version) + } + parallel(parallelTasks) } - parallel(parallelTasks) } } } @@ -118,26 +128,28 @@ pipeline { TEST_ES_SERVER = 'http://elasticsearch:9200' } steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - // Sometimes the docker registry fails and has random timeouts - // this block will retry a doker image 3 times before to fail. - retry(3) { - sleep randomNumber(min: 5, max: 10) - sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + withGithubNotify(context: 'Integration test') { + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + // Sometimes the docker registry fails and has random timeouts + // this block will retry a doker image 3 times before to fail. + retry(3) { + sleep randomNumber(min: 5, max: 10) + sh(label: 'Start Elasticsearch', script: './scripts/es-docker.sh --detach') + } } - } - script { - buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ - dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap') - sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml') + script { + buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ + dir("${BASE_DIR}"){ + sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap') + sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml') + } } } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } @@ -148,26 +160,28 @@ pipeline { TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' } steps { - deleteDir() - unstash 'source-dependencies' - dir("${BASE_DIR}"){ - // Sometimes the docker registry fails and has random timeouts - // this block will retry a doker image 3 times before to fail. - retry(3) { - sleep randomNumber(min: 5, max: 10) - sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + withGithubNotify(context: 'Integration test') { + deleteDir() + unstash 'source-dependencies' + dir("${BASE_DIR}"){ + // Sometimes the docker registry fails and has random timeouts + // this block will retry a doker image 3 times before to fail. + retry(3) { + sleep randomNumber(min: 5, max: 10) + sh(label: 'Start Elasticsearch', script: './scripts/es-docker-platinum.sh --detach') + } } - } - script { - buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ - dir("${BASE_DIR}"){ - sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap') - sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml') + script { + buildDockerImage(fromDockerfile: true).inside('--network=elastic'){ + dir("${BASE_DIR}"){ + sh(label: 'Integration test', script: 'npm run test:integration | tee test-integration.tap') + sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-integration.tap > junit-integration.xml') + } } } + sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') + junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") } } } From 761bf6504cbc96d6b13fd3f74bfbf9f2b61c29e6 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 7 Aug 2019 13:53:23 +0200 Subject: [PATCH 64/72] Randomize nodejs default version --- Jenkinsfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 879dd69c6..eb9f8c406 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,9 @@ retriever: modernSCM( id: '37cf2c00-2cc7-482e-8c62-7bbffef475e2', remote: 'git@github.com:elastic/apm-pipeline-library.git']) +def NODE_JS_VERSIONS = [8,10,12] +def nodeJsVersion = NODE_JS_VERSIONS[randomNumber(min: 0, max:2)] + pipeline { agent { label 'docker && immutable' @@ -15,8 +18,8 @@ pipeline { environment { REPO = 'elasticsearch-js' BASE_DIR = "src/github.com/elastic/${env.REPO}" - NODE_JS_DEFAULT_VERSION = '10' - NODE_JS_VERSIONS = '8,10,12' + NODE_JS_DEFAULT_VERSION = nodeJsVersion + NODE_JS_VERSIONS = NODE_JS_VERSIONS.join(',') HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' } From 4c3ab312b0057357b2b6084e4a1147dc559425a9 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 7 Aug 2019 13:55:42 +0200 Subject: [PATCH 65/72] Fix definition --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eb9f8c406..9d95f06c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,8 +18,8 @@ pipeline { environment { REPO = 'elasticsearch-js' BASE_DIR = "src/github.com/elastic/${env.REPO}" - NODE_JS_DEFAULT_VERSION = nodeJsVersion - NODE_JS_VERSIONS = NODE_JS_VERSIONS.join(',') + NODE_JS_DEFAULT_VERSION = "${nodeJsVersion}" + NODE_JS_VERSIONS = "${NODE_JS_VERSIONS.join(',')}" HOME = "${env.WORKSPACE}" npm_config_cache = 'npm-cache' } From 975797ca5cb6901b8f952efbd03250e793333dc6 Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 7 Aug 2019 15:03:20 +0200 Subject: [PATCH 66/72] Moved Jenkinsfile --- Jenkinsfile => .ci/Jenkinsfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Jenkinsfile => .ci/Jenkinsfile (100%) diff --git a/Jenkinsfile b/.ci/Jenkinsfile similarity index 100% rename from Jenkinsfile rename to .ci/Jenkinsfile From c2b9b69c466f56dbc8d566bce42a8609ba0c1fef Mon Sep 17 00:00:00 2001 From: delvedor Date: Wed, 7 Aug 2019 15:03:50 +0200 Subject: [PATCH 67/72] Added daily trigger --- .ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 9d95f06c1..07699f282 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -35,6 +35,7 @@ pipeline { triggers { issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*') + cron(changeRequest() ? '' : '@daily') } stages { From eb09cb30d370a5db1b66544d6f8f663048cc487d Mon Sep 17 00:00:00 2001 From: delvedor Date: Thu, 8 Aug 2019 09:39:23 +0200 Subject: [PATCH 68/72] Use apm library --- .ci/Jenkinsfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 07699f282..b302e00ba 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -1,11 +1,6 @@ #!/usr/bin/env groovy -library identifier: 'apm@current', -retriever: modernSCM( - [$class: 'GitSCMSource', - credentialsId: 'f94e9298-83ae-417e-ba91-85c279771570', - id: '37cf2c00-2cc7-482e-8c62-7bbffef475e2', - remote: 'git@github.com:elastic/apm-pipeline-library.git']) +@Library('apm@current') _ def NODE_JS_VERSIONS = [8,10,12] def nodeJsVersion = NODE_JS_VERSIONS[randomNumber(min: 0, max:2)] From b332dc8af1886f4bdd2b06fa1eaaccad6497e188 Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 9 Aug 2019 09:25:36 +0200 Subject: [PATCH 69/72] Added comment --- .ci/Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index b302e00ba..05d7c981c 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -30,6 +30,8 @@ pipeline { triggers { issueCommentTrigger('(?i).*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*') + // changeRequest() will return true in case of a commit or a pr + // we will have a daily cron job only ofr branches that don't have an active pr cron(changeRequest() ? '' : '@daily') } From b601c77e255f0ad590fa41acf74af96d3fab689d Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 9 Aug 2019 10:39:42 +0200 Subject: [PATCH 70/72] Added packer cache --- .ci/packer_cache.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .ci/packer_cache.sh diff --git a/.ci/packer_cache.sh b/.ci/packer_cache.sh new file mode 100644 index 000000000..91f246250 --- /dev/null +++ b/.ci/packer_cache.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +source /usr/local/bin/bash_standard_lib.sh + +DOCKER_IMAGES="node:12-alpine +node:10-alpine +node:8-alpine +" + +for di in ${DOCKER_IMAGES} +do +(retry 2 docker pull "${di}") || echo "Error pulling ${di} Docker image, we continue" +done + From 2b88f798e13d72f758d2d328ba0c9dca61de953f Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 9 Aug 2019 11:22:07 +0200 Subject: [PATCH 71/72] Updated multiline script and github notify steps --- .ci/Jenkinsfile | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 05d7c981c..145b6dd6f 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -39,31 +39,26 @@ pipeline { stage('Checkout') { options { skipDefaultCheckout() } steps { - withGithubNotify(context: 'Checkout') { - deleteDir() - gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false) - stash allowEmpty: true, name: 'source', useDefaultExcludes: false - } + deleteDir() + gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: false) + stash allowEmpty: true, name: 'source', useDefaultExcludes: false } } stage('Install dependencies') { options { skipDefaultCheckout() } steps { - withGithubNotify(context: 'Install dependencies') { - deleteDir() - unstash 'source' - script { - buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ - dir("${BASE_DIR}"){ - sh(label: 'System info', script: '''node --version - npm --version''') - sh(label: 'Install dependencies', script: 'npm install') - } + deleteDir() + unstash 'source' + script { + buildDockerImage(image: "node:${env.NODE_JS_DEFAULT_VERSION}-alpine").inside(){ + dir("${BASE_DIR}"){ + sh(label: 'System info', script: 'node --version; npm --version') + sh(label: 'Install dependencies', script: 'npm install') } } - stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } + stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false } } @@ -129,7 +124,7 @@ pipeline { TEST_ES_SERVER = 'http://elasticsearch:9200' } steps { - withGithubNotify(context: 'Integration test') { + withGithubNotify(context: 'Integration test OSS') { deleteDir() unstash 'source-dependencies' dir("${BASE_DIR}"){ @@ -161,7 +156,7 @@ pipeline { TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' } steps { - withGithubNotify(context: 'Integration test') { + withGithubNotify(context: 'Integration test xPack') { deleteDir() unstash 'source-dependencies' dir("${BASE_DIR}"){ @@ -219,8 +214,7 @@ def buildUnitTest(args) { sh(label: 'Run unit test', script: 'npm run test:unit | tee test-unit.tap') sh(label: 'Run behavior test', script: 'npm run test:behavior | tee test-behavior.tap') sh(label: 'Run types test', script: 'npm run test:types') - sh(label: 'Generating test reporting', script: '''./node_modules/.bin/tap-mocha-reporter xunit < test-unit.tap > junit-unit.xml -./node_modules/.bin/tap-mocha-reporter xunit < test-behavior.tap > junit-behavior.xml''') + sh(label: 'Generating test reporting', script: './node_modules/.bin/tap-mocha-reporter xunit < test-unit.tap > junit-unit.xml; ./node_modules/.bin/tap-mocha-reporter xunit < test-behavior.tap > junit-behavior.xml') } } } From 76fbd29723f020434252eca887ff980298a04fdc Mon Sep 17 00:00:00 2001 From: delvedor Date: Fri, 9 Aug 2019 11:22:18 +0200 Subject: [PATCH 72/72] Updated job definitions --- .ci/jobs/defaults.yml | 70 ------------------- .ci/jobs/elastic+elasticsearch-js+5.x.yml | 14 ---- .ci/jobs/elastic+elasticsearch-js+6.x.yml | 14 ---- .ci/jobs/elastic+elasticsearch-js+7.x.yml | 14 ---- .ci/jobs/elastic+elasticsearch-js+master.yml | 14 ---- ...s.yml => elastic+elasticsearch-js+mbp.yml} | 0 .../elastic+elasticsearch-js+pull-request.yml | 19 ----- 7 files changed, 145 deletions(-) delete mode 100644 .ci/jobs/defaults.yml delete mode 100644 .ci/jobs/elastic+elasticsearch-js+5.x.yml delete mode 100644 .ci/jobs/elastic+elasticsearch-js+6.x.yml delete mode 100644 .ci/jobs/elastic+elasticsearch-js+7.x.yml delete mode 100644 .ci/jobs/elastic+elasticsearch-js+master.yml rename .ci/jobs/{elastic+elasticsearch-js+jenkins-pipelines.yml => elastic+elasticsearch-js+mbp.yml} (100%) delete mode 100644 .ci/jobs/elastic+elasticsearch-js+pull-request.yml diff --git a/.ci/jobs/defaults.yml b/.ci/jobs/defaults.yml deleted file mode 100644 index 5b4b1f68c..000000000 --- a/.ci/jobs/defaults.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- - -##### GLOBAL METADATA - -- meta: - cluster: clients-ci - -##### JOB DEFAULTS - -- job: - project-type: matrix - logrotate: - daysToKeep: 30 - numToKeep: 100 - properties: - - github: - url: https://github.com/elastic/elasticsearch-js/ - - inject: - properties-content: HOME=$JENKINS_HOME - concurrent: true - node: flyweight - scm: - - git: - name: origin - credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba - reference-repo: /var/lib/jenkins/.git-references/elasticsearch-js.git - branches: - - ${branch_specifier} - url: https://github.com/elastic/elasticsearch-js.git - wipe-workspace: 'True' - triggers: - - github - vault: - # vault read auth/approle/role/clients-ci/role-id - role_id: ddbd0d44-0e51-105b-177a-c8fdfd445126 - axes: - - axis: - type: slave - name: label - values: - - linux - - axis: - type: yaml - filename: .ci/test-matrix.yml - name: ELASTICSEARCH_VERSION - - axis: - type: yaml - filename: .ci/test-matrix.yml - name: NODE_JS_VERSION - yaml-strategy: - exclude-key: exclude - filename: .ci/test-matrix.yml - wrappers: - - ansicolor - - timeout: - type: absolute - timeout: 120 - fail: true - - timestamps - - workspace-cleanup - builders: - - shell: |- - #!/usr/local/bin/runbld - .ci/run-tests - publishers: - - email: - recipients: infra-root+build@elastic.co - # - junit: - # results: "*-junit.xml" - # allow-empty-results: true diff --git a/.ci/jobs/elastic+elasticsearch-js+5.x.yml b/.ci/jobs/elastic+elasticsearch-js+5.x.yml deleted file mode 100644 index 0b422ae31..000000000 --- a/.ci/jobs/elastic+elasticsearch-js+5.x.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- job: - name: elastic+elasticsearch-js+5.x - display-name: 'elastic / elasticsearch-js # 5.x' - description: Testing the elasticsearch-js 5.x branch. - parameters: - - string: - name: branch_specifier - default: refs/heads/5.x - description: the Git branch specifier to build (<branchName>, <tagName>, - <commitId>, etc.) - triggers: - - github - - timed: '@weekly' diff --git a/.ci/jobs/elastic+elasticsearch-js+6.x.yml b/.ci/jobs/elastic+elasticsearch-js+6.x.yml deleted file mode 100644 index 8f9a02c67..000000000 --- a/.ci/jobs/elastic+elasticsearch-js+6.x.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- job: - name: elastic+elasticsearch-js+6.x - display-name: 'elastic / elasticsearch-js # 6.x' - description: Testing the elasticsearch-js 6.x branch. - parameters: - - string: - name: branch_specifier - default: refs/heads/6.x - description: the Git branch specifier to build (<branchName>, <tagName>, - <commitId>, etc.) - triggers: - - github - - timed: '@weekly' diff --git a/.ci/jobs/elastic+elasticsearch-js+7.x.yml b/.ci/jobs/elastic+elasticsearch-js+7.x.yml deleted file mode 100644 index a25c2b5ae..000000000 --- a/.ci/jobs/elastic+elasticsearch-js+7.x.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- job: - name: elastic+elasticsearch-js+7.x - display-name: 'elastic / elasticsearch-js # 7.x' - description: Testing the elasticsearch-js 7.x branch. - parameters: - - string: - name: branch_specifier - default: refs/heads/7.x - description: the Git branch specifier to build (<branchName>, <tagName>, - <commitId>, etc.) - triggers: - - github - - timed: '@weekly' diff --git a/.ci/jobs/elastic+elasticsearch-js+master.yml b/.ci/jobs/elastic+elasticsearch-js+master.yml deleted file mode 100644 index 284d30f55..000000000 --- a/.ci/jobs/elastic+elasticsearch-js+master.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- job: - name: elastic+elasticsearch-js+master - display-name: 'elastic / elasticsearch-js # master' - description: Testing the elasticsearch-js master branch. - parameters: - - string: - name: branch_specifier - default: refs/heads/master - description: the Git branch specifier to build (<branchName>, <tagName>, - <commitId>, etc.) - triggers: - - github - - timed: '@daily' diff --git a/.ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml b/.ci/jobs/elastic+elasticsearch-js+mbp.yml similarity index 100% rename from .ci/jobs/elastic+elasticsearch-js+jenkins-pipelines.yml rename to .ci/jobs/elastic+elasticsearch-js+mbp.yml diff --git a/.ci/jobs/elastic+elasticsearch-js+pull-request.yml b/.ci/jobs/elastic+elasticsearch-js+pull-request.yml deleted file mode 100644 index 78cde9ecc..000000000 --- a/.ci/jobs/elastic+elasticsearch-js+pull-request.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- job: - name: elastic+elasticsearch-js+pull-request - display-name: 'elastic / elasticsearch-js # pull-request' - description: Testing of elasticsearch-js pull requests. - scm: - - git: - branches: - - ${ghprbActualCommit} - refspec: +refs/pull/*:refs/remotes/origin/pr/* - triggers: - - github-pull-request: - org-list: - - elastic - allow-whitelist-orgs-as-admins: true - github-hooks: true - status-context: clients-ci - cancel-builds-on-update: true - publishers: []