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

chore: update 'dev extract' command to work with bundles built from a uds-bundle.tf source #1061

Open
wants to merge 2 commits into
base: build-from-tf
Choose a base branch
from

Conversation

YrrepNoj
Copy link
Member

Description

Bundles created from a uds-bundle.tf source file store the SHA256 checksum of the Zarf Package manifest in different place than bundles created from a uds-bundle.yaml

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Other (security config, docs update, etc)

Checklist before merging

😰😬🙈

@YrrepNoj YrrepNoj requested a review from catsby January 23, 2025 23:42
@YrrepNoj YrrepNoj requested a review from a team as a code owner January 23, 2025 23:42
@@ -233,6 +234,69 @@ func handleZarfInitOpts(pkgVars zarfVarData, zarfPkgKind v1alpha1.ZarfPackageKin
return zarfInitOpts
}

// PreDeployValidationTF validates a bundle that has been built from a .tf file before deployment
// TODO: This function shares (copied) a lot of code from PreDeployValidation(). Work towards consolidating what makes sense.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for my sins; I will look at this a bit tomorrow morning.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, I'm sure the compiler reduces it to shared code anyway :P

Copy link
Collaborator

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +166 to 176
if bundleCfg.IsTofu {
_, _, _, err = bndlClient.PreDeployValidationTF()
if err != nil {
return err
}
} else {
_, _, _, err = bndlClient.PreDeployValidation()
if err != nil {
return err
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same style nit from other pr; this just reduces nested if err{} blocks

Suggested change
if bundleCfg.IsTofu {
_, _, _, err = bndlClient.PreDeployValidationTF()
if err != nil {
return err
}
} else {
_, _, _, err = bndlClient.PreDeployValidation()
if err != nil {
return err
}
}
if bundleCfg.IsTofu {
_, _, _, err = bndlClient.PreDeployValidationTF()
} else {
_, _, _, err = bndlClient.PreDeployValidation()
}
if err != nil {
return err
}

@@ -233,6 +234,69 @@ func handleZarfInitOpts(pkgVars zarfVarData, zarfPkgKind v1alpha1.ZarfPackageKin
return zarfInitOpts
}

// PreDeployValidationTF validates a bundle that has been built from a .tf file before deployment
// TODO: This function shares (copied) a lot of code from PreDeployValidation(). Work towards consolidating what makes sense.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, I'm sure the compiler reduces it to shared code anyway :P

config.BundleAlwaysPull = []string{config.BundleTF, config.BundleTFConfig}
filepaths, err := provider.LoadBundleMetadata()
if err != nil {
message.Warnf("@JPERRY error when loading the metadtaa of the .tf bundle: %s\n", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message.Warnf("@JPERRY error when loading the metadtaa of the .tf bundle: %s\n", err.Error())
message.Warnf("error when loading the metadata of the .tf bundle: %s\n", err.Error())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants