From c8d5d8007c3147ee46844763a2be363e753aee7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20V=C3=A9rin?= Date: Thu, 12 Mar 2026 11:23:48 +0100 Subject: [PATCH] BUILD-10457 Parameterize check context in github_notify_promotion Make check_context a function parameter and call github_notify_promotion twice: once with the new BUILD_NAME-scoped context for unique parallel checks, and once with the legacy repox-${GITHUB_REF_NAME} context for backward compatibility. --- promote/promote.sh | 6 ++++-- spec/promote_spec.sh | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/promote/promote.sh b/promote/promote.sh index b52c358f..0b6f1242 100755 --- a/promote/promote.sh +++ b/promote/promote.sh @@ -148,6 +148,7 @@ promote_mono() { } github_notify_promotion() { + local check_context="$1" local project_version longDescription shortDescription buildUrl githubApiUrl project_version="$PROJECT_VERSION" longDescription="Latest promoted build of '${project_version}' from branch '${GITHUB_REF}'" @@ -159,7 +160,7 @@ github_notify_promotion() { "state": "success", "target_url": "$buildUrl", "description": "$shortDescription", - "context": "repox-${GITHUB_REF_NAME}" + "context": "$check_context" } EOF } @@ -224,7 +225,8 @@ promote() { echo "::endgroup::" echo "::group::Notify GitHub" - github_notify_promotion + github_notify_promotion "repox-${BUILD_NAME}-${GITHUB_REF_NAME}" + github_notify_promotion "repox-${GITHUB_REF_NAME}" # DEPRECATED - backward compatibility echo "::endgroup::" generate_workflow_summary diff --git a/spec/promote_spec.sh b/spec/promote_spec.sh index a271dd80..09344d2d 100755 --- a/spec/promote_spec.sh +++ b/spec/promote_spec.sh @@ -97,7 +97,7 @@ Describe 'promote/promote.sh' export PROMOTE_PULL_REQUEST="true" When run script promote/promote.sh The status should be success - The lines of stdout should equal 20 + The lines of stdout should equal 21 The line 1 should equal "::group::Check tools" The line 2 should include "gh" The line 3 should include "gh" @@ -117,7 +117,8 @@ Describe 'promote/promote.sh' The line 17 should equal "::endgroup::" The line 18 should equal "::group::Notify GitHub" The line 19 should include "gh api -X POST" - The line 20 should equal "::endgroup::" + The line 20 should include "gh api -X POST" + The line 21 should equal "::endgroup::" End It 'skips promotion on pull_request when promotion is disabled' @@ -351,9 +352,9 @@ Describe 'jfrog_promote()' End Describe 'github_notify_promotion()' - It 'calls gh api with correct parameters' + It 'calls gh api with the provided check context' export PROJECT_VERSION="1.2.3" - When call github_notify_promotion + When call github_notify_promotion "repox-dummy-project-dummy-branch" The output should include "gh api -X POST -H X-GitHub-Api-Version: 2022-11-28" The output should include "https://api.github.com/repos/$GITHUB_REPOSITORY/statuses/$GITHUB_SHA" The output should include "-H Content-Type: application/json --input -"