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

Assistance with JQL Format

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Component/s: jira-trigger-plugin
    • Labels:
      None
    • Environment:
      * Jenkins Version: 2.138.1
      * Jira Trigger Plugin Version: 0.6.3,
      * Hosting OS: CentOS 7.5
      * Java Version: java-1.8.0-openjdk-headless-1.8.0.191.b12-0.el7_5.x86_64
    • Similar Issues:

      Description

      Currently, we're able to trigger builds base on comments on Jira issues. However, the moment we try to use JQL to limit which issues will trigger a build (i.e., allow a build-message within issue "THJ2-1" to trigger a build but not the same build-message if commented within issue "THJ2-2") the job no longer triggers at all.

      Nearly certain this is a user (me) error rather than a bug, but I've run out of useful Google search results. Any help in proper syntax/usage for the JQL box would be greatly appreciated.

        Attachments

          Activity

          Hide
          ceilfors Wisen Tanasa added a comment -
          Show
          ceilfors Wisen Tanasa added a comment - Can you share the JQL you use? JQL is a JIRA feature, so it's best for you consult their documentation Can you share your logs? When JQL is used, Jenkins will need to talk back to JIRA. There might be a firewall issue, or you might have not configured the JIRA credentials in Jenkins. See: https://github.com/jenkinsci/jira-trigger-plugin/#jenkins-global-configuration-one-time
          Hide
          ferricoxide Thomas Jones added a comment - - edited

          Hi: thanks for the quick response!  =)

          Can you share the JQL you use? JQL is a JIRA feature, so it's best for you consult their documentation

           Initially, I was doing Project = <PROJECTNAME> AND Issue = <ISSUENAME>, but then I realized that, since the web-hook configured in Jira was tied to a single project, I could (at least till testing is completed and multiple, real projects get enabled) simplify/shorten to just Issue = <ISSUENAME>. In either case, I used the JQL query-constructor tool in Jira to create my query statement.

          Can you share your logs?

          Yes. Getting logs is no problem. I set up the TRACE logging, yesterday. Just wasn't seeing anything meaningful. More than happy to provide logs, but would probably be best for all concerned if I provide just the relevant logs rather than trying to attach a 20MiB logfile to pore through. =)

          When JQL is used, Jenkins will need to talk back to JIRA. There might be a firewall issue, or you might have not configured the JIRA credentials in Jenkins. See: https://github.com/jenkinsci/jira-trigger-plugin/#jenkins-global-configuration-one-time

          Issue-triggering works ...absent the inclusion of JQL query. Communications are fine: I already validated bi-directional comms ability by {{curl}}ing each host from the other. The problem I have is that, if I set up my Jenkins job to be triggerable by a given phrase, say "BUILD ME NOW", if that phrase appears in any issue within the configured project, every Jenkins job that keys on that phrase gets triggered (I set up two, simple test-jobs to validate this). I need to be able to use the JQL query to limit each job to only be triggerable from a specific issue within a specific project: the nightmare alternative is that each Jenkins would need to be triggered by its own, unique phrase. As of the opening of this ticket, as soon as I put any content in the JQL box, the trigger ceased functioning and I wasn't able to discern any errors from my logs.

          Show
          ferricoxide Thomas Jones added a comment - - edited Hi: thanks for the quick response!  =) Can you share the JQL you use? JQL is a JIRA feature, so it's best for you consult their documentation  Initially, I was doing Project = <PROJECTNAME> AND Issue = <ISSUENAME> , but then I realized that, since the web-hook configured in Jira was tied to a single project, I could (at least till testing is completed and multiple, real projects get enabled) simplify/shorten to just Issue = <ISSUENAME> . In either case, I used the JQL query-constructor tool in Jira to create my query statement. Can you share your logs? Yes. Getting logs is no problem. I set up the TRACE logging, yesterday. Just wasn't seeing anything meaningful. More than happy to provide logs, but would probably be best for all concerned if I provide just the relevant logs rather than trying to attach a 20MiB logfile to pore through. =) When JQL is used, Jenkins will need to talk back to JIRA. There might be a firewall issue, or you might have not configured the JIRA credentials in Jenkins. See: https://github.com/jenkinsci/jira-trigger-plugin/#jenkins-global-configuration-one-time Issue-triggering works  ...absent the inclusion of JQL query. Communications are fine: I already validated bi-directional comms ability by {{curl}}ing each host from the other. The problem I have is that, if I set up my Jenkins job to be triggerable by a given phrase, say "BUILD ME NOW", if that phrase appears in any issue within the configured project, every Jenkins job that keys on that phrase gets triggered (I set up two, simple test-jobs to validate this). I need to be able to use the JQL query to limit each job to only be triggerable from a specific issue within a specific project: the nightmare alternative is that each Jenkins would need to be triggered by its own, unique phrase. As of the opening of this ticket, as soon as I put any content in the JQL box, the trigger ceased functioning and I wasn't able to discern any errors from my logs.
          Hide
          ceilfors Wisen Tanasa added a comment -

          Thanks for the detailed answer. Follow up questions:

          1. Have you configured the JIRA credentials in Jenkins as per mentioned in my comment?
          2. What do you configure as the value of ISSUENAME? ISSUE in JQL accepts ISSUE_KEY. For example, the JQL for this current ticket is ISSUE=JENKINS-54548. I don't understand how would you use that field to filter your job trigger.

          Alternatively, if you are trying to differentiate by ISSUE, the plugin injects JIRA_ISSUE_KEY as an environment variable. Would it be possible to execute your build conditionally based on that environment variable?

          Show
          ceilfors Wisen Tanasa added a comment - Thanks for the detailed answer. Follow up questions: Have you configured the JIRA credentials in Jenkins as per mentioned in my comment? What do you configure as the value of ISSUENAME? ISSUE in JQL accepts ISSUE_KEY. For example, the JQL for this current ticket is ISSUE= JENKINS-54548 . I don't understand how would you use that field to filter your job trigger. Alternatively, if you are trying to differentiate by ISSUE, the plugin injects JIRA_ISSUE_KEY as an environment variable. Would it be possible to execute your build conditionally based on that environment variable?
          Hide
          ferricoxide Thomas Jones added a comment -

          Have you configured the JIRA credentials in Jenkins as per mentioned in my comment?

          If you mean in the https://<JENKINS_URL>/configure section, then, "yes, I believe so". Like I say, everything works unless I attempt to restrict things through the use of a JQL filter.

          What do you configure as the value of ISSUENAME? ISSUE in JQL accepts ISSUE_KEY. For example, the JQL for this current ticket is ISSUE=JENKINS-54548. I don't understand how would you use that field to filter your job trigger.

          Sorry, what I meant is that I was trying to configure my Jenkins job to only "listen" for the build-request string (in my test case, "BUILD ME NOW") only when it's present in the issue TEST-4, but to (essentially) ignore that same build-request string if it's commented into any other issue (e.g., if someone posted "BUILD ME NOW" into TEST-5 or Test-200, the job with the JQL-filter would ignore that comment).

          Show
          ferricoxide Thomas Jones added a comment - Have you configured the JIRA credentials in Jenkins as per mentioned in my comment? If you mean in the https://<JENKINS_URL>/configure section, then, "yes, I believe so". Like I say, everything works  unless I attempt to restrict things through the use of a JQL filter. What do you configure as the value of ISSUENAME? ISSUE in JQL accepts ISSUE_KEY. For example, the JQL for this current ticket is ISSUE= JENKINS-54548 . I don't understand how would you use that field to filter your job trigger. Sorry, what I meant is that I was trying to configure my Jenkins job to only "listen" for the build-request string (in my test case, "BUILD ME NOW") only when it's present in the issue TEST-4 , but to (essentially) ignore that same build-request string if it's commented into any other issue (e.g., if someone posted "BUILD ME NOW" into TEST-5 or Test-200, the job with the JQL-filter would ignore that comment).
          Hide
          ceilfors Wisen Tanasa added a comment -

          What I meant to say is, all of the other features in the plugin doesn't need "https://<JENKINS_URL>/configure". If you use JQL filter, the "https://<JENKINS_URL>/configure" will need to be configured properly. I'd expect an error to be logged, but if it's not anywhere I'm afraid I can't really help any further.

          Do let me know if the alternative provided works for you.

          Show
          ceilfors Wisen Tanasa added a comment - What I meant to say is, all of the other features in the plugin doesn't need "https://<JENKINS_URL>/configure". If you use JQL filter, the "https://<JENKINS_URL>/configure" will need to be configured properly. I'd expect an error to be logged, but if it's not anywhere I'm afraid I can't really help any further. Do let me know if the alternative provided works for you.
          Hide
          ferricoxide Thomas Jones added a comment -

          Ok, I think I missed what you were saying, previously. When you said:

          Alternatively, if you are trying to differentiate by ISSUE, the plugin injects JIRA_ISSUE_KEY as an environment variable. Would it be possible to execute your build conditionally based on that environment variable?

          What you meant was that instead of using JQL when setting up the JOB, add a conditional to the job that matches selects for/against JIRA_ISSUE_KEY. Which is to say, all of the trigger-enabled jobs will receive the common comment string but terminate if JIRA_ISSUE_KEY isn't correct for that job? Sorry, I'm slow, sometimes. I get focussed on how I want/expect things to work that everything else is read through that filter.

           

          When I get a chance to revisit this, I'll give that a shot. Thanks in advance!

           

          Show
          ferricoxide Thomas Jones added a comment - Ok, I think I missed what you were saying, previously. When you said: Alternatively, if you are trying to differentiate by ISSUE, the plugin injects JIRA_ISSUE_KEY as an environment variable. Would it be possible to execute your build conditionally based on that environment variable? What you meant was that instead of using JQL when setting up the JOB, add a conditional to the job that matches selects for/against JIRA_ISSUE_KEY . Which is to say, all of the trigger-enabled jobs will receive the common comment string but terminate if JIRA_ISSUE_KEY isn't correct for that job? Sorry, I'm slow, sometimes. I get focussed on how I want/expect things to work that everything else is read through that filter.   When I get a chance to revisit this, I'll give that a shot. Thanks in advance!  
          Hide
          ceilfors Wisen Tanasa added a comment -

          Yes, that's what I meant. No worries! Do reopen the issue if more assistance is needed.

          Show
          ceilfors Wisen Tanasa added a comment - Yes, that's what I meant. No worries! Do reopen the issue if more assistance is needed.

            People

            • Assignee:
              ceilfors Wisen Tanasa
              Reporter:
              ferricoxide Thomas Jones
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: