From 9dc8562426a5ff1c01f3cefa720fb0982e0b6c67 Mon Sep 17 00:00:00 2001 From: Nicolas Savoire Date: Tue, 16 May 2023 11:28:38 +0200 Subject: [PATCH] Report downstream pipeline failures to GH It seems that since there are no "real" jobs in gitlab pipeline, only a trigger for a downstream pipeline, gitsync does not push any status check to github (status checks are associated to "real" jobs). The workaround it to create an actual job whose status depends on status of downstream pipeline. --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d37d9e3b6..94212ade9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,3 +21,26 @@ trigger_internal_build: project: DataDog/apm-reliability/ddprof-build strategy: depend branch: $DOWNSTREAM_BUILD_BRANCH + +# Following jobs are required otherwise gitsync will not report downstream pipeline failure to github + +# This job is used to determine is downstream pipeline has succeeded +report_failure: + tags: ["arch:amd64"] + when: on_failure + needs: [trigger_internal_build] + # allow_failure: true prevents the job from showing up in github statuses (because it's filtered by gitsync) + allow_failure: true + script: + - echo "STATUS=1" >> .env + artifacts: + reports: + dotenv: .env + +# Final job that will show in github statuses +report_gitlab_CI_status: + tags: ["arch:amd64"] + when: always + stage: .post + script: + - exit ${STATUS}