argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.69k stars 5.39k forks source link

Argocd notification for Jenkins webhook is not working #11028

Open madhubalaravi opened 1 year ago

madhubalaravi commented 1 year ago

Describe the bug I'm trying to configure jenkins webhook in argocd. I have created configmap, secret and application in argocd to trigger jenkins post sync up of the application. Also I don't see any logs related to webhook notification.

To Reproduce

Expected behavior

It should trigger Jenkins job after the argocd application deployment. 

Screenshots

Version

Argo CD v2.4.7+81630e6
Helm v3.8.1+g5cb9af4
kubectl v0.23.1

Logs

Configmap

apiVersion: v1
data:
  argocd-cm.yaml: "triggers:\n  - name: jenkins\n    condition: app.status.operationState.phase
    == 'Succeeded' and app.status.health.status == 'Healthy'\n    enabled: true\n
    \   template: jenkins\nsubscriptions:\n- recipients:\n  - webhook:jenkins\n  triggers:\n
    \ - jenkins\ntemplates:\n  - name: jenkins\n    webhook:\n      jenkins:\n        method:
    POST # optional, POST is default value\n        body: | {\n              \"test\":
    \"test\"\n        }      \n"
  context: |
    argocdUrl:
kind: ConfigMap
metadata:
  annotations:
    meta.helm.sh/release-name: argocd
    meta.helm.sh/release-namespace: argocd-devops-dev
  creationTimestamp: "2022-08-12T04:26:27Z"
====================================================================
Secret

apiVersion: v1
kind: Secret
metadata:
  name: argocd-notifications-secret
stringData:
  argocd-secret.yaml: |
    webhook:
    - name: jenkins
      url: https://jenkinsdev.com/job/Email-Test/build?token=argocdtest
      basicAuth:
        username: "xxx"
        password: "xxx"
============================================================================
application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    on-sync-succeeded.recipients.argocd-notifications.argoproj.io: webhook:jenkins
    recipients.argocd-notifications.argoproj.io: webhook:jenkins
  creationTimestamp: "2022-10-21T15:27:42Z"
  generation: 43
  name: xxx
  namespace: xxx
  resourceVersion: "127061063"
  uid: b654b6bd-930c-460b-b16f-e3e756a3df49
spec:
  destination:
    namespace: default
    server: https://kubernetes.default.svc
  project: default
  source:
    helm:
      valueFiles:
      - plat-dev-values.yaml
    path: coresvc-apis
    repoURL: git@github.com:xxx

Please assist me.

balajisa09 commented 1 year ago

Hi Madhu,

Did you try to reproduce this behaviour in the latest version. If it still persist, i am willing to take up this issue.

ferchdav commented 2 months ago

Hello @madhubalaravi @balajisa09 did you finally get this working? I have a similar issue in version 2.11: I can't trigger a Jenkins job. I have posted this issue in slack channel here: https://cloud-native.slack.com/archives/C01UKS2NKK3/p1721765672575089

ferchdav commented 2 months ago

Hello @alexmt is this still a bug in Argocd ver 2.11?

ferchdav commented 2 months ago

Hello all, could you confirm if this is still a bug in Argocd ver 2.11? Anyone who has webhook for Jenkins working well? Thanks