Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
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
21 changes: 17 additions & 4 deletions .ci/e2eFleetServer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pipeline {
stage('Build Fleet Server') {
options { skipDefaultCheckout() }
steps {
gitCheckout(basedir: BASE_DIR, branch: 'master', githubNotifyFirstTimeContributor: true, repo: "[email protected]:${env.ELASTIC_REPO}.git", credentialsId: env.JOB_GIT_CREDENTIALS)
gitCheckout(basedir: BASE_DIR, branch: getFleetServerBranch(), repo: "[email protected]:${env.ELASTIC_REPO}.git", credentialsId: env.JOB_GIT_CREDENTIALS)
dir("${BASE_DIR}") {
withGoEnv(){
sh(label: 'Build Fleet Server', script: "make release")
Expand All @@ -89,7 +89,7 @@ pipeline {
stage('Build Elastic Agent Dependencies') {
options { skipDefaultCheckout() }
steps {
gitCheckout(basedir: BEATS_BASE_DIR, branch: 'master', githubNotifyFirstTimeContributor: true, repo: "[email protected]:${env.BEATS_ELASTIC_REPO}.git", credentialsId: env.JOB_GIT_CREDENTIALS)
gitCheckout(basedir: BEATS_BASE_DIR, branch: "${BASE_REF}", repo: "[email protected]:${env.BEATS_ELASTIC_REPO}.git", credentialsId: env.JOB_GIT_CREDENTIALS)
dir("${BEATS_BASE_DIR}/x-pack/elastic-agent") {
withGoEnv(){
sh(label: 'Build Fleet Server', script: 'DEV=true SNAPSHOT=true PLATFORMS="+all linux/amd64" mage package')
Expand Down Expand Up @@ -117,7 +117,7 @@ pipeline {
stage('Run E2E Tests') {
options { skipDefaultCheckout() }
steps {
gitCheckout(basedir: E2E_BASE_DIR, branch: "${env.E2E_BASE_BRANCH}", githubNotifyFirstTimeContributor: true, repo: '[email protected]:elastic/e2e-testing.git', credentialsId: env.JOB_GIT_CREDENTIALS)
gitCheckout(basedir: E2E_BASE_DIR, branch: "${env.E2E_BASE_BRANCH}", repo: '[email protected]:elastic/e2e-testing.git', credentialsId: env.JOB_GIT_CREDENTIALS)
dockerLogin(secret: "${DOCKER_ELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}")
dir("${E2E_BASE_DIR}") {
withGoEnv(){
Expand Down Expand Up @@ -151,6 +151,8 @@ def getE2EBaseBranch() {
def prID = getID()

if (!prID.isInteger()) {
// we are building a branch on Fleet Server
setEnvVar('BASE_REF', prID)
// in the case we are triggering the job for a branch (i.e master, 7.x) we directly use branch name as Docker tag
return getMaintenanceBranch(prID)
}
Expand All @@ -159,6 +161,7 @@ def getE2EBaseBranch() {

def pullRequest = githubApiCall(token: token, url: "https://api.github.com/repos/${env.ELASTIC_REPO}/pulls/${prID}")
def baseRef = pullRequest?.base?.ref
setEnvVar('BASE_REF', baseRef)
//def headSha = pullRequest?.head?.sha

return getMaintenanceBranch(baseRef)
Expand All @@ -179,8 +182,18 @@ def getMaintenanceBranch(String branch){

if (!branch.endsWith('.x')) {
// use maintenance branches mode (i.e. 7.16 translates to 7.16.x)
return branch + '.x'
branch += '.x'
}

return branch
}

def getFleetServerBranch(){
def fleetServerBranch = getID()

if (!fleetServerBranch.isInteger()) {
return fleetServerBranch
}

return 'PR/'+fleetServerBranch
}