Skip to content

Commit afd4c32

Browse files
committed
feat: initProvider
1 parent 7a4d6ae commit afd4c32

4 files changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/on-push-main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
github: true
4545
gh-app-id: "2650923"
4646
gh-owner: ${{ github.repository_owner }}
47+
github-auth-mode: app
4748
secrets:
4849
GH_APP_KEY: ${{ secrets.GH_APP_KEY }}
4950

functions/render/210-github-repository.yaml.gotmpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ spec:
2020
description: {{ $repo.description }}
2121
visibility: {{ $repo.visibility }}
2222
hasIssues: true
23+
{{- if $repo.topics }}
24+
topics:
25+
{{- toYaml $repo.topics | nindent 6 }}
26+
{{- end }}
27+
# Create-only repo settings belong in initProvider so provider-upjet-github
28+
# does not keep driving follow-up updates for initialization fields.
29+
initProvider:
2330
deleteBranchOnMerge: {{ $repo.deleteBranchOnMerge }}
2431
{{- if $repo.template.repository }}
2532
template:
@@ -29,10 +36,6 @@ spec:
2936
{{- else }}
3037
autoInit: {{ $repo.autoInit }}
3138
{{- end }}
32-
{{- if $repo.topics }}
33-
topics:
34-
{{- toYaml $repo.topics | nindent 6 }}
35-
{{- end }}
3639
providerConfigRef:
3740
name: {{ $state.githubProviderConfigRef.name }}
3841
kind: {{ $state.githubProviderConfigRef.kind }}

tests/e2etest-gitops/main.k

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1
1111
# Creates a real GitHub repository and installs ArgoCD via Helm.
1212
#
1313
# Credentials required:
14-
# secrets/github-creds - GitHub App installation token JSON
14+
# secrets/github-creds - provider-upjet-github credentials JSON.
15+
# Token form:
1516
# {"token":"ghs_...","owner":"hops-ops"}
17+
# App auth form:
18+
# {"owner":"hops-ops","app_auth":[{"id":"123456","installation_id":"78901234","pem_file":"-----BEGIN RSA PRIVATE KEY-----\n..."}]}
1619
#
17-
# The shared e2e workflow populates secrets/github-creds from a GitHub App token.
18-
# It must request the organization owner installation so repo creation against
20+
# The shared e2e workflow currently writes this file for the test. The GitHub
21+
# App installation must target the organization owner so repo creation against
1922
# POST /orgs/{org}/repos is allowed.
2023
#
2124
# Run: make e2e

tests/test-render/main.k

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ _items = [
226226
name = "test-cluster-gitops"
227227
visibility = "private"
228228
hasIssues = True
229+
}
230+
spec.initProvider = {
229231
deleteBranchOnMerge = True
230232
template = [
231233
{
@@ -264,10 +266,12 @@ _items = [
264266
metadata.name = "init-test-gitops-repo"
265267
spec.forProvider = {
266268
name = "test-cluster-gitops"
267-
autoInit = True
268269
visibility = "private"
269270
hasIssues = True
271+
}
272+
spec.initProvider = {
270273
deleteBranchOnMerge = True
274+
autoInit = True
271275
}
272276
}
273277
]
@@ -475,6 +479,8 @@ _items = [
475479
visibility = "public"
476480
topics = ["gitops", "kubernetes"]
477481
hasIssues = True
482+
}
483+
spec.initProvider = {
478484
deleteBranchOnMerge = True
479485
autoInit = True
480486
}

0 commit comments

Comments
 (0)