This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
chore: add debug info for the payload #1044
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ pipeline { | |
environment { | ||
REPO = 'kibana' | ||
BASE_DIR = "src/github.com/elastic/${env.REPO}" | ||
GITHUB_APP_SECRET = 'secret/observability-team/ci/github-app' | ||
GITHUB_CHECK_E2E_TESTS_NAME = 'E2E Tests' | ||
PIPELINE_LOG_LEVEL = "INFO" | ||
} | ||
|
@@ -25,16 +26,15 @@ pipeline { | |
GenericTrigger( | ||
genericVariables: [ | ||
[key: 'GT_REPO', value: '$.repository.full_name'], | ||
[key: 'GT_BASE_REF', value: '$.pull_request.base.ref'], | ||
[key: 'GT_PR', value: '$.issue.number'], | ||
[key: 'GT_PR_HEAD_SHA', value: '$.pull_request.head.sha'], | ||
[key: 'GT_BODY', value: '$.comment.body'], | ||
[key: 'GT_COMMENT_ID', value: '$.comment.id'] | ||
[key: 'GT_PAYLOAD', value: '$'] | ||
], | ||
genericHeaderVariables: [ | ||
[key: 'x-github-event', regexpFilter: 'comment'] | ||
], | ||
causeString: 'Triggered on #$GT_PR (baseRef:$GT_BASE_REF, sha:$GT_PR_HEAD_SHA), via comment: $GT_BODY', | ||
causeString: 'Triggered on #$GT_PR via comment: $GT_BODY', | ||
printContributedVariables: false, | ||
printPostContent: false, | ||
silentResponse: true, | ||
|
@@ -53,6 +53,7 @@ pipeline { | |
PATH = "${env.HOME}/bin:${env.HOME}/node_modules:${env.HOME}/node_modules/.bin:${env.PATH}" | ||
} | ||
steps { | ||
echo(message: "$env.GT_PAYLOAD") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For debugging purpose, will be reverted |
||
checkPermissions() | ||
buildKibanaDockerImage(refspec: getBranch()) | ||
catchError(buildResult: 'UNSTABLE', message: 'Unable to run e2e tests', stageResult: 'FAILURE') { | ||
|
@@ -76,29 +77,40 @@ def checkPermissions(){ | |
} | ||
|
||
def getBranch(){ | ||
return "PR/" + getID() | ||
} | ||
|
||
def getID(){ | ||
if(env.GT_PR){ | ||
return "PR/${env.GT_PR}" | ||
return "${env.GT_PR}" | ||
} | ||
|
||
return "PR/${params.kibana_pr}" | ||
return "${params.kibana_pr}" | ||
} | ||
|
||
def getDockerTag(){ | ||
def runE2ETests(String suite) { | ||
// we need a second API request, as the issue_comment API does not retrieve data about the pull request | ||
// See https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment | ||
def prID = getID() | ||
def token = githubAppToken(secret: "${env.GITHUB_APP_SECRET}") | ||
|
||
def pullRequest = githubApiCall(token: token, url: "https://api.github.com/repos/${env.$GT_REPO}/pulls/${prID}") | ||
def baseRef = pullRequest?.base?.ref | ||
def headSha = pullRequest?.head?.sha | ||
|
||
// we are going to use the 'pr12345' tag as default | ||
def dockerTag = "pr${params.kibana_pr}" | ||
if(env.GT_PR){ | ||
return "${env.GT_PR_HEAD_SHA}" | ||
// it's a PR: we are going to use its head SHA as tag | ||
dockerTag = headSha | ||
} | ||
|
||
// we are going to use the 'pr12345' tag | ||
return "pr${params.kibana_pr}" | ||
} | ||
|
||
def runE2ETests(String suite) { | ||
log(level: 'DEBUG', text: "Triggering '${suite}' E2E tests for PR-${env.GT_PR}.") | ||
log(level: 'DEBUG', text: "Triggering '${suite}' E2E tests for PR-${prID} using '${dockerTag}' as Docker tag") | ||
|
||
// Kibana's maintenance branches follow the 7.11, 7.12 schema. | ||
def branchName = "${env.GT_BASE_REF}" | ||
if (env.GT_BASE_REF != "master") { | ||
branchName = "${env.GT_BASE_REF}.x" | ||
def branchName = "${baseRef}" | ||
if (branchName != "master") { | ||
branchName += ".x" | ||
} | ||
def e2eTestsPipeline = "e2e-tests/e2e-testing-mbp/${branchName}" | ||
|
||
|
@@ -110,7 +122,7 @@ def runE2ETests(String suite) { | |
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: 'KIBANA_VERSION', value: getDockerTag()), | ||
string(name: 'KIBANA_VERSION', value: dockerTag), | ||
] | ||
|
||
build(job: "${e2eTestsPipeline}", | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For debugging purpose, will be reverted