Skip to content

Commit

Permalink
feat(publish): create vars
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtkeller committed Feb 14, 2025
1 parent faf7b26 commit 396b2cb
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/internal/packager2/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"fmt"

"github.com/defenseunicorns/pkg/oci"
"github.com/zarf-dev/zarf/src/internal/packager2/layout"
"github.com/zarf-dev/zarf/src/pkg/zoci"
"oras.land/oras-go/v2/registry"
Expand All @@ -19,6 +20,7 @@ type PublishOpts struct {
SigningKeyPath string
SigningKeyPassword string
SkipSignatureValidation bool
WithPlainHTTP bool
}

// Takes directory/tar file & OCI Registry
Expand All @@ -35,27 +37,38 @@ func Publish(ctx context.Context, opts PublishOpts) error {
return fmt.Errorf("path must be specified")
}

// TODO skeleton and flavors during publish
// TODO Create skeleton locally
cOpts := layout.CreateOptions{
Flavor: "",
RegistryOverrides: nil,
SigningKeyPath: "",
SigningKeyPassword: "",
SetVariables: nil,
SkipSBOM: false,
DifferentialPackagePath: "",
SigningKeyPath: opts.SigningKeyPath,
SigningKeyPassword: opts.SigningKeyPassword,
}
// TODO Resolve compiler errors
layout.CreateSkeleton(ctx, packagePath, cOpts)
buildPath, err := layout.CreateSkeleton(ctx, opts.Path, cOpts)
if err != nil {
return err
}

layoutOpt := layout.PackageLayoutOptions{
SkipSignatureValidation: opts.SkipSignatureValidation,
IsPartial: true,
}
pkgLayout, err := layout.LoadFromTar(ctx, buildPath, layoutOpt)
if err != nil {
return err
}

// TODO can we convert from packager types to packager2 types

// TODO Do publish to remote

// TODO Resolve compiler errors
rem, err := zoci.NewRemote(ctx, url, platform, mods)
rem, err := zoci.NewRemote(ctx, opts.Registry.String(), zoci.PlatformForSkeleton(), oci.WithPlainHTTP(opts.WithPlainHTTP))
if err != nil {
return err
}
// TODO(mkcp): Resolve compiler errors
err = rem.PublishPackage(ctx, pkg, paths, concurrency)
err = rem.PublishPackage(ctx, &pkgLayout.Pkg, paths, concurrency)

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / validate-docs-and-schema

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / validate-docs-and-schema

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / validate-external

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / validate-external

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / test-checksums

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / test-checksums

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / build-upgrade

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / build-upgrade

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / test-e2e-without-cluster

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / test-e2e-without-cluster

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / validate-unit

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / validate-unit

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / codeql-scan (go)

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / codeql-scan (go)

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / build-e2e

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / build-e2e

undefined: concurrency

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: paths

Check failure on line 71 in src/internal/packager2/publish.go

View workflow job for this annotation

GitHub Actions / test-unit

undefined: concurrency
if err != nil {
return err
}
Expand Down

0 comments on commit 396b2cb

Please sign in to comment.