Skip to content

Commit

Permalink
remove writeHaulerManifest, its template, and its tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed Apr 15, 2024
1 parent 06ac5e2 commit 874407d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 58 deletions.
22 changes: 0 additions & 22 deletions pkg/combustion/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ const (
)

var (
//go:embed templates/hauler-manifest.yaml.tpl
haulerManifest string

//go:embed templates/26-embedded-registry.sh.tpl
registryScript string

Expand Down Expand Up @@ -74,25 +71,6 @@ func configureRegistry(ctx *image.Context) ([]string, error) {
return []string{script}, nil
}

func writeHaulerManifest(ctx *image.Context, images []string) error {
haulerManifestYamlFile := filepath.Join(ctx.BuildDir, haulerManifestYamlName)
haulerDef := struct {
ContainerImages []string
}{
ContainerImages: images,
}
data, err := template.Parse(haulerManifestYamlName, haulerManifest, haulerDef)
if err != nil {
return fmt.Errorf("applying template to %s: %w", haulerManifestYamlName, err)
}

if err = os.WriteFile(haulerManifestYamlFile, []byte(data), fileio.NonExecutablePerms); err != nil {
return fmt.Errorf("writing file %s: %w", haulerManifestYamlName, err)
}

return nil
}

func addImageToHauler(ctx *image.Context, containerImage string) error {
args := []string{"store", "add", "image", containerImage, "-p", fmt.Sprintf("linux/%s", ctx.ImageDefinition.Image.Arch.Short())}

Expand Down
27 changes: 0 additions & 27 deletions pkg/combustion/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,6 @@ import (
"github.com/suse-edge/edge-image-builder/pkg/registry"
)

func TestWriteHaulerManifestValidManifest(t *testing.T) {
// Setup
ctx, teardown := setupContext(t)
defer teardown()

images := []string{
"hello-world:latest",
"ghcr.io/fluxcd/flux-cli@sha256:02aa820c3a9c57d67208afcfc4bce9661658c17d15940aea369da259d2b976dd",
}

// Test
err := writeHaulerManifest(ctx, images)

// Verify
require.NoError(t, err)

manifestFileName := filepath.Join(ctx.BuildDir, haulerManifestYamlName)
_, err = os.Stat(manifestFileName)
require.NoError(t, err)

foundBytes, err := os.ReadFile(manifestFileName)
require.NoError(t, err)
found := string(foundBytes)
assert.Contains(t, found, "- name: hello-world:latest")
assert.Contains(t, found, "- name: ghcr.io/fluxcd/flux-cli@sha256:02aa820c3a9c57d67208afcfc4bce9661658c17d15940aea369da259d2b976dd")
}

func TestCreateRegistryCommand(t *testing.T) {
// Setup
ctx, teardown := setupContext(t)
Expand Down
9 changes: 0 additions & 9 deletions pkg/combustion/templates/hauler-manifest.yaml.tpl

This file was deleted.

0 comments on commit 874407d

Please sign in to comment.