Unable to generate query to fetch jenkins job for a given execution with Harness

36 views Asked by At

Can someone please help me out in generating a GraphQL Query for fetching the details of Jenkins Job URL added at a verify stage under Deployment Phases in a given workflow?

Below is the documentation for the same, https://developer.harness.io/docs/first-gen/firstgen-platform/techref-category/api/harness-api/

1

There are 1 answers

0
Bipin Kumar Chaurasia On

This can be done by enabling Jenkins Output in the Context option at Configure your Jenkins job and then also add a variable name like, Jenkins_Test with scope as Workflow.

In Workflow variables, add a variable as like, Jenkins_Test_Config with value as, ${context.Jenkins_Test.buildUrl}.

In the Workflow Overview, add Tags as below, Jenkins_Test_Config:${workflow.variables.Jenkins_Test_Config}

and the same below GraphQL query can be used as below,

{
  execution(executionId: "<EXECUTION-ID>") {
    ... on WorkflowExecution {
      tags {
        name
        value
      }
    }
  }
}