Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-19337

GitHub Amazon SNS service hook and github-sqs-plugin JSON issue

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: github-sqs-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.525 on W2008.
    • Similar Issues:

      Description

      I'm receiving SNS and SQS notifications to Jenkins but an error is being recorded in the log when it tries to read the JSON:

      Aug 23, 2013 8:40:31 PM SEVERE com.base2services.jenkins.SqsQueueHandler$SQSQueueReceiver run
      unable to trigger builds A JSONObject text must begin with '{' at character 1 of "ref":"refs/heads/master","after":"11e0746b69050d489092038900c610f784d8b2e3","before":"2a0635b12f4468f8a372286db00be3425e4104cf","created":false...

      The email notification from SNS appears to have the '{' character:

      {"ref":"refs/heads/master","after":"11e0746b69050d489092038900c610f784d8b2e3","before":"2a0635b12f4468f8a372286db00be3425e4104cf","created":false...

      Is this an issue?

        Attachments

          Activity

          Hide
          smillerk2 Stephen Miller added a comment -

          The message placed onto my SQS queue is as follows (I replaced some account specific information with XXX):

          {
          "Type": "Notification",
          "MessageId": "cac74899-d8fc-5c51-bb6b-020c482d31ba",
          "TopicArn": "arn:aws:sns:us-east-1:XXXXXXXXX:GitHubDeploymentNotification",
          "Message": "{\"ref\":\"refs/heads/master\",\"after\":\"7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"before\":\"ef71fadedb125ea3c4a82e3f7d00a24d9717463e\",\"created\":false,\"deleted\":false,\"forced\":false,\"compare\":\"https://github.com/XXXXXXXXX/agf-turbo/compare/ef71fadedb12...7bc3c9a17d4b\",\"commits\":[{\"id\":\"7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"distinct\":true,\"message\":\"notification test\",\"timestamp\":\"2013-08-26T10:21:16-07:00\",\"url\":\"https://github.com/XXXXXXXXX/agf-turbo/commit/7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"author\":

          {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"}

          ,\"committer\":

          {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"}

          ,\"added\":[],\"removed\":[],\"modified\":[\"k2.txt\"]}],\"head_commit\":{\"id\":\"7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"distinct\":true,\"message\":\"notification test\",\"timestamp\":\"2013-08-26T10:21:16-07:00\",\"url\":\"https://github.com/XXXXXXXXX/agf-turbo/commit/7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"author\":

          {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"}

          ,\"committer\":

          {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"}

          ,\"added\":[],\"removed\":[],\"modified\":[\"k2.txt\"]},\"repository\":{\"id\":11590891,\"name\":\"agf-turbo\",\"url\":\"https://github.com/XXXXXXXXX/agf-turbo\",\"description\":\"\",\"watchers\":0,\"stargazers\":0,\"forks\":0,\"fork\":false,\"size\":312,\"owner\":

          {\"name\":\"XXXXXXXXX\",\"email\":\"github@XXXXXXXXX.com\"}

          ,\"private\":true,\"open_issues\":0,\"has_issues\":true,\"has_downloads\":true,\"has_wiki\":true,\"language\":\"JavaScript\",\"created_at\":1374522832,\"pushed_at\":1377537679,\"master_branch\":\"master\",\"organization\":\"XXXXXXXXX\"},\"pusher\":{\"name\":\"smillerk2\",\"email\":\"smiller@XXXXXXXXX.com\"}}",
          "Timestamp": "2013-08-26T17:21:21.716Z",
          "SignatureVersion": "1",
          "Signature": "jfj+86shPb2mCIKqpNCpkuT5nfxb82OsHiP6OE/Wzq8oYobCuySigAUsoPu+CUVq9us5Yp7TzSzUUBdfIbJ14ePa1XZ0juG7B7grdg01NrGovLsZF6TcAa+u5tZS4m3jGaHHvXbz2tMxwV2Fm7bwMYp8yfIUWpGA7UN0XeRaovA=",
          "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-XXXXXX.pem",
          "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:XXXXXXXXX:GitHubDeploymentNotification:4b56ac97-d00b-49b0-9c27-e73b02efa59c"
          }

          Show
          smillerk2 Stephen Miller added a comment - The message placed onto my SQS queue is as follows (I replaced some account specific information with XXX): { "Type": "Notification", "MessageId": "cac74899-d8fc-5c51-bb6b-020c482d31ba", "TopicArn": "arn:aws:sns:us-east-1:XXXXXXXXX:GitHubDeploymentNotification", "Message": "{\"ref\":\"refs/heads/master\",\"after\":\"7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"before\":\"ef71fadedb125ea3c4a82e3f7d00a24d9717463e\",\"created\":false,\"deleted\":false,\"forced\":false,\"compare\":\"https://github.com/XXXXXXXXX/agf-turbo/compare/ef71fadedb12...7bc3c9a17d4b\",\"commits\":[{\"id\":\"7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"distinct\":true,\"message\":\"notification test\",\"timestamp\":\"2013-08-26T10:21:16-07:00\",\"url\":\"https://github.com/XXXXXXXXX/agf-turbo/commit/7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"author\": {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"} ,\"committer\": {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"} ,\"added\":[],\"removed\":[],\"modified\": [\"k2.txt\"] }],\"head_commit\":{\"id\":\"7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"distinct\":true,\"message\":\"notification test\",\"timestamp\":\"2013-08-26T10:21:16-07:00\",\"url\":\"https://github.com/XXXXXXXXX/agf-turbo/commit/7bc3c9a17d4b0f35148f935122c35df6fb65b266\",\"author\": {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"} ,\"committer\": {\"name\":\"Stephen Miller\",\"email\":\"smiller@XXXXXXXXX.com\",\"username\":\"smillerk2\"} ,\"added\":[],\"removed\":[],\"modified\": [\"k2.txt\"] },\"repository\":{\"id\":11590891,\"name\":\"agf-turbo\",\"url\":\"https://github.com/XXXXXXXXX/agf-turbo\",\"description\":\"\",\"watchers\":0,\"stargazers\":0,\"forks\":0,\"fork\":false,\"size\":312,\"owner\": {\"name\":\"XXXXXXXXX\",\"email\":\"github@XXXXXXXXX.com\"} ,\"private\":true,\"open_issues\":0,\"has_issues\":true,\"has_downloads\":true,\"has_wiki\":true,\"language\":\"JavaScript\",\"created_at\":1374522832,\"pushed_at\":1377537679,\"master_branch\":\"master\",\"organization\":\"XXXXXXXXX\"},\"pusher\":{\"name\":\"smillerk2\",\"email\":\"smiller@XXXXXXXXX.com\"}}", "Timestamp": "2013-08-26T17:21:21.716Z", "SignatureVersion": "1", "Signature": "jfj+86shPb2mCIKqpNCpkuT5nfxb82OsHiP6OE/Wzq8oYobCuySigAUsoPu+CUVq9us5Yp7TzSzUUBdfIbJ14ePa1XZ0juG7B7grdg01NrGovLsZF6TcAa+u5tZS4m3jGaHHvXbz2tMxwV2Fm7bwMYp8yfIUWpGA7UN0XeRaovA=", "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-XXXXXX.pem", "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:XXXXXXXXX:GitHubDeploymentNotification:4b56ac97-d00b-49b0-9c27-e73b02efa59c" }
          Hide
          zoldak Jesse Zoldak added a comment -

          I have encountered this issue also, and submitted a fix for it upstream.
          See https://github.com/jenkinsci/github-sqs-plugin/pull/5

          Show
          zoldak Jesse Zoldak added a comment - I have encountered this issue also, and submitted a fix for it upstream. See https://github.com/jenkinsci/github-sqs-plugin/pull/5
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Zoldak
          Path:
          src/main/java/com/base2services/jenkins/github/GitHubTriggerProcessor.java
          src/test/java/com/base2services/jenkins/GitHubTriggerProcessorTest.java
          http://jenkins-ci.org/commit/github-sqs-plugin/6b3822038e7f56e9cb3ee68a64e0544c0f60b74b
          Log:
          Check that an SNS message is surrounded by double quotes before stripping them

          Fix for JENKINS-19337

          Stripping the double quotes is now captured in an if/else clause.

          Note that I was unable to duplicate creating a double-quote-surrounded message in SNS.
          Also I tried to write a test case that passed in a message surrounded by double quotes
          (as the plug-in was originally coded) but this causes an earlier line of code in the
          extractJsonFromPayload function to error.
          So I'm not really sure how it ever worked.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Zoldak Path: src/main/java/com/base2services/jenkins/github/GitHubTriggerProcessor.java src/test/java/com/base2services/jenkins/GitHubTriggerProcessorTest.java http://jenkins-ci.org/commit/github-sqs-plugin/6b3822038e7f56e9cb3ee68a64e0544c0f60b74b Log: Check that an SNS message is surrounded by double quotes before stripping them Fix for JENKINS-19337 Stripping the double quotes is now captured in an if/else clause. Note that I was unable to duplicate creating a double-quote-surrounded message in SNS. Also I tried to write a test case that passed in a message surrounded by double quotes (as the plug-in was originally coded) but this causes an earlier line of code in the extractJsonFromPayload function to error. So I'm not really sure how it ever worked.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Aaron Walker
          Path:
          pom.xml
          src/main/java/com/base2services/jenkins/github/GitHubTriggerProcessor.java
          src/test/java/com/base2services/jenkins/GitHubTriggerProcessorTest.java
          http://jenkins-ci.org/commit/github-sqs-plugin/bcd61e823e5d9d24eb24fb593033694bc563c6f4
          Log:
          Merge pull request #5 from jzoldak/zoldak/JENKINS-19337

          Check that an SNS message is surrounded by double quotes JENKINS-19337

          Compare: https://github.com/jenkinsci/github-sqs-plugin/compare/78cc3039131f...bcd61e823e5d

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Aaron Walker Path: pom.xml src/main/java/com/base2services/jenkins/github/GitHubTriggerProcessor.java src/test/java/com/base2services/jenkins/GitHubTriggerProcessorTest.java http://jenkins-ci.org/commit/github-sqs-plugin/bcd61e823e5d9d24eb24fb593033694bc563c6f4 Log: Merge pull request #5 from jzoldak/zoldak/ JENKINS-19337 Check that an SNS message is surrounded by double quotes JENKINS-19337 Compare: https://github.com/jenkinsci/github-sqs-plugin/compare/78cc3039131f...bcd61e823e5d

            People

            • Assignee:
              zoldak Jesse Zoldak
              Reporter:
              smillerk2 Stephen Miller
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: