Skip to content

Commit 4c9958c

Browse files
committed
f
1 parent 6a6b6a7 commit 4c9958c

File tree

5 files changed

+50
-30
lines changed

5 files changed

+50
-30
lines changed

.github/workflows/v3-e2e.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ jobs:
184184
185185
- name: Run test
186186
id: test
187+
continue-on-error: true
187188
env:
188189
APP_VERSION: ${{ needs.output-vars.outputs.app_version }}
189190
KUBE_VERSION: "1.${{ needs.output-vars.outputs.k0s_minor_version }}"
@@ -240,6 +241,7 @@ jobs:
240241
241242
- name: Run test
242243
id: test
244+
continue-on-error: true
243245
env:
244246
APP_VERSION: ${{ needs.output-vars.outputs.app_version }}
245247
KUBE_VERSION: "1.${{ needs.output-vars.outputs.k0s_minor_version }}"

dagger/chainguard.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (m *chainguard) melangeBuildGo(
2020
keygen := m.melangeKeygen(imageTag)
2121

2222
// Create cache volumes for improved build performance
23-
goModCache := dag.CacheVolume("ec-melange-gomodcache")
23+
goCache := dag.CacheVolume("ec-melange-gocache")
2424
apkCache := dag.CacheVolume("ec-melange-apkcache")
2525

2626
c := dag.Container().
@@ -30,7 +30,7 @@ func (m *chainguard) melangeBuildGo(
3030
WithFile("/workspace/melange.rsa", keygen.File("/workspace/melange.rsa")).
3131
WithEnvVariable("MELANGE_CACHE_DIR", "/cache/melange").
3232
WithEnvVariable("MELANGE_APK_CACHE_DIR", "/cache/apk").
33-
WithMountedCache("/cache/melange", goModCache, dagger.ContainerWithMountedCacheOpts{
33+
WithMountedCache("/cache/melange", goCache, dagger.ContainerWithMountedCacheOpts{
3434
Sharing: dagger.CacheSharingModeShared,
3535
}).
3636
WithMountedCache("/cache/apk", apkCache, dagger.ContainerWithMountedCacheOpts{

dagger/e2e.go

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (m *EmbeddedCluster) E2eRunHeadless(
5555
// Skip cleanup
5656
// +default=false
5757
skipCleanup bool,
58-
) (*dagger.Directory, error) {
58+
) (resultsDir *dagger.Directory) {
5959
mode := "headless"
6060

6161
// Initialize test result that will be built up throughout the function
@@ -66,15 +66,15 @@ func (m *EmbeddedCluster) E2eRunHeadless(
6666
}
6767

6868
// Initialize results directory
69-
resultsDir := dag.Directory()
69+
resultsDir = dag.Directory()
7070

7171
// Log test start
7272
fmt.Printf("Starting E2E test: scenario=%s mode=%s app-version=%s kube-version=%s\n",
7373
scenario, mode, appVersion, kubeVersion)
7474

7575
// Provision a fresh CMX VM for testing
7676
fmt.Printf("Provisioning CMX VM for %s %s test...\n", scenario, mode)
77-
vm, err := m.ProvisionCmxVm(
77+
vm, provisionErr := m.ProvisionCmxVm(
7878
ctx,
7979
fmt.Sprintf("ec-e2e-%s-%s", scenario, mode),
8080
"ubuntu",
@@ -86,10 +86,11 @@ func (m *EmbeddedCluster) E2eRunHeadless(
8686
cmxToken,
8787
sshKey,
8888
)
89-
if err != nil {
90-
testResult.Error = fmt.Sprintf("failed to provision VM: %v", err)
89+
if provisionErr != nil {
90+
testResult.Error = fmt.Sprintf("failed to provision VM: %v", provisionErr)
9191
resultJSON, _ := json.MarshalIndent(testResult, "", " ")
92-
return resultsDir.WithNewFile("result.json", string(resultJSON)), nil
92+
resultsDir = resultsDir.WithNewFile("result.json", string(resultJSON))
93+
return
9394
}
9495

9596
fmt.Printf("Provisioned VM: %s\n", vm.VmID)
@@ -100,19 +101,19 @@ func (m *EmbeddedCluster) E2eRunHeadless(
100101
// Collect support bundle before cleanup
101102
if vm != nil {
102103
fmt.Printf("Collecting support bundle from VM %s...\n", vm.VmID)
103-
supportBundle, err := vm.CollectClusterSupportBundle(ctx)
104-
if err != nil {
105-
fmt.Printf("Warning: failed to collect support bundle: %v\n", err)
106-
resultsDir = resultsDir.WithNewFile("support-bundle-error.txt", fmt.Sprintf("Failed to collect support bundle: %v", err))
104+
supportBundle, bundleErr := vm.CollectClusterSupportBundle(ctx)
105+
if bundleErr != nil {
106+
fmt.Printf("Warning: failed to collect support bundle: %v\n", bundleErr)
107+
resultsDir = resultsDir.WithNewFile("support-bundle-error.txt", fmt.Sprintf("Failed to collect support bundle: %v", bundleErr))
107108
} else {
108109
resultsDir = resultsDir.WithFile("support-bundle.tar.gz", supportBundle)
109110
}
110111
}
111112

112113
// Marshal final test result to JSON
113-
resultJSON, err := json.MarshalIndent(testResult, "", " ")
114-
if err != nil {
115-
fmt.Printf("Warning: failed to marshal test result: %v\n", err)
114+
resultJSON, marshalErr := json.MarshalIndent(testResult, "", " ")
115+
if marshalErr != nil {
116+
fmt.Printf("Warning: failed to marshal test result: %v\n", marshalErr)
116117
return
117118
}
118119
resultsDir = resultsDir.WithNewFile("result.json", string(resultJSON))
@@ -128,37 +129,37 @@ func (m *EmbeddedCluster) E2eRunHeadless(
128129
}()
129130

130131
// Download and prepare embedded-cluster release
131-
if err := vm.PrepareRelease(ctx, scenario, appVersion, licenseFile); err != nil {
132-
testResult.Error = fmt.Sprintf("failed to prepare release: %v", err)
133-
return resultsDir, nil
132+
if prepareErr := vm.PrepareRelease(ctx, scenario, appVersion, licenseFile); prepareErr != nil {
133+
testResult.Error = fmt.Sprintf("failed to prepare release: %v", prepareErr)
134+
return
134135
}
135136

136137
// For airgap scenarios, apply network policy to block internet access
137138
if scenario == "airgap" {
138139
fmt.Printf("Applying airgap network policy on VM %s...\n", vm.VmID)
139-
if err := vm.ApplyAirgapNetworkPolicy(ctx); err != nil {
140-
testResult.Error = fmt.Sprintf("failed to apply airgap network policy: %v", err)
141-
return resultsDir, nil
140+
if airgapErr := vm.ApplyAirgapNetworkPolicy(ctx); airgapErr != nil {
141+
testResult.Error = fmt.Sprintf("failed to apply airgap network policy: %v", airgapErr)
142+
return
142143
}
143144
}
144145

145146
// Run headless installation
146147
fmt.Printf("Running headless installation on VM %s...\n", vm.VmID)
147-
installResult, err := vm.InstallHeadless(
148+
installResult, installErr := vm.InstallHeadless(
148149
ctx,
149150
scenario,
150151
appVersion,
151152
licenseFile,
152153
dag.File("config-values.yaml", configValuesFileContent),
153154
)
154-
if err != nil {
155-
testResult.Error = fmt.Sprintf("installation failed: %v", err)
156-
return resultsDir, nil
155+
if installErr != nil {
156+
testResult.Error = fmt.Sprintf("installation failed: %v", installErr)
157+
return
157158
}
158159

159160
if !installResult.Success {
160161
testResult.Error = "installation reported failure"
161-
return resultsDir, nil
162+
return
162163
}
163164

164165
// Validate installation
@@ -181,7 +182,7 @@ func (m *EmbeddedCluster) E2eRunHeadless(
181182
fmt.Printf("Test PASSED: %s %s test completed successfully\n", scenario, mode)
182183
}
183184

184-
return resultsDir, nil
185+
return
185186
}
186187

187188
func parseLicense(ctx context.Context, licenseFile *dagger.File) (contents string, licenseID string, channelID string, err error) {

dagger/localartifactmirror.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,19 @@ func (m *EmbeddedCluster) BuildLocalArtifactMirrorPackage(
110110
melangeFile := m.melangeTemplateLocalArtifactMirror(src, ecVersion, kzerosMinorVersion)
111111

112112
dir := dag.Directory().
113-
WithDirectory("local-artifact-mirror", src.Directory("local-artifact-mirror")).
114-
WithDirectory("cmd", src.Directory("cmd"))
113+
WithDirectory("local-artifact-mirror",
114+
src.Directory("local-artifact-mirror").
115+
WithoutDirectory("bin").
116+
WithoutDirectory("build").
117+
WithoutDirectory("cache"),
118+
).
119+
WithDirectory("cmd",
120+
src.Directory("cmd").
121+
WithoutDirectory("installer/goods/bins").
122+
WithNewFile("installer/goods/bins/.placeholder", ".placeholder").
123+
WithoutDirectory("installer/goods/internal/bins").
124+
WithNewFile("installer/goods/internal/bins/.placeholder", ".placeholder"),
125+
)
115126

116127
build := m.chainguard.melangeBuildGo(
117128
directoryWithCommonGoFiles(dir, src),

dagger/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ func directoryWithCommonGoFiles(dir *dagger.Directory, src *dagger.Directory) *d
5050
WithFile("go.sum", src.File("go.sum")).
5151
WithDirectory("pkg", src.Directory("pkg")).
5252
WithDirectory("pkg-new", src.Directory("pkg-new")).
53-
WithDirectory("cmd/installer/goods", src.Directory("cmd/installer/goods")).
53+
WithDirectory("cmd/installer/goods",
54+
src.Directory("cmd/installer/goods").
55+
WithoutDirectory("bins").
56+
WithNewFile("bins/.placeholder", ".placeholder").
57+
WithoutDirectory("internal/bins").
58+
WithNewFile("internal/bins/.placeholder", ".placeholder"),
59+
).
5460
WithDirectory("api", src.Directory("api")).
5561
WithDirectory("kinds", src.Directory("kinds")).
5662
WithDirectory("utils", src.Directory("utils"))

0 commit comments

Comments
 (0)