From 75d24c81708fc54c7b04ba7ba69e1b5ff72f00d0 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 18 Oct 2021 16:21:38 +0100 Subject: [PATCH 1/4] CI: refactor the run e2e build --- .ci/packaging.groovy | 32 +++----------------------------- Jenkinsfile | 34 ++++------------------------------ 2 files changed, 7 insertions(+), 59 deletions(-) diff --git a/.ci/packaging.groovy b/.ci/packaging.groovy index 4f960aaf3cd..0c5edc122fa 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -416,38 +416,12 @@ def runE2ETests(){ }; } - triggerE2ETests(suites) + runE2e(runTestsSuites: suites, + beatVersion: "${env.BEAT_VERSION}-SNAPSHOT", + gitHubCheckName: env.GITHUB_CHECK_E2E_TESTS_NAME) } } -def triggerE2ETests(String suite) { - echo("Triggering E2E tests for PR-${env.CHANGE_ID}. Test suites: ${suite}.") - - def branchName = isPR() ? "${env.CHANGE_TARGET}" : "${env.JOB_BASE_NAME}" - def e2eTestsPipeline = "e2e-tests/e2e-testing-mbp/${branchName}" - def beatVersion = "${env.BEAT_VERSION}-SNAPSHOT" - - def parameters = [ - booleanParam(name: 'forceSkipGitChecks', value: true), - booleanParam(name: 'forceSkipPresubmit', value: true), - booleanParam(name: 'notifyOnGreenBuilds', value: !isPR()), - string(name: 'BEAT_VERSION', value: beatVersion), - string(name: 'runTestsSuites', value: suite), - string(name: 'GITHUB_CHECK_NAME', value: env.GITHUB_CHECK_E2E_TESTS_NAME), - string(name: 'GITHUB_CHECK_REPO', value: env.REPO), - string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT), - ] - - build(job: "${e2eTestsPipeline}", - parameters: parameters, - propagate: false, - wait: false - ) - - def notifyContext = "${env.GITHUB_CHECK_E2E_TESTS_NAME}" - githubNotify(context: "${notifyContext}", description: "${notifyContext} ...", status: 'PENDING', targetUrl: "${env.JENKINS_URL}search/?q=${e2eTestsPipeline.replaceAll('/','+')}") -} - def withMacOSEnv(Closure body){ withEnvMask( vars: [ [var: "KEYCHAIN_PASS", password: getVaultSecret(secret: "secret/jenkins-ci/macos-codesign-keychain").data.password], diff --git a/Jenkinsfile b/Jenkinsfile index 14be5d331b6..e6924d3d682 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -527,7 +527,10 @@ def e2e(Map args = [:]) { if (args.e2e.get('entrypoint', '')?.trim()) { e2e_with_entrypoint(args) } else { - e2e_with_job(args) + runE2e(jobName: args.e2e?.get('job'), + testMatrixFile: args.e2e?.get('testMatrixFile', ''), + beatVersion: "${env.VERSION}-SNAPSHOT", + gitHubCheckName: "e2e-${args.context}") } } @@ -562,35 +565,6 @@ def e2e_with_entrypoint(Map args = [:]) { } } -/** -* This method triggers the end 2 end testing job. -*/ -def e2e_with_job(Map args = [:]) { - def jobName = args.e2e?.get('job') - def testMatrixFile = args.e2e?.get('testMatrixFile', '') - def notifyContext = "e2e-${args.context}" - def e2eTestsPipeline = "${jobName}/${isPR() ? "${env.CHANGE_TARGET}" : "${env.JOB_BASE_NAME}"}" - - def parameters = [ - booleanParam(name: 'forceSkipGitChecks', value: true), - booleanParam(name: 'forceSkipPresubmit', value: true), - booleanParam(name: 'notifyOnGreenBuilds', value: !isPR()), - string(name: 'BEAT_VERSION', value: "${env.VERSION}-SNAPSHOT"), - string(name: 'testMatrixFile', value: testMatrixFile), - string(name: 'GITHUB_CHECK_NAME', value: notifyContext), - string(name: 'GITHUB_CHECK_REPO', value: env.REPO), - string(name: 'GITHUB_CHECK_SHA1', value: env.GIT_BASE_COMMIT), - ] - - build(job: "${e2eTestsPipeline}", - parameters: parameters, - propagate: false, - wait: false - ) - - githubNotify(context: "${notifyContext}", description: "${notifyContext} ...", status: 'PENDING', targetUrl: "${env.JENKINS_URL}search/?q=${e2eTestsPipeline.replaceAll('/','+')}") -} - /** * This method runs the given command supporting two kind of scenarios: * - make -C then the dir(location) is not required, aka by disaling isMage: false From b761976f1ca802e2c60cb9e283f41d1ea9610df7 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 19 Oct 2021 11:45:24 +0100 Subject: [PATCH 2/4] Add the right parameters --- .ci/packaging.groovy | 6 ++++-- Jenkinsfile | 7 ++++--- x-pack/elastic-agent/Jenkinsfile.yml | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.ci/packaging.groovy b/.ci/packaging.groovy index 0c5edc122fa..7c4ce7b5e8f 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -416,9 +416,11 @@ def runE2ETests(){ }; } - runE2e(runTestsSuites: suites, + runE2E(runTestsSuites: suites, beatVersion: "${env.BEAT_VERSION}-SNAPSHOT", - gitHubCheckName: env.GITHUB_CHECK_E2E_TESTS_NAME) + gitHubCheckName: env.GITHUB_CHECK_E2E_TESTS_NAME, + gitHubCheckRepo: env.REPO, + gitHubCheckSha1: env.GIT_BASE_COMMIT) } } diff --git a/Jenkinsfile b/Jenkinsfile index e6924d3d682..f9f46dcc2e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -527,10 +527,11 @@ def e2e(Map args = [:]) { if (args.e2e.get('entrypoint', '')?.trim()) { e2e_with_entrypoint(args) } else { - runE2e(jobName: args.e2e?.get('job'), - testMatrixFile: args.e2e?.get('testMatrixFile', ''), + runE2E(testMatrixFile: args.e2e?.get('testMatrixFile', ''), beatVersion: "${env.VERSION}-SNAPSHOT", - gitHubCheckName: "e2e-${args.context}") + gitHubCheckName: "e2e-${args.context}", + gitHubCheckRepo: env.REPO, + gitHubCheckSha1: env.GIT_BASE_COMMIT) } } diff --git a/x-pack/elastic-agent/Jenkinsfile.yml b/x-pack/elastic-agent/Jenkinsfile.yml index 3e2155401c5..bda8cbdc684 100644 --- a/x-pack/elastic-agent/Jenkinsfile.yml +++ b/x-pack/elastic-agent/Jenkinsfile.yml @@ -96,7 +96,6 @@ stages: packaging-linux: "mage package" e2e: enabled: true - job: 'e2e-tests/e2e-testing-mbp' testMatrixFile: '.ci/.e2e-tests-for-elastic-agent.yaml' when: ## Customise when to run this subtask in the packaging stage. branches: false ## Only on a PR basis for the time being From 59ae9e2fb9e9ac7669fd969a5e6c676526a18b91 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 19 Oct 2021 11:45:43 +0100 Subject: [PATCH 3/4] chore: for testing purposes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f9f46dcc2e0..f265a68c73f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -@Library('apm@current') _ +@Library('apm@feature/build-e2e-step') _ pipeline { agent { label 'ubuntu-18 && immutable' } From b51c0bd68483cd22a29f61f6b1c7d8aa5d8d845d Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 20 Oct 2021 17:33:55 +0100 Subject: [PATCH 4/4] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f265a68c73f..f9f46dcc2e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -@Library('apm@feature/build-e2e-step') _ +@Library('apm@current') _ pipeline { agent { label 'ubuntu-18 && immutable' }