-
Notifications
You must be signed in to change notification settings - Fork 198
feat(ci): support for nightly builds #4035
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
Conversation
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
✅ Deploy Preview for zarf-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make a common workflow that accepts the goreleaser file and tag as variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that is what we'll want to trend towards as we understand the process and implications.
What I didn't want to do is bury the implementation and core decisions (tags, versions, etc) in too much abstraction.
Need to look at variables and workflow-dispatch further as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I definitely don't want to have to make changes in two spots long term, but I think it would make sense to get this working then abstract afterwards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to look at this overlay this morning.
Also considering immutable releases and if they are compatible with goreleaser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Also to be clear, I'm good with merging before we abstract then doing that work in a future PR. May even be the optimal path given that these things are hard to test
This may be a gap to be honest. The tag is re-used - so it indeed can be used. But this would not be the advisable method as opposed to using commit sha's directly.
The nightly should be marked as a pre-release and thus the latest will still be the primary release when opening the repository on the web. I added a |
I would prefer nightly tags are not the default option for the agent and init shown by github here https://github.com/zarf-dev/zarf/pkgs/container/packages%2Finit, but I don't think that's possible to configure, and it's necessary to publish them for true nightly builds imo. Most users will not check that repo anyway. The one worry I do have for these cases is how they will affect renovate or dependabot updates? Will those tools skip them because there is a nightly? Looking at repo1/ironbank I think so, given that it looks at the github releases https://repo1.dso.mil/dsop/opensource/zarf-dev/zarf/zarf-agent/-/blob/development/renovate.json?ref_type=heads, so I would assume it doesn't include pre-release. However, if a user was to instead use renovate on the init package or images, they might get a renovate / dependabot PR every night |
This is certainly a tradeoff for the process.
The answer should be no - these updates will not affect renovate/dependabot. Both treat a suffix such as -nightly as a Semantic-Versioning pre-release label. Their default behaviour is to ignore pre-release versions unless the project is already pinned to a pre-release of the same series or you explicitly opt-in to them. This does raise a question for whether we want to be able to debug potentially older nightly releases - IE to identify when some regression might have occurred (current implementation). Or whether we focus on a static nightly tag which can reduce how many items we see in the packages pages. I'll take a look at that strategy. |
Gotcha, and from what I can gather currently the agent would have a nightly tag and be replaced each night while the init package would have a unique tag since the init package version and zarf version and tightly coupled. Zarf itself is coupled to the init package given that the init process references component names, so I don't think we're yet in a position to break that coupling. We could make the CLI version nightly, though then knowing which nightly you have is more difficult to determine. So tradeoffs here on both sides, and I can see an argument for either decision. |
Mapping this out: flowchart TD
%% -------- Repo gating (fork safety) --------
subgraph RepoGuard
RG0["env.UPSTREAM_REPO = <code>zarf-dev/zarf</code>"] --> RG1{"github.repository == env.UPSTREAM_REPO?"}
RG1 -- No --> RGX["Skip all jobs"]
RG1 -- Yes --> BuildAndPublish
end
%% -------- Build & Publish path --------
subgraph BuildAndPublish
A["Checkout<br/>(fetch-depth: 0, tags available)"] --> B["Compute <b>CLI_VERSION</b><br/>• Find highest semver tag (preserve 'v')<br/>• incpatch + <code>-nightly</code><br/>e.g., <code>v0.60.0</code> → <code>v0.60.1-nightly</code>"]
B --> C["Build CLI with <b>CLI_VERSION</b>"]
C --> D["Build Agent Image"]
D --> E["Push to GHCR<br/><code>ghcr.io/zarf-dev/zarf/agent:<b>CLI_VERSION</b></code>"]
E --> F["Inspect image and capture digest"]
F --> G["Cosign sign by digest<br/>annotation <code>version=<b>CLI_VERSION</b></code>"]
G --> H["Build init packages<br/><code>AGENT_IMAGE_TAG=<b>CLI_VERSION</b></code>"]
H --> I["Publish init packages (OCI + skeleton)<br/>uses <b>CLI_VERSION</b>"]
I --> J["Upload build artifacts"]
I --> R["Native use:<br/>• <code>zarf init</code><br/>• <code>zarf tools download-init</code><br/>(uses <b>CLI_VERSION</b>)"]
end
%% -------- Validate path --------
subgraph Validate
J --> V1["Download artifacts"]
V1 --> V2["Run e2e tests<br/>(<code>CLI_VERSION</code>, appliance mode)"]
V2 --> V3["Save logs (always)"]
end
%% -------- Release with GoReleaser --------
subgraph ReleaseWithGoReleaser
J --> GR1["GoReleaser (Pro) <code>--nightly</code>"]
GR1 --> GR2["Env: <code>GORELEASER_CURRENT_TAG=<b>CLI_VERSION</b></code>"]
GR2 --> GR3["<code>.Version</code>/<code>.Tag</code> resolve to <b>CLI_VERSION</b> in config"]
GR3 --> GR4["Produce nightly release artifacts for <b>CLI_VERSION</b>"]
end
|
That map checks out, and I believe presents a good solution. To make sure I understand this correctly, this will produce a tag in the git repository |
As it stands currently: I am considering removing the commit hash. So that it reduces the sprawl down to: So if current version is Thoughts? |
Ah gotcha, I was missing the differentiation between git tag and release name. Yeah, I think the latter strategy would make sense, I like starting simpler and adding more if we need it. |
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Updated the mermaid diagram and the PR description to reflect the latter strategy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com> Signed-off-by: Cade Thomas <cadethomas23@gmail.com>
Nightly Release
Purpose
A nightly release of Zarf provides daily feedback on the result of release-artifacts ability to be built and distributed. It also includes confidence in the underlying infrastructure and tooling used to produce releases given that they are not all entirely static (IE hosted Github runner images).
Context
Zarf now has a goreleaser pro license and can be used to build nightly releases.
We will not yet be making any changes to the official release process until specific features are identified.
See nightlies documentation for more information on nightly releases.
Acknowledges the cost of our current release infrastructure relying on the larger runners.
Workflow
This nightly attempts to mirror the release workflow as much as possible, with the exception of the following:
-nightly
suffixv0.60.0
-> nightly releasev0.60.1-nightly
nightly
github tag will be created and maintained as the sole tag.goreleaser-pro.yaml
and then importing the.goreleaser.yaml
What does this look like?
CLI_VERSION
tag and pushed to ghcrv0.60.1-nightly
CLI_VERSION
versionv0.60.1-nightly
zarf-init-amd64-v0.60.1-nightly.tar.zst
zarf init
andzarf tools download-init
to natively use the cli versionkeep_single_release: true
tag_name: nightly
nightly
tagversion_template: "{{ .Version }}"
GORELEASER_CURRENT_TAG
in the workflowv0.60.0
- then the nightly will bev0.60.1-nightly
until the latest version is changed.Assumptions
Additional Notes
nightly
ordevel
or similar as the tag?Future Work
Related Issue
Fixes #3928
Checklist before merging