Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

feat: support contributing a GH check to the upstream job that triggered the build #315

Merged
merged 2 commits into from
Sep 22, 2020
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
18 changes: 18 additions & 0 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pipeline {
BASE_DIR = "src/github.com/elastic/${env.REPO}"
NOTIFY_TO = credentials('notify-to')
JOB_GCS_BUCKET = credentials('gcs-bucket')
JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
DOCKER_ELASTIC_SECRET = 'secret/observability-team/ci/docker-registry/prod'
DOCKER_REGISTRY = 'docker.elastic.co'
}
Expand Down Expand Up @@ -43,6 +44,9 @@ pipeline {
string(name: 'HELM_VERSION', defaultValue: '2.16.3', description: 'SemVer version of Helm to be used.')
string(name: 'HELM_KIND_VERSION', defaultValue: '0.8.1', description: 'SemVer version of Kind to be used.')
string(name: 'HELM_KUBERNETES_VERSION', defaultValue: '1.18.2', description: 'SemVer version of Kubernetes to be used.')
string(name: 'GITHUB_CHECK_NAME', defaultValue: '', description: 'Name of the GitHub check to be updated. Only if this build is triggered from another parent stream.')
string(name: 'GITHUB_CHECK_REPO', defaultValue: '', description: 'Name of the GitHub repo to be updated. Only if this build is triggered from another parent stream.')
string(name: 'GITHUB_CHECK_SHA1', defaultValue: '', description: 'Name of the GitHub repo to be updated. Only if this build is triggered from another parent stream.')
}
stages {
stage('Initializing'){
Expand Down Expand Up @@ -227,6 +231,7 @@ pipeline {
}
post {
cleanup {
githubCheckNotify(currentBuild.currentResult == 'SUCCESS' ? 'SUCCESS' : 'FAILURE')
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
notifyBuildResult(analyzeFlakey: true, flakyReportIdx: "reporter-e2e-tests-end-2-end-tests-pipeline-master", prComment: true)
}
success {
Expand Down Expand Up @@ -300,3 +305,16 @@ def generateFunctionalTestStep(Map params = [:]){
}
}
}

/**
Notify the GitHub check of the parent stream
**/
def githubCheckNotify(String status) {
if (params.GITHUB_CHECK_NAME?.trim() && params.GITHUB_CHECK_REPO?.trim() && params.GITHUB_CHECK_SHA1?.trim()) {
githubNotify context: "${params.GITHUB_CHECK_NAME}",
description: "${params.GITHUB_CHECK_NAME} ${status.toLowerCase()}",
status: "${status}",
targetUrl: "${env.RUN_DISPLAY_URL}",
sha: params.GITHUB_CHECK_SHA1, account: 'elastic', repo: params.GITHUB_CHECK_REPO, credentialsId: env.JOB_GIT_CREDENTIALS
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
}
}