Skip to content

argocd app diff, exit code is always the same #3588

@pere3

Description

@pere3

Checklist:

  • I've searched in the docs and FAQ for my answer: http://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

We are trying to use argocd diff output to determine situations, where next deployment will actually delete something inside out k8s cluster, rather than update or add.

When using argocd app diff command, exit code is always the same for actual "found diff" and "Failed to establish connection" cases.

To Reproduce

$ argocd --auth-token ${AUTH_TOKEN} --server argocd.cloud.test.org:80 --plaintext app diff python-mcs-test --local ./
INFO[0001] helm template . --name-template python-mcs-test --namespace microservices --values values.yaml --include-crds  dir=./ execID=IRBoN
===== apps/Deployment microservices/python-mcs-test-test-aiocron ======
10c10
<     test.com/image-tag: destructive-change-gke-20200514141114
---
>     test.com/image-tag: destructive-change-gke-20200514122504
57c57
<         image: gcr.io/test-cloud-48483/python-mcs-test:destructive-change-gke-20200514141114
---
>         image: gcr.io/test-cloud-48483/python-mcs-test:destructive-change-gke-20200514122504
===== apps/Deployment microservices/python-mcs-test ======
10c10
<     test.com/image-tag: destructive-change-gke-20200514141114
---
>     test.com/image-tag: destructive-change-gke-20200514122504
60c60
<         image: gcr.io/test-cloud-48483/python-mcs-test:destructive-change-gke-20200514141114
---
>         image: gcr.io/test-cloud-48483/python-mcs-test:destructive-change-gke-20200514122504
===== batch/CronJob microservices/python-mcs-test-test-cron1 ======
10c10
<     test.com/image-tag: destructive-change-gke-20200514141114
---
>     test.com/image-tag: destructive-change-gke-20200514122504
46c46
<             image: gcr.io/test-cloud-48483/python-mcs-test:destructive-change-gke-20200514141114
---
>             image: gcr.io/test-cloud-48483/python-mcs-test:destructive-change-gke-20200514122504
$ echo $?
1

$ argocd --auth-token ${AUTH_TOKEN} --server argocd.cloud.test.org:81 --plaintext app diff python-mcs-test --local ./
FATA[0020] Failed to establish connection to argocd.cloud.test.org:81: dial tcp 10.166.10.3:81: operation was canceled
$ echo $?
1

Expected behavior

We expect that argocd will throw different exit signals on failures (connection error), or at least an ability to correct it's behaviour with flags and parameters.

Same exit code values makes it impossible to distinguish actual command result inside jenkins pipeline.

Version

argocd: v1.5.1+8a3b36b
  BuildDate: 2020-04-06T15:59:42Z
  GitCommit: 8a3b36bd28fe278f7407b9a8797c79ad859d1acd
  GitTreeState: clean
  GoVersion: go1.14
  Compiler: gc
  Platform: darwin/amd64
argocd-server: v1.5.4+36bade7
  BuildDate: 2020-05-05T19:01:57Z
  GitCommit: 36bade7a2d7b69d1c0b0c4d41191f792a847d61c
  GitTreeState: clean
  GoVersion: go1.14.1
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: v0.13.1
  Kustomize Version: {Version:kustomize/v3.5.4 GitCommit:3af514fa9f85430f0c1557c4a0291e62112ab026 BuildDate:2020-01-11T03:12:59Z GoOs:linux GoArch:amd64}
  Helm Version: version.BuildInfo{Version:"v3.2.0", GitCommit:"e11b7ce3b12db2941e90399e874513fbd24bcb71", GitTreeState:"clean", GoVersion:"go1.13.10"}
  Kubectl Version: v1.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/priority:mediumShould be fixed in the next minor releasesbug/severity:minorBug has limited impact, maybe affects only an edge-case or is of cosmetic naturecomponent:cliAffects the Argo CD CLIgood first issueGood for newcomershacktoberfest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions