Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add file type variables to bundles #631

Merged
merged 33 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bf334e6
feat: add file type variables to bundles
TristanHoladay May 22, 2024
fbf8229
add FileVariables to BundleDeployOptions.
TristanHoladay May 22, 2024
3a63013
adding loadFileContents() to loadVariables().
TristanHoladay May 22, 2024
0b6f219
add file handling from loadVariables()
TristanHoladay May 23, 2024
1e271cd
fix deploy_test call of loadVariables()
TristanHoladay May 23, 2024
405327e
test for zarf var setting; adding file handling to processOverrideVar…
TristanHoladay May 24, 2024
d5b375b
small refactor; attempting helm.FileValues (bad format errors)
TristanHoladay May 24, 2024
5c97215
cleanup helm file handling; base64 test pub key.
TristanHoladay May 28, 2024
9a835a3
lint fixes
TristanHoladay May 28, 2024
7dd839b
merge main and resolve; refactor file var handling
TristanHoladay May 29, 2024
39d2187
fix loadViperConfig duplicate; fix file handling in override add
TristanHoladay May 29, 2024
cd23c1a
refactor ChartVariableType; refactor tests.
TristanHoladay May 29, 2024
bec07c9
lint fix
TristanHoladay May 29, 2024
a2fe420
file path handling made more reusable; fixed tests.
TristanHoladay May 29, 2024
dc8613c
Merge branch 'main' into add-file-type-var
TristanHoladay May 29, 2024
3a407ec
fix typo in test
TristanHoladay May 29, 2024
a5afc3e
Merge branch 'main' into add-file-type-var
TristanHoladay May 29, 2024
513ed8e
lint fix'
TristanHoladay May 29, 2024
daf9076
add docs; make test less brittle.
TristanHoladay May 29, 2024
05080fa
add to docs; rename test
TristanHoladay May 29, 2024
a2b4276
move formAndCheckFilePath and annotate
TristanHoladay May 30, 2024
2d11b46
file handling and docs refactors
TristanHoladay May 31, 2024
bc7d4d0
handle different value source paths.
TristanHoladay Jun 3, 2024
18b13ec
refactor tests.
TristanHoladay Jun 3, 2024
ee2e768
update schema and fix test conflicts
TristanHoladay Jun 3, 2024
3c420ce
change ValueSource to Source to remove confusion with type.
TristanHoladay Jun 3, 2024
6d2914a
fix wrong property name in unit test
TristanHoladay Jun 3, 2024
d72cde9
revert e2e secret test removals
TristanHoladay Jun 3, 2024
33daef1
clean up tests from previous iterations
TristanHoladay Jun 4, 2024
861f15f
lifted unit tests up to processOverrideVariables
TristanHoladay Jun 4, 2024
85a5ad3
check override map in unit test for correct FileValues
TristanHoladay Jun 4, 2024
e995e65
Update src/pkg/bundle/deploy_test.go
TristanHoladay Jun 5, 2024
9b457c9
switch Equals to Equal
TristanHoladay Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add file type variables to bundles
  • Loading branch information
