-
Notifications
You must be signed in to change notification settings - Fork 187
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
Update artifact tarball when spec.ignore
changes
#712
Conversation
Hi, thanks for proposing this solution. Sharing a few thoughts about it:
|
@darkowlzz you are pretty much reflecting my thoughts in #710 :-) |
d3d1482
to
b30bc0c
Compare
Hey everyone! Thanks for the feedback! |
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.
Thanks for updating the implementation.
Left some inline comments.
The test failure seems to be unrelated.
Please rebase with upstream main, we've fixed the e2e tests. |
03b53dd
to
8f4462f
Compare
assertConditions: []metav1.Condition{ | ||
*conditions.TrueCondition(sourcev1.ArtifactInStorageCondition, meta.SucceededReason, "stored artifact for revision 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'"), | ||
}, | ||
}, |
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.
Nice tests.
In the above, we test for cases where ignore is added and removed. Let's also test for the case where the existing value of ignore is updated, would result in a different checksum, not empty.
Same for the GitRepo tests.
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.
Done!
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.ArtifactUpToDateReason, "artifact up-to-date with remote revision: '%s'", artifact.Revision) | ||
return sreconcile.ResultSuccess, nil | ||
} | ||
|
||
// Ensure .spec.ignore checksum is up-to-date |
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.
Maybe
// Ensure .spec.ignore checksum is up-to-date | |
// Ensure .status.ignoreChecksum is up-to-date with .spec.ignore. |
Same for the Bucket code.
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.
Done!
Could you also update the spec docs in https://github.com/fluxcd/source-controller/tree/main/docs/spec/v1beta2 for both GitRepo and Bucket in the Status section towards the bottom of the docs with some documentation for the checksum field? |
api/v1beta2/gitrepository_types.go
Outdated
@@ -211,6 +211,12 @@ type GitRepositoryStatus struct { | |||
// +optional | |||
IncludedArtifacts []*Artifact `json:"includedArtifacts,omitempty"` | |||
|
|||
// IgnoreChecksum is a checksum of .spec.ignore in .status.observedGeneration | |||
// version of the object. | |||
// It is formatted as `<algo>:<checksum>`. For example: `sha256:<checksum>`. |
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.
Same comment.
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.
Done!
api/v1beta2/bucket_types.go
Outdated
@@ -124,6 +124,12 @@ type BucketStatus struct { | |||
// +optional | |||
Artifact *Artifact `json:"artifact,omitempty"` | |||
|
|||
// IgnoreChecksum is a checksum of .spec.ignore in .status.observedGeneration | |||
// version of the object. | |||
// It is formatted as `<algo>:<checksum>`. For example: `sha256:<checksum>`. |
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.
// It is formatted as `<algo>:<checksum>`. For example: `sha256:<checksum>`. | |
// It has the format of `<algo>:<checksum>`, for example: `sha256:<checksum>`. |
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.
Done!
controllers/bucket_controller.go
Outdated
@@ -42,6 +41,8 @@ import ( | |||
"sigs.k8s.io/controller-runtime/pkg/predicate" | |||
"sigs.k8s.io/controller-runtime/pkg/ratelimiter" | |||
|
|||
"github.com/fluxcd/source-controller/pkg/azure" |
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.
This should be moved to block on L53.
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.
Done!
This commit adds a new field `status.ignoreChecksum` which is used to detect changes on `spec.ignore`, that controls the exclusions for the object's `status.artifact` Signed-off-by: Tiago Angelo <kurtis.angelo@gmail.com>
Signed-off-by: Tiago Angelo <kurtis.angelo@gmail.com>
8f4462f
to
6208eff
Compare
Signed-off-by: Tiago Angelo <kurtis.angelo@gmail.com>
Signed-off-by: Tiago Angelo <kurtis.angelo@gmail.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.
This is code-wise looking picture perfect to me, thank you very much for being patient with our feedback 💯
One last request: could you add the fields to the spec documentation for both object kinds? A tiny description in the Status section about what it is, and what it triggers is sufficient. 🙇
Signed-off-by: Tiago Angelo <kurtis.angelo@gmail.com>
Hi guys, thanks for the support! |
The source-controller calculates the SHA256 checksum of the last Bucket's | ||
[`.spec.ignore` field](#ignore) and record it in the `.status.ignoreChecksum` field. This field | ||
is used to detect `.spec.ignore` updates to allow artifact changes. |
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.
The source-controller calculates the SHA256 checksum of the last Bucket's | |
[`.spec.ignore` field](#ignore) and record it in the `.status.ignoreChecksum` field. This field | |
is used to detect `.spec.ignore` updates to allow artifact changes. | |
The source-controller calculates the SHA256 checksum Bucket's [`.spec.ignore` field](#ignore), | |
and records it in `.status.ignoreChecksum`. This field is used to detect `.spec.ignore` changes to | |
trigger an Artifact update. |
@@ -838,6 +838,12 @@ Note that a GitRepository can be [reconciling](#reconciling-gitrepository) | |||
while failing at the same time, for example due to a newly introduced | |||
configuration issue in the GitRepository spec. | |||
|
|||
### Ignore Checksum | |||
|
|||
The source-controller calculates the SHA256 checksum of the last GitRepository's |
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.
Same suggestion applies here.
Hi, due to some recent changes in the main branch, we had to restructure a lot of the code in GitRepo reconciler. A rough work on fixing that is in https://github.com/fluxcd/source-controller/compare/gitrepo-rec-fixes . It changes how we figure out if the source needs to be reconciled completely or not, similar to detecting changes to |
@angelokurtis flux v0.31.0 was just released with the aforementioned improvements in the GitRepo reconciler. Your initial issue #704 is closed. But you can still add a similar change in the Bucket reconciler based on the GitRepo reconcile change in 581695b. We can introduce the same field |
Superseded by #926 |
This commit adds a new field
status.artifact.excludedPatternsChecksum
which is used to detect changes onspec.ignore
, that controls the exclusions for the object'sstatus.artifact
.Fix: #704