Skip to content

Commit ee05358

Browse files
authored
Add support for forked git repository (#73)
1 parent fbc313a commit ee05358

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

e2e/argocd.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ kubectl config set-context --current --namespace="$NS"
2323

2424
# Add support for Github PR, which do not have a branch name in the git repository
2525
if [ "${GITHUB_EVENT_NAME:-}" = "pull_request" ]; then
26-
revision="$GITHUB_HEAD_REF"
26+
revision="${GITHUB_HEAD_REF}"
27+
# During a PR, the git repository containing the CI code is the forked one
28+
git_repo=$(jq -r '.pull_request.head.repo.full_name' "$GITHUB_EVENT_PATH")
2729
else
28-
revision="$SPARKMEASURE_WORKBRANCH"
30+
revision="${SPARKMEASURE_WORKBRANCH:-main}"
31+
git_repo="${GITHUB_REPOSITORY}"
2932
fi
33+
git_repo="https://github.com/${git_repo}"
3034

31-
argocd app create $app_name --dest-server https://kubernetes.default.svc \
35+
argocd app create "$app_name" --dest-server https://kubernetes.default.svc \
3236
--dest-namespace "$app_name" \
33-
--repo https://github.com/k8s-school/$app_name \
37+
--repo "$git_repo" \
3438
--path e2e/charts/apps --revision "$revision" \
3539
-p spec.source.targetRevision.default="$revision"
3640

0 commit comments

Comments
 (0)