Skip to content

Commit 8adf297

Browse files
committed
ci: adjust GitRepo initialization
Signed-off-by: Andrea Mazzotti <[email protected]>
1 parent 3b08b4a commit 8adf297

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
merge_group:
77
workflow_dispatch:
88

9+
env:
10+
SOURCE_REPO: https://github.com/${{ github.event.pull_request.head.repo.full_name || 'rancher/cluster-api-addon-provider-fleet' }}
11+
SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }}
12+
913
jobs:
1014
build:
1115
runs-on: ubuntu-latest

justfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ ARCH := if arch() == "aarch64" { "arm64"} else { "amd64" }
1111
DIST := os()
1212
REFRESH_BIN := env_var_or_default('REFRESH_BIN', '1')
1313

14+
GIT_REPO := env_var_or_default('SOURCE_REPO', `git remote get-url origin`)
15+
GIT_BRANCH := env_var_or_default('SOURCE_BRANCH', `git branch --show-current`)
16+
1417
# Test providers
1518
CLUSTER_API_VERSION := "v1.12.2"
1619
CAPRKE2_VERSION := "v0.23.0"
@@ -127,12 +130,11 @@ deploy-calico:
127130
deploy-calico-gitrepo: _download-yq
128131
#!/usr/bin/env bash
129132
set -euxo pipefail
130-
repo=`git remote get-url origin`
131-
branch=`git branch --show-current`
132133
cp testdata/gitrepo-calico.yaml {{OUT_DIR}}/gitrepo-calico.yaml
133-
yq -i ".spec.repo = \"${repo}\"" {{OUT_DIR}}/gitrepo-calico.yaml
134-
yq -i ".spec.branch = \"${branch}\"" {{OUT_DIR}}/gitrepo-calico.yaml
135-
kubectl apply -f {{OUT_DIR}}/gitrepo-calico.yaml
134+
yq -i ".spec.repo = \"{{GIT_REPO}}\"" {{OUT_DIR}}/gitrepo-calico.yaml
135+
yq -i ".spec.branch = \"{{GIT_BRANCH}}\"" {{OUT_DIR}}/gitrepo-calico.yaml
136+
#kubectl apply -f {{OUT_DIR}}/gitrepo-calico.yaml
137+
cat {{OUT_DIR}}/gitrepo-calico.yaml
136138

137139
# Deploy an example app bundle to the cluster
138140
deploy-app:

0 commit comments

Comments
 (0)