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

fix: refactor create stages into separate lib #2223

Merged
merged 217 commits into from
Mar 13, 2024

Conversation

lucasrod16
Copy link
Contributor

@lucasrod16 lucasrod16 commented Jan 11, 2024

Description

refactor create stages into separate lib

Related Issue

Fixes #2188

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

Lucas Rodriguez added 2 commits January 10, 2024 18:44
This introduces the Creator interface to be used as the source of truth
for package create operations.
Copy link

netlify bot commented Jan 11, 2024

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit a5d3566
🔍 Latest deploy log https://app.netlify.com/sites/zarf-docs/deploys/65f1c765a579880008e2a9d4

Lucas Rodriguez added 27 commits January 10, 2024 19:03
deprecated.MigrateComponent is called in composeComponents
so we should be able to remove this duplicate logic
…om readZarfYAML

The goal here is separation of concerns
Goal here is separation of concerns
Use utils.ReadYaml in place of readZarfYAML
Ensure ReadYaml is passed the correct path
"Normal" packages and skeleton packages require different
loading processes, so using an interface allows us to
have two separate implementations for them.

This makes the load logic easier to reason about and easier to maintain.

Loader is defined in package packager because most of the operations
require direct access to the top-level Packager struct fields.
Create Assembler interface

Creator interface embeds Loader and Assembler interfaces
to allow various create methods to be accessed through a single interface.

Create operations are (and should be) closely coupled to Packager,
so it makes sense to have create functions in the packager package.

Modularity, separation of concerns, library usage, etc can be achieved
through the use of these interfaces while remaining in package packager.
Add CdToBaseDir to Creator interface so that it is grouped
together with other create-specific operations.
Adds a new modifier WithCreator() that is intended to be passed
in as an argument when instantiating a new Packager instance.
@Noxsios Noxsios changed the title chore: refactor create stages into separate lib fix: refactor create stages into separate lib Mar 12, 2024
AustinAbro321
AustinAbro321 previously approved these changes Mar 13, 2024
Copy link
Contributor

@AustinAbro321 AustinAbro321 left a comment

Choose a reason for hiding this comment

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

Approved with tiny thing

src/pkg/packager/deploy.go Outdated Show resolved Hide resolved
@Noxsios Noxsios merged commit 1ec8849 into main Mar 13, 2024
29 checks passed
@Noxsios Noxsios deleted the 2188-refactor-create-stages-into-separate-lib branch March 13, 2024 16:02
Noxsios pushed a commit that referenced this pull request Mar 19, 2024
…2386)

## Description
Refactoring that took place in
#2223 introduced a bug on
`deploy` where the user is not prompted to view SBOMs. This occurs
because `p.sbomViewFiles` is not being populated correctly. This PR
fixes this issue by populating `p.sbomViewFiles`.

## Related Issue
N/A

## Type of change

- [x] 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

- [ ] Test, docs, adr added or updated as needed
- [ ] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
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.

Breakout create stages into separate lib
3 participants