Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: refactor the run e2e build #28502

Merged
merged 4 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -416,38 +416,14 @@ def runE2ETests(){
};
}

triggerE2ETests(suites)
runE2E(runTestsSuites: suites,
beatVersion: "${env.BEAT_VERSION}-SNAPSHOT",
gitHubCheckName: env.GITHUB_CHECK_E2E_TESTS_NAME,
gitHubCheckRepo: env.REPO,
gitHubCheckSha1: env.GIT_BASE_COMMIT)
}
}

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],
Expand Down
35 changes: 5 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,11 @@ def e2e(Map args = [:]) {
if (args.e2e.get('entrypoint', '')?.trim()) {
e2e_with_entrypoint(args)
} else {
e2e_with_job(args)
runE2E(testMatrixFile: args.e2e?.get('testMatrixFile', ''),
beatVersion: "${env.VERSION}-SNAPSHOT",
gitHubCheckName: "e2e-${args.context}",
gitHubCheckRepo: env.REPO,
gitHubCheckSha1: env.GIT_BASE_COMMIT)
}
}

Expand Down Expand Up @@ -562,35 +566,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 <folder> then the dir(location) is not required, aka by disaling isMage: false
Expand Down
1 change: 0 additions & 1 deletion x-pack/elastic-agent/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down