diff --git a/Jenkinsfile b/Jenkinsfile index ccb0097481ac..2b318dfbb503 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -516,6 +516,11 @@ def getBeatsName(baseDir) { */ def e2e(Map args = [:]) { if (!args.e2e?.get('enabled', false)) { return } + // Skip running the tests on branches or tags if configured. + if (!isPR() && args.e2e?.get('when', false)) { + if (isBranch() && !args.e2e.when.get('branches', true)) { return } + if (isTag() && !args.e2e.when.get('tags', true)) { return } + } if (args.e2e.get('entrypoint', '')?.trim()) { e2e_with_entrypoint(args) } else { diff --git a/x-pack/elastic-agent/Jenkinsfile.yml b/x-pack/elastic-agent/Jenkinsfile.yml index 23a5daf0a6f8..3e2155401c55 100644 --- a/x-pack/elastic-agent/Jenkinsfile.yml +++ b/x-pack/elastic-agent/Jenkinsfile.yml @@ -98,6 +98,9 @@ stages: 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 + tags: false ## e2e on branches/tags is already in place with the downstream build. stage: packaging packaging-arm: packaging-arm: "mage package"