Skip to content

Commit 5330f7a

Browse files
committed
fix: 🐛 add missing custom source repositories in argocd values (pulling mode)
1 parent e40c00b commit 5330f7a

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

plugins/argocd/src/app-project.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export interface ArgoDestination {
77
server?: string
88
}
99

10-
export function getAppProjectObject({ name, sourceRepos, roGroup, rwGroup, destination, project, environment }:
11-
{ name: string, sourceRepos: string[], roGroup: string, rwGroup: string, destination: ArgoDestination, project: Project, environment: Environment }) {
12-
const minimalAppProject = getMinimalAppProjectPatch(destination, name, sourceRepos, roGroup, rwGroup, project, environment)
10+
export function getAppProjectObject({ name, sourceRepositories, roGroup, rwGroup, destination, project, environment }:
11+
{ name: string, sourceRepositories: string[], roGroup: string, rwGroup: string, destination: ArgoDestination, project: Project, environment: Environment }) {
12+
const minimalAppProject = getMinimalAppProjectPatch(destination, name, sourceRepositories, roGroup, rwGroup, project, environment)
1313
minimalAppProject.apiVersion = 'argoproj.io/v1alpha1'
1414
minimalAppProject.metadata.namespace = getConfig().namespace
1515
return minimalAppProject
1616
}
1717

18-
export function getMinimalAppProjectPatch(destination: ArgoDestination, name: string, sourceRepos: string[], roGroup: string, rwGroup: string, project: Project, environment: Environment) {
18+
export function getMinimalAppProjectPatch(destination: ArgoDestination, name: string, sourceRepositories: string[], roGroup: string, rwGroup: string, project: Project, environment: Environment) {
1919
return {
2020
apiVersion: 'argoproj.io/v1alpha1',
2121
kind: 'AppProject',
@@ -60,7 +60,7 @@ export function getMinimalAppProjectPatch(destination: ArgoDestination, name: st
6060
],
6161
},
6262
],
63-
sourceRepos,
63+
sourceRepos: sourceRepositories,
6464
},
6565
} as BaseResources
6666
}

plugins/argocd/src/functions.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const upsertProject: StepCall<Project> = async (payload) => {
3535
const projectSelector2 = `dso/project.id=${project.id},app.kubernetes.io/managed-by=dso-console`
3636

3737
const infraRepositories = project.repositories.filter(repo => repo.isInfra)
38-
const sourceRepos = [
38+
const sourceRepositories = [
3939
`${await gitlabApi.getGroupUrl()}/**`,
4040
...splitExtraRepositories(payload.config.argocd?.extraRepositories),
4141
...splitExtraRepositories(project.store.argocd?.extraRepositories),
@@ -76,6 +76,7 @@ export const upsertProject: StepCall<Project> = async (payload) => {
7676
appProjectName,
7777
infraRepositories,
7878
infraProject.id,
79+
sourceRepositories,
7980
gitlabApi,
8081
vaultApi,
8182
)
@@ -91,7 +92,7 @@ export const upsertProject: StepCall<Project> = async (payload) => {
9192
const minimalAppProject = getMinimalAppProjectPatch(
9293
destination,
9394
appProjectName,
94-
sourceRepos,
95+
sourceRepositories,
9596
roGroup,
9697
rwGroup,
9798
project,
@@ -101,7 +102,7 @@ export const upsertProject: StepCall<Project> = async (payload) => {
101102
} else {
102103
const appProjectObject = getAppProjectObject({
103104
name: appProjectName,
104-
sourceRepos,
105+
sourceRepositories,
105106
destination,
106107
roGroup,
107108
rwGroup,
@@ -205,16 +206,14 @@ interface ArgoRepoSource {
205206
path: string
206207
valueFiles: string[]
207208
}
208-
async function ensureInfraEnvValues(project: Project, environment: Environment, appNamespace: string, roGroup: string, rwGroup: string, appProjectName: string, sourceRepos: Repository[], repoId: number, gitlabApi: GitlabProjectApi, vaultApi: VaultProjectApi) {
209-
const infraAppsRepoUrl = await gitlabApi.getRepoUrl('infra-apps')
210-
const gitlabGroupUrl = dirname(infraAppsRepoUrl)
209+
async function ensureInfraEnvValues(project: Project, environment: Environment, appNamespace: string, roGroup: string, rwGroup: string, appProjectName: string, infraRepositories: Repository[], repoId: number, sourceRepositories: string[], gitlabApi: GitlabProjectApi, vaultApi: VaultProjectApi) {
211210
const cluster = getCluster(project, environment)
212211
const infraProject = await gitlabApi.getProjectById(repoId)
213212
const valueFilePath = getValueFilePath(project, cluster, environment)
214213
const vaultCredentials = await vaultApi.Project.getCredentials()
215214
const repositories: ArgoRepoSource[] = await Promise.all([
216215
getArgoRepoSource('infra-apps', environment.name, gitlabApi),
217-
...sourceRepos.map(repo => getArgoRepoSource(repo.internalRepoName, environment.name, gitlabApi)),
216+
...infraRepositories.map(repo => getArgoRepoSource(repo.internalRepoName, environment.name, gitlabApi)),
218217
])
219218
const values = {
220219
common: {
@@ -227,7 +226,7 @@ async function ensureInfraEnvValues(project: Project, environment: Environment,
227226
cluster: inClusterLabel,
228227
namespace: getConfig().namespace,
229228
project: appProjectName,
230-
envChartVersion: process.env.DSO_ENV_CHART_VERSION ?? 'dso-env-1.4.0',
229+
envChartVersion: process.env.DSO_ENV_CHART_VERSION ?? 'dso-env-1.5.2',
231230
nsChartVersion: process.env.DSO_NS_CHART_VERSION ?? 'dso-ns-1.1.1',
232231
},
233232
environment: {
@@ -242,7 +241,7 @@ async function ensureInfraEnvValues(project: Project, environment: Environment,
242241
cpu: environment.quota.cpu,
243242
memory: environment.quota.memory,
244243
},
245-
sourceReposPrefix: gitlabGroupUrl,
244+
sourceRepositories,
246245
destination: {
247246
namespace: appNamespace,
248247
name: cluster.label,

0 commit comments

Comments
 (0)