Skip to main content

Start a task from your CI pipeline

When a build or a nightly job fails, your pipeline can ask Jaah to look into it. A Webhook automation gives you an address; one HTTP call from the failing job, sent with a Jaah API key, files a task in the project you pick. The same works for any script or service that can make an HTTP request.

Who can do this: creating the automation requires the org admin role. Any member can make the API key; tasks it starts are filed as that member.

  1. Make an API key for the pipeline. Open your profile's Security tab, select New key, name it after the pipeline, such as CI failures, and on Permissions select None, then tick Create on the Tasks row. Select Create and copy the secret into your CI system's secret store. See Create an API key.

  2. Create the automation. In the sidebar, select Audit, then Automations, then New automation. Set Source to Webhook and leave Payload at Any JSON. Select Next.

    New automation on its When step: Source set to Webhook, Payload Any JSON

  3. Say what the task does. On What, pick the project under Target, then write the task, such as The build failed. Read the log, find the cause and fix it. Quote what the pipeline sends with placeholders, such as {{body.job}} in Title and {{body.log_url}} in the description. Select Next, give it a Name, such as CI failures, and select Create.

  4. Copy the address. On the automation's Setup tab, under Endpoint, select Copy URL. Header shows how the call must authenticate: Authorization: Bearer <API key>.

  5. Call it from the failing job. Add a step that runs only when the build fails and posts JSON with the fields your placeholders name. In GitHub Actions, for example:

    - name: Ask Jaah to look into the failure
    if: failure()
    run: |
    curl -fsS -X POST "$JAAH_HOOK_URL" \
    -H "Authorization: Bearer $JAAH_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"job\": \"$GITHUB_WORKFLOW\", \"log_url\": \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}"
    env:
    JAAH_HOOK_URL: ${{ secrets.JAAH_HOOK_URL }}
    JAAH_API_KEY: ${{ secrets.JAAH_API_KEY }}

    In GitLab CI, put the same curl in a job with when: on_failure.

  6. Check it. Make a build fail once, or run the step by hand. On the automation's Runs tab, the run shows the task it filed. The task's timeline names both the key's owner and the key: the owner's name, then via CI failures.

To try the task text before a real failure, paste a sample body into Sample payload on the Advanced tab and select Test. Nothing is filed.

If no task appears​