Open jlewi opened 7 months ago
One might expect the following to work.
Specify a RepoConfig
pointing at a branch; e.g.
apiVersion: hydros.sailplane.ai/v1alpha1
kind: RepoConfig
metadata:
name: repo
namespace: sailplaneai
spec:
repo: https://github.com/sailplaneai/code.git?ref=jlewi/cicd
..
globs:
- "**/*.yaml"
selectors:
- matchLabels: env: dev
Apply it
hydros apply -f repoconfig
This doesn't work though because RepoConfig won't override the repositories referenced in ManifestSync. So they could end up pointing at Main which means the images that do get built will have the commit of the branch but the ManifestSync will look for the commit corresponding to main so it won't find the images and hydration won't succeed.
This is a perfect use case for a kustomize function. RepoConfig uses findresources https://github.com/jlewi/hydros/blob/071b01b535b3f6c2ca718fb0f9edf2721b5211bb/pkg/gitops/repocontroller.go#L157
So we could apply any transformations in memory.
The current pain point would be that with #75 you have to rebuild all images on every commit which would be very expensive. I think a better approach would be
A related problem is the developer flow when defining a new manifestsync.yaml
for a new service.
How can you use hydros to test that everything is working and deploy it through gitops?
This is effectively a dev-takeover but
We can't use a "takeover" because that will try to push any commits on your local branch to the sourceRepo listed in the manifestsync.yaml
. However, the sourceRepo will be pointing at the main
branch not the dev takeover branch.
With the addition of the Repo resource #59 we now support building a whole bunch of resources (Images, Manifests) that comprise an application.
One of the friction points right now is doing a takeover. Right now to do a dev takeover the usual pattern is to create a second manifestsync.yaml. That's kind of annoying.
An alternative would be to use kustomize functions to replace all the git references in a bunch of resources to point to a branch or even a local path.
One thing this doesn't solve is how do we selectively enable rebuilding certain images but not others?