argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.05k stars 5.51k forks source link

Allow git client to discover non-semver tags #18899

Open klagroix opened 5 months ago

klagroix commented 5 months ago

Summary

https://github.com/argoproj/argo-cd/pull/17566 updated Argo CD to be able to compare semver tags. This allows us to use a constraint like >=1.2.0 to select the latest git tag that meets the constraint.

While this works well for git repositories that are tagged following semver, this does not work for repositories using a different versioning scheme (example: calver)

Motivation

Auto-discovery of git tags allows for nicer tracking and deployment vs retagging a git tag (like `production) or overwriting the target revision per-application when a new tag is released. While semver is the most widely used versioning scheme, it's not the only one in use. It would be nice if ArgoCD supported different versioning schemes in additon to semver.

(i.e. the same motivation as https://github.com/argoproj/argo-cd/issues/5609 and https://github.com/argoproj/argo-cd/pull/17566)

Proposal

Allow for lexical sort like is supported in ArgoCD Image Updater. Assuming a regex pattern could be provided like ArgoCD Image Updater, this method could be used for non-semver versioning schemes (including calver)

pnowy commented 1 month ago

I could imagine other use-case for this feature. So let's assume that you have a single repository with multiple manifests (applications) (e.g. microservices apps) and would like to track each app separately based on the specific tag group. Then with this feature you could define the tracking rule with some prefix, e.g. targetRevision: app1-*. Then we could have multiple tags like: app1-1.0.0, app1-1.0.1 for app1 and app2-1.0.1, app2-1.0.2 for app 2 - each pushed separately by CI/CD pipeline when specific app is released.

I think above use-case is not possible to handle with current tracking.

jose-arcatar commented 1 month ago

We currently tag our repositories with both version numbers and environment identifiers, like 0.1.1-dev or 0.1.1-stg. This approach was useful before we started using ArgoCD, as it helped us identify the environment for each deployment. However, now that we’ve transitioned to ArgoCD, we can no longer use this tagging strategy because ArgoCD doesn’t recognize the environment suffix (-env) at the end of the tag.

It would be ideal if ArgoCD supported patterns like *-dev for development environments, allowing us to maintain this tagging convention across environments.

Spazzy757 commented 2 weeks ago

We just ran into this issue as well :smile:

I started a discussion here as I honestly thought I was doing something wrong, as suffixs are part of the SemVar convetion, though it seems this falls outside of the ArgoCD implementation

Spazzy757 commented 1 week ago

I created a PR that should help with SemVar Pre-release bug: https://github.com/argoproj/argo-cd/pull/20862