travisghansen / argo-cd-helmfile

Integration between argo-cd and helmfile
MIT License
213 stars 55 forks source link

application spec for testapp is invalid: InvalidSpecError: Unable to generate manifests #25

Closed abrarcv170 closed 2 years ago

abrarcv170 commented 2 years ago

Unable to save changes: application spec for testapp is invalid: InvalidSpecError: Unable to generate manifests in new/: rpc error: code = Unknown desc = argo-cd-helmfile.sh init failed exit status 1:

travisghansen commented 2 years ago

I’ll need more info. Can you send over the deployment and also the application yaml you’re attempting to use?

abrarcv170 commented 2 years ago
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: testapp
  namespace: default
spec:
  destination:
    namespace: default
    server: https://kubernetes.default.svc
  project: default
  source:
    repoURL: https://github.com/abrarcv170/helmfiletest.git
    #targetRevision: main
    path: new/
    plugin:
      env:
      - name: HELMFILE_GLOBAL_OPTIONS
        value: --file new/helmfile.yaml  
      name: helmfile 
abrarcv170 commented 2 years ago

https://github.com/abrarcv170/helmfiletest.git ,this is a public repo you can check the helmfile .

abrarcv170 commented 2 years ago
kubeVersionOverride: "1.16.15"
repoServer:
  initContainers:
  - name: download-tools
    image: alpine:3.8
    command: [sh, -c]
    args:
      - wget -qO /custom-tools/argo-cd-helmfile.sh https://raw.githubusercontent.com/travisghansen/argo-cd-helmfile/master/src/argo-cd-helmfile.sh &&
        chmod +x /custom-tools/argo-cd-helmfile.sh &&
        wget -qO /custom-tools/helmfile https://github.com/roboll/helmfile/releases/download/v0.138.7/helmfile_linux_amd64 &&
        chmod +x /custom-tools/helmfile
    volumeMounts:
      - mountPath: /custom-tools
        name: custom-tools
  volumeMounts:
  - mountPath: /usr/local/bin/argo-cd-helmfile.sh
    name: custom-tools
    subPath: argo-cd-helmfile.sh
  - mountPath: /usr/local/bin/helmfile
    name: custom-tools
    subPath: helmfile
  volumes:
  - name: custom-tools
    emptyDir: {}

This is the helm value file of argocd

travisghansen commented 2 years ago

ok, and in the server config you'll need something like this:

    configManagementPlugins: |
      - name: helmfile
        init:                          # Optional command to initialize application source directory
          command: ["argo-cd-helmfile.sh"]
          args: ["init"]
        generate:                      # Command to generate manifests YAML
          command: ["argo-cd-helmfile.sh"]
          args: ["generate"]

do you have that?

abrarcv170 commented 2 years ago

yes i have . [[ -v HELMFILE_HELMFILE ]]\n+ [[ ! -d .argo-cd-helmfile.shhelmfile.d ]]\n+ mkdir -p /tmp/argo-cd-helmfile.sh/apps/testapp\n+ [[ 3 -eq 2 ]]\n+ [[ 3 -eq 3 ]]\n+ export HELMFILE_HELM3=1\n+ HELMFILE_HELM3=1\n+ '[' '!' -z '' ']'\n+ /usr/local/bin/helmfile --helm-binary /usr/local/bin/helm --no-color --allow-no-matching-release --namespace default --file new/helmfile.yaml**repos\nspecified state file new/helmfile.yaml is not found"**grpc.code=Unknown grpc.method=GenerateManifest grpc.request.deadline="2022-08-31T08:31:47Z" grpc.service=repository.RepoServerService grpc.start_time="2022-08-31T08:30:47Z" grpc.time_ms=3.066 span.kind=server system=grpc

this is the logs from repo server pod