Skip to content

Commit 1e79377

Browse files
committed
ci: update matrix command with needed flags across environments
1 parent da01233 commit 1e79377

File tree

4 files changed

+249
-113
lines changed

4 files changed

+249
-113
lines changed

scripts/deploy-camunda/cmd/matrix.go

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,34 @@ This command does not require cluster access.`,
8989
// newMatrixRunCommand creates the "matrix run" subcommand.
9090
func newMatrixRunCommand() *cobra.Command {
9191
var (
92-
versions []string
93-
includeDisabled bool
94-
scenarioFilter string
95-
flowFilter string
96-
platform string
97-
repoRoot string
98-
dryRun bool
99-
testIT bool
100-
testE2E bool
101-
testAll bool
102-
stopOnFailure bool
103-
namespacePrefix string
104-
cleanup bool
105-
kubeContext string
106-
kubeContextGKE string
107-
kubeContextEKS string
108-
ingressBaseDomain string
109-
maxParallel int
110-
envFile string
111-
envFile86 string
112-
envFile87 string
113-
envFile88 string
114-
envFile89 string
115-
logLevel string
92+
versions []string
93+
includeDisabled bool
94+
scenarioFilter string
95+
flowFilter string
96+
platform string
97+
repoRoot string
98+
dryRun bool
99+
testIT bool
100+
testE2E bool
101+
testAll bool
102+
stopOnFailure bool
103+
namespacePrefix string
104+
cleanup bool
105+
kubeContext string
106+
kubeContextGKE string
107+
kubeContextEKS string
108+
ingressBaseDomain string
109+
maxParallel int
110+
envFile string
111+
envFile86 string
112+
envFile87 string
113+
envFile88 string
114+
envFile89 string
115+
logLevel string
116+
skipDependencyUpdate bool
117+
useVaultBackedSecrets bool
118+
useVaultBackedSecretsGKE bool
119+
useVaultBackedSecretsEKS bool
116120
)
117121

118122
cmd := &cobra.Command{
@@ -209,23 +213,36 @@ This command calls deploy.Execute() for each matrix entry.`,
209213
}
210214
}
211215

216+
// Build platform-to-vault-backed-secrets map from per-platform flags.
217+
// Only platforms explicitly set via --use-vault-backed-secrets-<platform> are included.
218+
vaultBackedSecrets := make(map[string]bool)
219+
if cmd.Flags().Changed("use-vault-backed-secrets-gke") {
220+
vaultBackedSecrets["gke"] = useVaultBackedSecretsGKE
221+
}
222+
if cmd.Flags().Changed("use-vault-backed-secrets-eks") {
223+
vaultBackedSecrets["eks"] = useVaultBackedSecretsEKS
224+
}
225+
212226
results, err := matrix.Run(context.Background(), entries, matrix.RunOptions{
213-
DryRun: dryRun,
214-
StopOnFailure: stopOnFailure,
215-
Cleanup: cleanup,
216-
KubeContexts: kubeContexts,
217-
KubeContext: kubeContext,
218-
NamespacePrefix: namespacePrefix,
219-
Platform: platform,
220-
MaxParallel: maxParallel,
221-
TestIT: testIT,
222-
TestE2E: testE2E,
223-
TestAll: testAll,
224-
RepoRoot: repoRoot,
225-
EnvFiles: envFiles,
226-
EnvFile: envFile,
227-
IngressBaseDomain: ingressBaseDomain,
228-
LogLevel: logLevel,
227+
DryRun: dryRun,
228+
StopOnFailure: stopOnFailure,
229+
Cleanup: cleanup,
230+
KubeContexts: kubeContexts,
231+
KubeContext: kubeContext,
232+
NamespacePrefix: namespacePrefix,
233+
Platform: platform,
234+
MaxParallel: maxParallel,
235+
TestIT: testIT,
236+
TestE2E: testE2E,
237+
TestAll: testAll,
238+
RepoRoot: repoRoot,
239+
EnvFiles: envFiles,
240+
EnvFile: envFile,
241+
IngressBaseDomain: ingressBaseDomain,
242+
LogLevel: logLevel,
243+
SkipDependencyUpdate: skipDependencyUpdate,
244+
VaultBackedSecrets: vaultBackedSecrets,
245+
UseVaultBackedSecrets: useVaultBackedSecrets,
229246
})
230247

