argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

Update strategy: newest-build not working

Open congvan1 opened this issue 1 year ago • 2 comments

Describe the bug I using argocd image updater latest (sha256:b3622d981368b5dc31e7d85545c3572e4a1c990cbe2403f8bb8053aa70766672). It was working fine with update-strategy: semver (default) but when i change tag to 8 characters of SHA git commit, it not working it not even show logs (it just empty).

To Reproduce Here is my yaml file:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: image-nexus
  namespace: argocd
  annotations: 
      argocd-image-updater.argoproj.io/image-list: image=****/voc/nodeapp
      argocd-image-updater.argoproj.io/write-back-method: git:secret:argocd/git-creds
      argocd-image-updater.argoproj.io/git-branch: main
      argocd-image-updater.argoproj.io/write-back-target: kustomization
      argocd-image-updater.argoproj.io/image.force-update: "true"

      argocd-image-updater.argoproj.io/image.update-strategy: newest-build 
      argocd-image-updater.argoproj.io/image.ignore-tags: latest, master
      argocd-image-updater.argoproj.io/image.allow-tags: regexp:^[0-9a-f]{8}$
spec:
  project: default
  source:
    repoURL: https://gitlab.com/van1122/project-argocd.git 
    targetRevision: HEAD
    path: image-nexus-service/base
  destination: 
    server: https://kubernetes.default.svc
    namespace: test-image-nexus 
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    automated:
      selfHeal: true
      prune: true

Expected behavior When code change in git, a workflow will run to build and push image with a tag is first 8 characters and i want argocd image updater monitoring image registry and automation update new tag to file kustomization.yaml

Additional context I also give credential of image registry for argocd-image-updater

Version latest (sha256:b3622d981368b5dc31e7d85545c3572e4a1c990cbe2403f8bb8053aa70766672)

Logs I don't know why but when i use update-strategy: newest-build there not print logs, it completely empty. When update-strategy is semver everything working fine (have logs)

congvan1 avatar Mar 28 '24 08:03 congvan1

I did some testing with using the 'newest-build' strategy and noticed in the logs this was not an acceptable strategy. Image updater ended up defaulting to semver. I am using v0.12.2 when I observed the below error.

level=warning msg="Unknown sort option newest-build -- using semver

The documentation is a bit confusing as there are warnings to switch to the new names but they appear to be not ready yet. You might try using latest instead and see if that works for you.

k-weaver avatar Apr 03 '24 22:04 k-weaver

I did some testing with using the 'newest-build' strategy and noticed in the logs this was not an acceptable strategy. Image updater ended up defaulting to semver. I am using v0.12.2 when I observed the below error.

level=warning msg="Unknown sort option newest-build -- using semver

The documentation is a bit confusing as there are warnings to switch to the new names but they appear to be not ready yet. You might try using latest instead and see if that works for you.

The version v0.12.2 is different from version latest (sha256:b3622d981368b5dc31e7d85545c3572e4a1c990cbe2403f8bb8053aa70766672), but the update-strategy: latest is working fine in your version v0.12.2? I have tried all scenarios but none of them is work :(

congvan1 avatar Apr 04 '24 16:04 congvan1