TristanHoladay committed May 22, 2024
commit bf334e6b69622f053171fc8e06a924d3d45dad37
38 changes: 38 additions & 0 deletions src/test/bundles/07-helm-overrides/variable-files/fake_key
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEArtDAntBK1ij7YfCqmgcmmXuVupMzyBw6D6Mt9GualhC9uJREifaf
IsW2pvauetxiy5i8qjowhugjVbuyS7PeVRKYxFgeD2PzaSHl+RmBtfLurwGsf7BQYF1j5j
FtmIk4QUD2ijJn9rrHV2lpDOizvWFTc9L5q4NxQJGTDuQ2ngBNmWWEu1Z1BXUPzqDFj1ly
muSA1HHJw8To9MK7mUQwwwWIBvu9PMm4F5uABDiU+55rIIwdXJxqt4oTttehDmAojj8k3F
Ehrq0uTdpGBenHiNPJFE5+aGuZvD+dT3ek5bVFHOqTeHstCSYzX8G6jEYfS+HUElntNTW3
VGLTtmbPzzL4mpW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kBSrm/HU7E6nnfiunaXxsJ4IT8+i3191XPaYcVyfKy9mXtCj1rvE5we1AEEoO
c3IBTO290iqKL6c7lBi9kUxzTVplLjqm8CzmGysoQbkYXvYOvNPCCQu13EmUso/eQWdf2H
w9GgY8Ge9Hn+7QbIESHlRFFbWBmgOWh2M9jRFbmV4RRxxGDeQMoX8SVgkrnPDRWt2BAAAA
wG3cqK7U7mQvAxrZqo1bNUEbd577B5vgRWitYNg62zRkBQiNM16KFW2m4odxHBRr/znoAC
ox777r0Ut+3iyP+cQRsLUkutd6Sm4sOa1syGHkon9G+R8jDqMJp9uoY6msfUUuSLs3Q5/v
XJYwWJs6TWVZfQMPJ50OwXi6ik0voYbpkAPV63Y3wFHpU9Sb8Qpv782K+f19Fl9YLx0zZ5
hU4RG8LwmygBhZf3ow4COzd5arAi9cXInLO+YZUMBoOVwPbgAAAMEA1dW30EFsJtF4152X
lQNqL18Bq0CwtBtZZA+HQuPE5ntwPxR9vIG1M1MxksisTrdmAxsByy+eHT1zjVGCRVyOa4
djG2dW3T4PIUqpR3DzTC+3G+SJnSwv5T6FiI9QlJjAV1+K58+lyrmQSRWiBgoLLyH/haPw
UdfBNRHNcv1Wg25eXKsHA/P+me1a9AYmv1yq42GIV6h7lXJznjHm+jnH2+tOGComRE+H/r
k4Xz79fnCYGmQMZPtcUWdEO4fHp97hAAAAwQDRSVqFLU1YZmQuQ0SRFkUbPy2UGws/HMD0
sRiQkqJYtIad79Rww7gM+228ePFECCVgOU4EO/H92ShJILVlgsgQp651JmkwkY81FJm/xX
ULgCR2DoUi0IpsGp1bWKoVvJA81bpqfDONF823NwUts30I8e7PwavF7/8z5yWybcCnWUjm
l/cBQiXg9DDW143UV3r7GEm5YqyvKBSAZmCROViFvSJdZvVKHuXwQVngymtrrXVfmuTNK2
KQRCT1v0lgl18AAAAadHJpc3RhbkB0cmlzdGFuLU5VQzEzQU5IaTcB
-----END OPENSSH PRIVATE KEY-----
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
25 changes: 25 additions & 0 deletions src/test/bundles/07-helm-overrides/variable-files/uds-bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
kind: UDSBundle
metadata:
name: helm-variables-file
description: testing a bundle with Helm overrides
version: 0.0.1

packages:
- name: helm-overrides
path: "../../../packages/helm"
ref: 0.0.1

overrides:
podinfo-component:
unicorn-podinfo:
variables:
- name: log_level
path: "podinfo.logLevel"
description: "Set the log level for podinfo"
default: "debug" # not overwritten!
- name: SECURITY_CTX
path: "podinfo.securityContext"
description: "testing a file"
- name: TEST_SECRET
path: "testSecret"
description: "key to place in the test secret resource"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
files:
packages:
helm-overrides:
test_secret: fake_key
SECURITY_CTX: sec_ctx.yaml
28 changes: 28 additions & 0 deletions src/test/e2e/variable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,31 @@

remove(t, bundlePath)
}

func TestVariableFilesForOverrides(t *testing.T) {
// precedence rules: env var > uds-config.variables > uds-config.shared > default
deployZarfInit(t)
e2e.HelmDepUpdate(t, "src/test/packages/helm/unicorn-podinfo")
e2e.CreateZarfPkg(t, "src/test/packages/helm", false)
e2e.CreateZarfPkg(t, "src/test/packages/no-cluster/output-var", false)
bundleDir := "src/test/bundles/07-helm-overrides/variable-files"
bundlePath := filepath.Join(bundleDir, fmt.Sprintf("uds-bundle-var-files-%s-0.0.1.tar.zst", e2e.Arch))
err := os.Setenv("UDS_CONFIG", filepath.Join(bundleDir, "uds-config.yaml"))
require.NoError(t, err)
createLocal(t, bundleDir, e2e.Arch)

// color := "green"
// err = os.Setenv("UDS_UI_COLOR", color)
require.NoError(t, err)
_, stderr := deploy(t, bundlePath)

Check failure on line 392 in src/test/e2e/variable_test.go

View workflow job for this annotation

GitHub Actions / validate

stderr declared and not used (typecheck)

t.Run("test fake_key file contents set as value for testSecret and used in test-secret secret", func(t *testing.T) {

})

t.Run("test sec_ctx file contents set as value for podinfo.securityContext in deployment", func(t *testing.T) {

})

remove(t, bundlePath)
}
Loading