231248
fmt.Fprintln(os.Stdout, matrix.PrintRunSummary(results))
@@ -259,6 +276,10 @@ This command calls deploy.Execute() for each matrix entry.`,
259276
f.StringVar(&envFile88, "env-file-8.8", "", "Path to .env file for 8.8 entries")
260277
f.StringVar(&envFile89, "env-file-8.9", "", "Path to .env file for 8.9 entries")
261278
f.StringVarP(&logLevel, "log-level", "l", "info", "Log level (debug, info, warn, error)")
279+
f.BoolVar(&skipDependencyUpdate, "skip-dependency-update", false, "Skip helm dependency update before deploying")
280+
f.BoolVar(&useVaultBackedSecrets, "use-vault-backed-secrets", false, "Use vault-backed external secrets for all platforms (overridden by --use-vault-backed-secrets-gke/--use-vault-backed-secrets-eks)")
281+
f.BoolVar(&useVaultBackedSecretsGKE, "use-vault-backed-secrets-gke", false, "Use vault-backed external secrets for GKE entries")
282+
f.BoolVar(&useVaultBackedSecretsEKS, "use-vault-backed-secrets-eks", false, "Use vault-backed external secrets for EKS entries")
262283

263284
registerIngressBaseDomainCompletion(cmd)
264285
registerKubeContextCompletion(cmd)

scripts/deploy-camunda/matrix/matrix.go

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import (
99
"scripts/camunda-core/pkg/logging"
1010
)
1111

12-
// Entry represents a single matrix entry — one scenario + one flow combination.
12+
// Entry represents a single matrix entry — one scenario + one flow + one platform combination.
1313
type Entry struct {
1414
Version string `json:"version"`
1515
ChartPath string `json:"chartPath"`
1616
Scenario string `json:"scenario"`
1717
Shortname string `json:"shortname"`
1818
Auth string `json:"auth"`
1919
Flow string `json:"flow"`
20-
Platforms []string `json:"platforms,omitempty"`
20+
Platform string `json:"platform,omitempty"`
2121
Exclude []string `json:"exclude,omitempty"`
2222
Enabled bool `json:"enabled"`
2323
}
@@ -36,7 +36,7 @@ type FilterOptions struct {
3636
ScenarioFilter string
3737
// FlowFilter limits output to entries with this specific flow.
3838
FlowFilter string
39-
// Platform limits output to entries whose platforms list contains this value.
39+
// Platform limits output to entries targeting this platform.
4040
Platform string
4141
}
4242

@@ -124,19 +124,28 @@ func Generate(repoRoot string, opts GenerateOptions) ([]Entry, error) {
124124
continue
125125
}
126126

127-
// Create one entry per permitted flow
127+
// Create one entry per permitted flow per platform.
128+
// If no platforms are specified, create one entry with an empty platform
129+
// (defaults to "gke" at execution time via resolvePlatform).
130+
platforms := scenario.Platforms
131+
if len(platforms) == 0 {
132+
platforms = []string{""}
133+
}
134+
128135
for _, flow := range permittedFlows {
129-
entries = append(entries, Entry{
130-
Version: version,
131-
ChartPath: chartDir,
132-
Scenario: scenario.Name,
133-
Shortname: scenario.Shortname,
134-
Auth: scenario.Auth,
135-
Flow: flow,
136-
Platforms: scenario.Platforms,
137-
Exclude: scenario.Exclude,
138-
Enabled: scenario.Enabled,
139-
})
136+
for _, platform := range platforms {
137+
entries = append(entries, Entry{
138+
Version: version,
139+
ChartPath: chartDir,
140+
Scenario: scenario.Name,
141+
Shortname: scenario.Shortname,
142+
Auth: scenario.Auth,
143+
Flow: flow,
144+
Platform: platform,
145+
Exclude: scenario.Exclude,
146+
Enabled: scenario.Enabled,
147+
})
148+
}
140149
}
141150
}
142151
}
@@ -159,7 +168,7 @@ func Filter(entries []Entry, opts FilterOptions) []Entry {
159168
continue
160169
}
161170
if opts.Platform != "" {
162-
if len(e.Platforms) > 0 && !containsString(e.Platforms, opts.Platform) {
171+
if e.Platform != "" && e.Platform != opts.Platform {
163172
continue
164173
}
165174
}
@@ -168,16 +177,6 @@ func Filter(entries []Entry, opts FilterOptions) []Entry {
168177
return filtered
169178
}
170179

171-
// containsString checks if a slice contains a specific string.
172-
func containsString(slice []string, s string) bool {
173-
for _, v := range slice {
174-
if v == s {
175-
return true
176-
}
177-
}
178-
return false
179-
}
180-
181180
// Print outputs the matrix entries in the requested format.
182181
func Print(entries []Entry, format string) (string, error) {
183182
switch format {
@@ -209,25 +208,25 @@ func printTable(entries []Entry) string {
209208

210209
// Header
211210
fmt.Fprintf(&b, "%-8s %-6s %-25s %-10s %-10s %-16s %-12s %-8s\n",
212-
"ENABLED", "VER", "SCENARIO", "SHORT", "AUTH", "FLOW", "PLATFORMS", "EXCLUDE")
211+
"ENABLED", "VER", "SCENARIO", "SHORT", "AUTH", "FLOW", "PLATFORM", "EXCLUDE")
213212
fmt.Fprintf(&b, "%-8s %-6s %-25s %-10s %-10s %-16s %-12s %-8s\n",
214-
"-------", "---", "--------", "-----", "----", "----", "---------", "-------")
213+
"-------", "---", "--------", "-----", "----", "----", "--------", "-------")
215214

216215
for _, e := range entries {
217216
enabled := "yes"
218217
if !e.Enabled {
219218
enabled = "no"
220219
}
221-
platforms := strings.Join(e.Platforms, ",")
222-
if platforms == "" {
223-
platforms = "-"
220+
platform := e.Platform
221+
if platform == "" {
222+
platform = "-"
224223
}
225224
exclude := strings.Join(e.Exclude, ",")
226225
if exclude == "" {
227226
exclude = "-"
228227
}
229228
fmt.Fprintf(&b, "%-8s %-6s %-25s %-10s %-10s %-16s %-12s %s\n",
230-
enabled, e.Version, e.Scenario, e.Shortname, e.Auth, e.Flow, platforms, exclude)
229+
enabled, e.Version, e.Scenario, e.Shortname, e.Auth, e.Flow, platform, exclude)
231230
}
232231

233232
fmt.Fprintf(&b, "\nTotal: %d entries\n", len(entries))

0 commit comments

Comments
 (0)