Skip to content

Multiple helm sources: skipping app of type '' because it's not of supported source type #558

Open
@admssa

Description

@admssa

Describe the bug
The problem is that when you store helm values files in a separate repo you use spes.sources instead of spes.source in your Application manifests. Thus instead of sourceType string in application status we will have sourceTypes array.

status:
  sourceTypes:
  - Helm

Unfortunately argocd-image-updater check for sourceType only:

func getApplicationType(app *v1alpha1.Application) ApplicationType {
sourceType := app.Status.SourceType
if st, set := app.Annotations[common.WriteBackTargetAnnotation]; set &&
strings.HasPrefix(st, common.KustomizationPrefix) {
sourceType = v1alpha1.ApplicationSourceTypeKustomize
}
if sourceType == v1alpha1.ApplicationSourceTypeKustomize {
return ApplicationTypeKustomize
} else if sourceType == v1alpha1.ApplicationSourceTypeHelm {
return ApplicationTypeHelm
} else {
return ApplicationTypeUnsupported
}
}

To Reproduce
Replace values surrounded by << >> and create Application with 2 sources and follow the logs:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: test
  namespace: argocd
  annotations:
    argocd-image-updater.argoproj.io/write-back-method: git
    argocd-image-updater.argoproj.io/image-list: test=<<REPO_URL/test>>
    argocd-image-updater.argoproj.io/test.force-update: "true"
    argocd-image-updater.argoproj.io/test.helm.image-tag: deployment.image.tag
    argocd-image-updater.argoproj.io/test.helm.image-name: deployment.image.repository
    argocd-image-updater.argoproj.io/test.update-strategy: latest
    argocd-image-updater.argoproj.io/test.allow-tags: regexp:(tested-dev-)
spec:
  project: default
  sources:
    - repoURL: <<rREPO_URL>>
      chart: test
      targetRevision: 0.1.0
      helm:
        releaseName: test
        valueFiles:
          - $values/dev/values/test.yaml
    - repoURL: "git@github.com:<<YOUR_ORG>>/gitops-backend.git"
      targetRevision: HEAD
      ref: values
  destination:
    server: "https://kubernetes.default.svc"
    namespace: dev
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
      allowEmpty: false
    syncOptions:
      - Validate=true
      - CreateNamespace=true
      - PrunePropagationPolicy=foreground
      - PruneLast=true

Version
0.12.2

Logs

time="2023-04-24T08:48:37Z" level=info msg="Processing results: applications=0 images_considered=0 images_skipped=0 images_updated=0 errors=0"
time="2023-04-24T08:50:38Z" level=warning msg="skipping app 'test' of type '' because it's not of supported source type" application=test

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions