Skip to content

feat(package): redeploy when resolved source digest changes - #341

Open
ncwade wants to merge 4 commits into
mainfrom
nwade/add-mutable-tag-support
Open

feat(package): redeploy when resolved source digest changes#341
ncwade wants to merge 4 commits into
mainfrom
nwade/add-mutable-tag-support

Conversation

@ncwade

@ncwade ncwade commented Sep 4, 2026

Copy link
Copy Markdown

Description

Add digest-aware lifecycle handling to uds_package so mutable source references, such as OCI :dev tags, redeploy when their resolved content changes.

The provider now exposes a computed source_digest, resolves it during planning with Zarf's package digest API, pins OCI sources to the planned digest during apply, verifies loaded package content before deployment, and refreshes the digest from deployed cluster state. The configured source remains unchanged.

Related issue

N/A

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactoring or maintenance

Validation

  • uds run build --no-progress
  • uds run generate --no-progress
  • uds run test-unit --no-progress
  • uds run lint:check --no-progress
  • uds run test:acc --no-progress
  • git diff --check

Checklist

  • Tests, documentation, and ADRs were added or updated as needed
  • Generated provider documentation is up to date
  • I followed the contributor guide

@ncwade
ncwade marked this pull request as ready for review September 8, 2026 12:17
@ncwade
ncwade requested a review from a team as a code owner September 8, 2026 12:17
Comment thread docs/index.md Outdated
- `insecure_force_http` (Boolean) Allow plain HTTP for OCI package sources and force plain HTTP for external Zarf registry pushes. Package sources continue to use HTTPS when available, while Zarf-managed registries use the transport recorded in cluster state. Defaults to `false`. Can also be configured with the `UDS_INSECURE_FORCE_HTTP` environment variable.
- `insecure_skip_tls_verification` (Boolean) Skip TLS certificate verification for HTTPS package sources and external Zarf registry pushes. Zarf-managed mTLS registries continue to use their managed trust configuration. Defaults to `false`. Can also be configured with the `UDS_INSECURE_SKIP_TLS_VERIFICATION` environment variable.
- `validate_packages_on_plan` (Boolean) Whether to validate UDS packages during planning. When enabled, the provider may load packages during plan to catch package-dependent configuration errors early, such as invalid optional component names or signature verification failures. Disable this to avoid plan-time package downloads or expensive validation. These checks are still enforced during apply. Defaults to `true`. Can also be configured with the `UDS_VALIDATE_PACKAGES_ON_PLAN` environment variable.
- `validate_packages_on_plan` (Boolean) Whether to validate UDS packages during planning. When enabled, the provider may load packages during plan to catch package-dependent configuration errors early, such as invalid optional component names or signature verification failures. Disabling this avoids plan-time package downloads for validation, but does not disable source digest resolution used for lifecycle change detection. These checks are still enforced during apply. Defaults to `true`. Can also be configured with the `UDS_VALIDATE_PACKAGES_ON_PLAN` environment variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should stick to the intended behavior of validate_packages_on_plan here. Since this new check would also require the provider to download and inspect the source package, it should be skipped/deferred to apply like the other checks when the user is explicitly opt'ing to disable package validation on plan.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Should be addressed - thanks Jason!

@ncwade
ncwade requested a review from jasonwashburn September 8, 2026 16:06
@jasonwashburn

Copy link
Copy Markdown
Contributor

@greptileai review

@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

The PR should not merge until digest-triggered updates safely reject or replace package content whose metadata name differs from the currently managed package.

Findings

  1. P1 Mutable rename orphans package

Summary

  • Adds the computed source_digest attribute and resolves it during planning.
  • Pins OCI package loading and component removal to the planned digest.
  • Verifies loaded content before deployment and refreshes the digest from cluster state.
  • Adds unit and acceptance coverage plus generated documentation and an example.
  • The update path does not safely handle mutable content changing the package name, which can orphan the old deployment.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Terraform plan] --> B[Resolve configured source digest]
  B --> C{Digest differs from state?}
  C -- No --> D[No package redeployment]
  C -- Yes --> E[Mark deployment outputs unknown]
  E --> F[Apply update]
  F --> G[Load source pinned to planned digest]
  G --> H[Read metadata.name from new content]
  H --> I[Remove missing components only]
  I --> J[Deploy newly named package]
  J --> K[Refresh state using new name]
  K --> L[Old differently named package remains untracked]
Loading

Comment on lines +1056 to +1057
if !plan.SourceDigest.IsUnknown() && !plan.SourceDigest.Equal(state.SourceDigest) {
markDeploymentComputedAttributesUnknown(&plan)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Mutable rename orphans package

When a mutable tag resolves to package content with a different metadata.name, the digest change schedules an update without checking package identity. The update deploys the newly named package and points Terraform state at it, but removal only handles missing components and never removes the old package. This leaves the previous Zarf package and its resources deployed but permanently untracked. Reject the name change or replace the old package before updating state.

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