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

Commit

Permalink
feat: support contributing a GH check to the upstream job that trigge…
Browse files Browse the repository at this point in the history
…red the build (#315) (#316)

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

* fix: add credentials
# Conflicts:
#	.ci/Jenkinsfile
  • Loading branch information
mdelapenya authored Sep 22, 2020
1 parent e98b8dc commit 4742402
Showing 1 changed file with 18 additions and 0 deletions.
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"
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')
notifyBuildResult(analyzeFlakey: true, flakyReportIdx: "reporter-e2e-tests-end-2-end-tests-pipeline-7.9.x", 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
}
}

0 comments on commit 4742402

Please sign in to comment.