-
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
Add include property to GitRepositories #348
Conversation
|
||
// hasArtifactUpdated returns true if any of the revisions in the current artifacts | ||
// does not match any of the artifacts in the updated artifacts | ||
func hasArtifactUpdated(current []*sourcev1.Artifact, updated []*sourcev1.Artifact) bool { |
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.
There is probably a more efficient method of implementing this.
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.
Also wondering if this has a zero chance of giving false negatives, as on a quick glance it looks like that would be possible if updated
contains two versions that exist in current
but for artifacts from different sources.
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.
Would that not require two sources to have colliding hashes? I will add a url check to reduce the risk if this ever happens.
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.
Ok so I actually missed a small thing which could have messed things up. I added tests which verify the logic, hopefully this lays any worries to rest @hiddeco.
https://github.com/fluxcd/source-controller/blob/c418c1c0eca890c0030d99cd6eff99c9658a0823/controllers/artifact_test.go
2eb3d67
to
50d7109
Compare
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.
Can you please fix this typo Artifcats
to Artifacts
, it's in the API spec and also in func names.
I realize now that technically any of the source controller resources could be composed like this. Is there any particular reason why this would only be available for GitRepository? |
@relu yes you are right that this could in theory work for any resource type inside another. The reason I started with GitRepositories is because it would be the easiest one. Other resource types like buckets do not have the concept of a revision so determining change may be a bit more difficult. To future proof this solution including a |
50d7109
to
9458014
Compare
9458014
to
fb1084b
Compare
4832b2b
to
0c13ff8
Compare
I think I have addressed the majority of comments now. I just cant figure out why the docs gen is creating a different output compared to me running locally. Would appreciate it if anyone sees the obvious solution. |
suggestions:
|
@phillebaba can you please bump the docs gen to |
8575c45
to
82e5a9a
Compare
@stefanprodan so the issue seemed to have something to do with running the docs gen inside of |
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.
Looks good, nice work @phillebaba! 💯
@phillebaba please don't merge with upstream but instead rebase. |
Signed-off-by: Philip Laine <philip.laine@gmail.com> Signed-off-by: Philip Laine <philip.laine@xenit.se>
7144106
to
fcf7048
Compare
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
Thanks @phillebaba 🥇
@phillebaba this is non-blocking for merge, but can we please document the "this feature is not supposed to grow" which was discussed during the community meeting awhile back? |
@hiddeco I will merge and create a new PR that expands on this topic in the docs. |
This change will introduce a new field called
include
which will allow users to map a GitRepository into another GitRepository. The feature has been discussed in fluxcd/flux2#326 (comment) and is based on Stefans suggestion. The idea is that one GitRepository should be able to include the contents of another GitRepository, similar to how git submodules works.This is meant to be an alternative to git submodules, here are some of the differences between the solutions:
Example
I have setup an example repository which uses this new feature, please refer to it for an example if you want to try it out. It shows a simple example by creating a GitRepository source that also uses the fleet-infra repository but includes the content of the podinfo repository in it, so that it can use its manifest without using kustomize remote refs.
https://github.com/phillebaba/fleet-infra
The apps GitRepository in the source which includes the podinfo GitRepository. I you look at
spec.include
you can see that it references another GitRepository. This GitRepository now contains the contents of the podinfo repository in it under the pathapps/podinfo/sub
.Open Questions