The part that confuses me about gitops is the recommendation to separate source-code from manifests, e.g. This is what argocd has to say about it:
The use of a different Git repository to hold your kubernetes manifests (separate from your application source code), is highly recommended. See best practices for further rationale.
In a typical project, I would use gitlab to setup a test environment and then on_stop action to delete the environment for each PR. However, if I separate manifests from the source code, it is not clear what argocd is supposed to be watching.
For the sake of example lets assume that we have two repositories:
foohosts the app codebarhosts manifests of different apps
Suppose:
- I've created a new branch
feature-001infoobranch. - Every time we add a commit to
feature-001it creates a new docker image (foo:$COMMIT_SHA).
How would I create a argocd controlled app that watches this branch for changes?
I can of course create the app using CLI:
argocd app create "foo-$COMMIT_SHA" --repo https://github.com/gajus/bar.git --path bar -p image=foo:$COMMIT_SHA
but how would ArgoCD know to track this feature-001 branch for changes?, i.e. How do I tell argocd to deploy a new version of the app when a new Docker image is published from this branch?