From c30e4cdb955db4ab5026e293f416752889ea4cdb Mon Sep 17 00:00:00 2001 From: Tomas Della Vedova Date: Fri, 25 Oct 2019 10:55:45 +0200 Subject: [PATCH] Move back to jjbb (#995) * Removed Jenkins pipelines configuration * Restored jjbb definitions --- .ci/Jenkinsfile | 224 ------------------ .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 ++ .../elastic+elasticsearch-js+pull-request.yml | 19 ++ 6 files changed, 75 insertions(+), 224 deletions(-) delete mode 100644 .ci/Jenkinsfile create mode 100644 .ci/jobs/elastic+elasticsearch-js+5.x.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+6.x.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+7.x.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+master.yml create mode 100644 .ci/jobs/elastic+elasticsearch-js+pull-request.yml diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile deleted file mode 100644 index 859da6b37..000000000 --- a/.ci/Jenkinsfile +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/bin/env groovy - -@Library('apm@current') _ - -def NODE_JS_VERSIONS = [8,10,12] -def nodeJsVersion = NODE_JS_VERSIONS[randomNumber(min: 0, max:2)] - -pipeline { - agent { - label 'docker && immutable' - } - - environment { - REPO = 'elasticsearch-js' - BASE_DIR = "src/github.com/elastic/${env.REPO}" - NODE_JS_DEFAULT_VERSION = "${nodeJsVersion}" - NODE_JS_VERSIONS = "${NODE_JS_VERSIONS.join(',')}" - HOME = "${env.WORKSPACE}" - npm_config_cache = 'npm-cache' - } - - 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)?.*') - // env.CHANGE_ID as a value in case of a commit or a pr, which means - // that we will have a daily cron job only for branches that don't have an active pr - cron(env.CHANGE_ID ? '' : '@daily') - } - - stages { - stage('Checkout') { - options { skipDefaultCheckout() } - steps { - 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') - } - } - } - stash allowEmpty: true, name: 'source-dependencies', useDefaultExcludes: false - } - } - - stage('License check') { - options { skipDefaultCheckout() } - steps { - 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') - } - } - } - } - } - } - - stage('Linter') { - options { skipDefaultCheckout() } - steps { - 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') - } - } - } - } - } - } - - stage('Unit test') { - failFast true - options { skipDefaultCheckout() } - steps { - 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) - } - } - } - } - - stage('Integration test') { - failFast true - options { skipDefaultCheckout() } - parallel { - stage('OSS') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - environment { - TEST_ES_SERVER = 'http://elasticsearch:9200' - } - steps { - withGithubNotify(context: 'Integration test OSS') { - 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') - } - } - } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") - } - } - } - - stage('xPack') { - agent { label 'docker && immutable' } - options { skipDefaultCheckout() } - environment { - TEST_ES_SERVER = 'https://elastic:changeme@elasticsearch:9200' - } - steps { - withGithubNotify(context: 'Integration test xPack') { - 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') - } - } - } - sh(label: 'Stop Elasticsearch', script: 'docker kill $(docker ps -q)') - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") - } - } - } - } - } - } -} - -// 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) - 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) - // make sure we have the latest available from Docker Hub - image.pull() - } - } - return image -} - -def buildUnitTest(args) { - return { - 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 | 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') - } - } - } - junit(allowEmptyResults: true, keepLongStdio: true, testResults: "${BASE_DIR}/**/junit-*.xml") - } - } -} diff --git a/.ci/jobs/elastic+elasticsearch-js+5.x.yml b/.ci/jobs/elastic+elasticsearch-js+5.x.yml new file mode 100644 index 000000000..0b422ae31 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+5.x.yml @@ -0,0 +1,14 @@ +--- +- 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 new file mode 100644 index 000000000..8f9a02c67 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+6.x.yml @@ -0,0 +1,14 @@ +--- +- 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 new file mode 100644 index 000000000..a25c2b5ae --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+7.x.yml @@ -0,0 +1,14 @@ +--- +- 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 new file mode 100644 index 000000000..284d30f55 --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+master.yml @@ -0,0 +1,14 @@ +--- +- 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+pull-request.yml b/.ci/jobs/elastic+elasticsearch-js+pull-request.yml new file mode 100644 index 000000000..78cde9ecc --- /dev/null +++ b/.ci/jobs/elastic+elasticsearch-js+pull-request.yml @@ -0,0 +1,19 @@ +--- +- 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: []