From 56b46c4252425f680fdd8473efd8bb656bd629b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Tue, 22 Sep 2020 12:44:13 +0200 Subject: [PATCH 1/2] feat: support contributing a GH check to the upstream job that triggered the build --- .ci/Jenkinsfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 3cadb6a27c..3f316b2024 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -43,6 +43,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'){ @@ -227,6 +230,7 @@ pipeline { } post { cleanup { + githubCheckNotify(currentBuild.currentResult == 'SUCCESS' ? 'SUCCESS' : 'FAILURE') notifyBuildResult(analyzeFlakey: true, flakyReportIdx: "reporter-e2e-tests-end-2-end-tests-pipeline-master", prComment: true) } success { @@ -300,3 +304,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 + } +} From 30c1ce623a1f87429b1a60bcca74bef7ad2ee1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Tue, 22 Sep 2020 13:59:08 +0200 Subject: [PATCH 2/2] fix: add credentials --- .ci/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 3f316b2024..5fd7c7e654 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -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' }