Rya*_*yan 8 git jenkins gitops argocd
我们正在尝试在我的公司使用 ArgoCD 使用 GitOps,我们有一个主要问题:
Jenkins, our CI tool, currently pushed to our docker repo on merge of any PR with a tag relating to the git commit hash currently in use.
Edit: We would like, upon choosing a targetRevision, to get its git hash as a string to use in value overwriting the imageTag in our helm charts.
Now Option 1 is we just have it also change the imageTag in any relevant kubernetes files.
However I wonder if there is a way using PreSync hooks for ArgoCD to do this automatically. It knows the git hash already as it has pulled git. And having Jenkins make a git commit is never ideal.
Thanks for the help!
您可以使用targetRevision: HEAD
https://github.com/argoproj/argocd-example-apps/blob/master/apps/values.yaml
所以 ArgoCD 中的应用程序配置如下
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: message-app-staging
namespace: argocd
environment: staging
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
# Source of the application manifests
source:
repoURL: https://github.com/akash-gautam/message-app-manifests.git
targetRevision: HEAD
path: manifests/staging
# Destination cluster and namespace to deploy the application
destination:
server: https://kubernetes.default.svc
namespace: staging
syncPolicy:
automated:
prune: false
selfHeal: false
Run Code Online (Sandbox Code Playgroud)
如果指定了分支名称或符号引用(如 HEAD),Argo CD 将不断将实时状态与指定分支顶端定义的资源清单或符号引用的解析提交进行比较。
上述情况最好与 helm 一起使用。
如果您在 YAML 中有静态清单,我建议您也检查一下:https: //github.com/Alwinius/bow或https://github.com/keel-hq/keel
Bow 从包含 Kubernetes 部署/StatefulSet 或 Helm 模板的 GitOps 部署存储库中定义的 Docker 镜像注册表中检测更新的镜像标签。
额外: https: //www.padok.fr/en/blog/argocd-image-updater
| 归档时间: |
|
| 查看次数: |
4808 次 |
| 最近记录: |