argocd-diff-action / argocd-diff-action

This GitHub action generates an ArgoCD diff between the current PR and the current state of the cluster.
GNU General Public License v3.0
13 stars 8 forks source link

TypeError: Cannot read properties of undefined (reading 'source') #4

Open Voziv opened 1 year ago

Voziv commented 1 year ago

I haven't had time to do an exact reproduction on a fresh argocd install, however either ApplicationSet or argocd 2.6.x seems to have broken this action for ratehub.

Run ratehub/argocd-diff-action@v0
  with:
    argocd-server-fqdn: *** (dev instance, running v2.6.1)
    argocd-token: ***
    github-token: ***
    argocd-version: v2.6.1
    argocd-extra-cli-args: --grpc-web

When running the action I get TypeError: Cannot read properties of undefined (reading 'source'). It's not helpful in debugging what is going wrong. If it's a result of the api call I'd like to have the api call contents dumped.

I believe I've already added a bit more debug logs but some of them were not successful in dumping enough information.

morey-tech commented 1 year ago

@Voziv, can you re-run one of the failed workflows for the action with debug logging enabled and post the logs here? Xnapper-2023-03-20-16 46 55

Voziv commented 1 year ago

Here's the log archive of my latest run with debug logging turned on: logs_349.zip

The most notable bit that I can see is

##[debug]Making API call to: 'argocd.dev.ratehub.dev/api/v1/applications'
{ metadata: { name: 'abhay-ratehub-frontend' } }
TypeError: Cannot read properties of undefined (reading 'source')
Error: TypeError: Cannot read properties of undefined (reading 'source')
    at /home/runner/work/_actions/ratehub/argocd-diff-action/v0/dist/index.js:13473:29
    at Array.filter (<anonymous>)
    at AppCollection.filterByRepo (/home/runner/work/_actions/ratehub/argocd-diff-action/v0/dist/index.js:13471:44)
    at /home/runner/work/_actions/ratehub/argocd-diff-action/v0/dist/index.js:13875:14
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/_actions/ratehub/argocd-diff-action/v0/dist/index.js:13771:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
##[debug]Node Action run completed with exit code 1
chancez commented 8 months ago

So I looked into it, and it seems like the problem is the fields selection logic. After I fixed that, I also noticed it failed on multi-source repos. I have a branch you can see here with the changes I made to fix this: https://github.com/chancez/argocd-diff-action/pull/1

Voziv commented 8 months ago

Thanks for looking into it @chancez. If I can manage to get some time :crossed_fingers: I want to look into getting this fixed and some type of automated testing that I can run so that this can be a bit easier to maintain and update.

fcrespofastly commented 8 months ago

Hey folks!

I tested @chancez branch and it seems the issue went away, though I'm hitting something different now:

time="2024-02-25T21:35:40Z" level=fatal msg="rpc error: code = Unknown desc = error receiving manifest file stream: error receiving tgz file: file checksum validation error: calc e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 sent d56dcb6cc50a6605b73b72e9f41d63f8959d8b61b72e9f9bad6b947f45b402be"

I hit this issue when passing --server-side-generate as suggested by some warnings

fcrespofastly commented 8 months ago

Ok, when removing --server-side-generate it just worked!

fcrespofastly commented 8 months ago

@Voziv hey 👋🏻 !

Any chance we can get this merged?