Skip to content

Commit

Permalink
package -> bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGedd committed Aug 3, 2023
1 parent 1a1e1a4 commit ad7296f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 63 deletions.
1 change: 0 additions & 1 deletion .github/actions/golang/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ runs:
- uses: actions/setup-go@v4
with:
go-version: 1.19.x
cache: true
53 changes: 2 additions & 51 deletions src/cmd/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,60 +24,11 @@ const (
V_TMP_DIR = "tmp_dir"
V_INSECURE = "insecure"

// Init config keys
V_INIT_COMPONENTS = "init.components"
V_INIT_STORAGE_CLASS = "init.storage_class"

// Init Git config keys
V_INIT_GIT_URL = "init.git.url"
V_INIT_GIT_PUSH_USER = "init.git.push_username"
V_INIT_GIT_PUSH_PASS = "init.git.push_password"
V_INIT_GIT_PULL_USER = "init.git.pull_username"
V_INIT_GIT_PULL_PASS = "init.git.pull_password"

// Init Registry config keys
V_INIT_REGISTRY_URL = "init.registry.url"
V_INIT_REGISTRY_NODEPORT = "init.registry.nodeport"
V_INIT_REGISTRY_SECRET = "init.registry.secret"
V_INIT_REGISTRY_PUSH_USER = "init.registry.push_username"
V_INIT_REGISTRY_PUSH_PASS = "init.registry.push_password"
V_INIT_REGISTRY_PULL_USER = "init.registry.pull_username"
V_INIT_REGISTRY_PULL_PASS = "init.registry.pull_password"

// Init Package config keys
V_INIT_ARTIFACT_URL = "init.artifact.url"
V_INIT_ARTIFACT_PUSH_USER = "init.artifact.push_username"
V_INIT_ARTIFACT_PUSH_TOKEN = "init.artifact.push_token"

// Package config keys
V_PKG_OCI_CONCURRENCY = "package.oci_concurrency"

// Package create config keys
V_PKG_CREATE_SET = "package.create.set"
V_PKG_CREATE_OUTPUT = "package.create.output"
V_PKG_CREATE_SBOM = "package.create.sbom"
V_PKG_CREATE_SBOM_OUTPUT = "package.create.sbom_output"
V_PKG_CREATE_SKIP_SBOM = "package.create.skip_sbom"
V_PKG_CREATE_MAX_PACKAGE_SIZE = "package.create.max_package_size"
V_PKG_CREATE_SIGNING_KEY = "package.create.signing_key"
V_PKG_CREATE_SIGNING_KEY_PASSWORD = "package.create.signing_key_password"
V_PKG_CREATE_DIFFERENTIAL = "package.create.differential"
V_PKG_CREATE_REGISTRY_OVERRIDE = "package.create.registry_override"
V_PKG_CREATE_SET = "package.create.set"

// Package deploy config keys
V_PKG_DEPLOY_SET = "package.deploy.set"
V_PKG_DEPLOY_COMPONENTS = "package.deploy.components"
V_PKG_DEPLOY_SHASUM = "package.deploy.shasum"
V_PKG_DEPLOY_SGET = "package.deploy.sget"
V_PKG_DEPLOY_PUBLIC_KEY = "package.deploy.public_key"

// Package publish config keys
V_PKG_PUBLISH_SIGNING_KEY = "package.publish.signing_key"
V_PKG_PUBLISH_SIGNING_KEY_PASSWORD = "package.publish.signing_key_password"

// Package pull config keys
V_PKG_PULL_OUTPUT_DIR = "package.pull.output_directory"
V_PKG_PULL_PUBLIC_KEY = "package.pull.public_key"
V_PKG_DEPLOY_SET = "package.deploy.set"

// Bundle config keys
V_BNDL_OCI_CONCURRENCY = "bundle.oci_concurrency"
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/bundler/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

// Bundle publishes the given bundle w/ optional signature to the remote repository.
func Bundle(r *oci.OrasRemote, bundle *types.UDSPackage, signature []byte) error {
func Bundle(r *oci.OrasRemote, bundle *types.UDSBundle, signature []byte) error {
if bundle.Metadata.Architecture == "" {
return fmt.Errorf("architecture is required for bundling")
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func Bundle(r *oci.OrasRemote, bundle *types.UDSPackage, signature []byte) error
}

// push the manifest config
// todo: dig into this, is the manifest the UDSPackage manifest or a Zarf pkg manifest?
// todo: dig into this, is the manifest the UDSBundle manifest or a Zarf pkg manifest?
// todo: make joint types? should this actually be explicitly Zarf types? need to distinguish between Zarf pkg and UDS pkg
configDesc, err := r.PushManifestConfigFromMetadata((*zarfTypes.ZarfMetadata)(&bundle.Metadata), (*zarfTypes.ZarfBuildData)(&bundle.Build))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions src/pkg/bundler/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Bundler struct {
// cfg is the Bundler's configuration options
cfg *types.BundlerConfig
// bundle is the bundle's metadata read into memory
bundle types.UDSPackage
bundle types.UDSBundle
// tmp is the temporary directory used by the Bundler cleaned up with ClearPaths()
tmp string
}
Expand Down Expand Up @@ -76,7 +76,7 @@ func (b *Bundler) ClearPaths() {
}

// ValidateBundleResources validates the bundle's metadata and package references
func (b *Bundler) ValidateBundleResources(bundle *types.UDSPackage) error {
func (b *Bundler) ValidateBundleResources(bundle *types.UDSBundle) error {
// TODO: need to validate arch of local OS
if bundle.Metadata.Architecture == "" {
// ValidateBundle was erroneously called before CalculateBuildInfo
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/bundler/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (op *ociProvider) LoadBundle(concurrency int) (PathMap, error) {
return nil, err
}

var bundle types.UDSPackage
var bundle types.UDSBundle

if err := goyaml.Unmarshal(b, &bundle); err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions src/test/packages/01-uds-pkg/uds-pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: UDSPackage
kind: UDSBundle
metadata:
name: example
description: an example UDS pkg
description: an example UDS bundle
version: 0.0.1

zarf-packages:
Expand Down
8 changes: 4 additions & 4 deletions src/types/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
// Package types contains all the types used by UDS.
package types

// UDSPackage is the top-level structure of a UDS package file.
type UDSPackage struct {
Kind string `json:"kind" jsonschema:"description=The kind of UDS package,enum=UDSPackage"`
Metadata UDSMetadata `json:"metadata" jsonschema:"description=UDSPackage metadata"`
// UDSBundle is the top-level structure of a UDS package file.
type UDSBundle struct {
Kind string `json:"kind" jsonschema:"description=The kind of UDS package,enum=UDSBundle"`
Metadata UDSMetadata `json:"metadata" jsonschema:"description=UDSBundle metadata"`
Build UDSBuildData `json:"build,omitempty" jsonschema:"description=Generated bundle build data"`
ZarfPackages []ZarfPackageImport `json:"zarf-packages" jsonschema:"description=List of Zarf packages"`
}
Expand Down

0 comments on commit ad7296f

Please sign in to comment.