Skip to content

Commit

Permalink
pair only in codeready-toolchain org & introduce CI_DISABLE_PAIRING v…
Browse files Browse the repository at this point in the history
…ar (#1041)
  • Loading branch information
MatousJobanek authored Aug 26, 2024
1 parent 4a1e146 commit 0670d7e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions make/ksctl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ endif

get-ksctl-and-install:
ifeq ($(strip $(KSCTL_REPO_PATH)),)
ifneq ($(DEPLOY_LATEST),true)
ifneq ($(CI),)
ifneq ($(GITHUB_ACTIONS),)
$(eval BRANCH_NAME = ${GITHUB_HEAD_REF})
$(eval AUTHOR_LINK = https://github.com/${AUTHOR})
else
$(eval AUTHOR_LINK = $(shell jq -r '.refs[0].pulls[0].author_link' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]'))
@echo "found author link ${AUTHOR_LINK}"
$(eval BRANCH_NAME := $(shell jq -r '.refs[0].pulls[0].head_ref' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]'))
endif
ifneq ($(CI_DISABLE_PAIRING),true)
ifeq ($(shell jq -r '.refs[0].org' <<< $${CLONEREFS_OPTIONS} 2>/dev/null || true | tr -d '[:space:]'),codeready-toolchain)
$(eval AUTHOR_LINK = $(shell jq -r '.refs[0].pulls[0].author_link' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]'))
$(eval BRANCH_NAME := $(shell jq -r '.refs[0].pulls[0].head_ref' <<< $${CLONEREFS_OPTIONS} | tr -d '[:space:]'))
@echo "using author link ${AUTHOR_LINK}"
@echo "detected branch ${BRANCH_NAME}"
# check if a branch with the same ref exists in the user's fork of ksctl repo
Expand All @@ -35,10 +29,10 @@ ifeq ($(strip $(KSCTL_REPO_PATH)),)
# check if the branch with the same name exists, if so then merge it with master and use the merge branch, if not then use master
@$(MAKE) clone-ksctl-and-pair REMOTE_KSCTL_BRANCH=${REMOTE_KSCTL_BRANCH} AUTHOR_LINK=${AUTHOR_LINK}
else
@echo "Not running in CI - no pairing"
@echo "Either not running in openshift-ci or not in the codeready-toolchain org - no pairing"
endif
else
@echo "DEPLOY_LATEST is set to true - no pairing"
@echo "Pairing explicitly disabled"
endif
else
@echo "KSCTL_REPO_PATH is set to ${KSCTL_REPO_PATH} - no pairing"
Expand Down

0 comments on commit 0670d7e

Please sign in to comment.