JobBuild icon
Sequential icon
Request icon
Assert icon
TeamsIncomingWebhook icon
Pause icon
SlackIncomingWebhook icon

Jenkins Build-to-Deploy Approval Gate with Teams Notification

Gate a Jenkins build-to-deploy pipeline with Kestra: run the build, request approval in Teams, pause for a reviewer, then trigger the deploy and confirm on Slack.

Categories
Infrastructure

Add a human approval gate between a Jenkins build and its deploy job so no release ships without a named reviewer signing off. This Jenkins CI/CD orchestration blueprint runs the build, waits for it to finish, posts an Adaptive Card to Microsoft Teams, pauses for review, then fires the deploy and confirms on Slack. It solves the gap most teams patch with manual chat pings and copy-pasted job links: a reliable, auditable build-to-deploy handoff where the reviewer identity and approval timestamp are captured automatically in execution history.

How it works

  1. run_build (io.kestra.plugin.jenkins.JobBuild) enqueues the build job named by the build_job input on the jenkins_url instance.
  2. wait_for_build (io.kestra.plugin.core.flow.Sequential) polls the Jenkins lastBuild REST endpoint with a core.http.Request and re-runs the block via a constant retry until assert_build_done confirms the build has a terminal result.
  3. notify_approval (io.kestra.plugin.microsoft365.teams.TeamsIncomingWebhook) posts an Adaptive Card to Microsoft Teams once the build is genuinely done.
  4. await_approval (io.kestra.plugin.core.flow.Pause) holds the execution for up to the approval_timeout duration while a reviewer approves in the Kestra UI.
  5. run_deploy (io.kestra.plugin.jenkins.JobBuild) enqueues the deploy job, and notify_complete (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) confirms the trigger on Slack.

What you get

  • A human gate that blocks the deploy job until someone approves.
  • Teams cards that fire only after the build reaches a terminal result, so reviewers never approve a still-running build.
  • Reviewer identity and approval timestamp recorded in execution history.
  • A Slack confirmation when the deploy is triggered.
  • A configurable approval window that fails cleanly if nobody acts in time.

Who it's for

  • Platform and DevOps engineers wiring approval gates into existing Jenkins pipelines.
  • Release managers who need an auditable record of who approved each deploy.
  • Teams that want change control without rebuilding their Jenkins jobs.

Why orchestrate this with Kestra

Jenkins can chain a build to a deploy, but its input step ties the gate to a running agent, and the approval trail lives inside console logs rather than a queryable history. Kestra runs the gate as declarative YAML: Pause parks the execution without holding an executor, retries handle the polling loop, and every approval is stored with reviewer identity and timestamp for lineage and audit. You also get event triggers, notifications across Teams and Slack, and a clean failure path when an approval times out, all in one flow that any reviewer can act on from the UI.

Prerequisites

  • A reachable Jenkins instance with a build job and a deploy job.
  • A Microsoft Teams incoming webhook and a Slack incoming webhook.

Secrets

  • JENKINS_USERNAME: Jenkins user for Basic Auth.
  • JENKINS_API_TOKEN: Jenkins API token.
  • TEAMS_WEBHOOK_URL: Microsoft Teams incoming webhook URL for the approval card.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for the completion notification.

Quick start

  1. Set the four secrets above in your Kestra namespace.
  2. Provide the build_job and deploy_job names, and override jenkins_url and approval_timeout if needed.
  3. Run the flow, watch the Teams card arrive, and approve the await_approval Pause in the Kestra UI to trigger the deploy.

How to extend

  • Gate the deploy on the build result: add an If task between wait_for_build and notify_approval and route a failed build to a Fail task so the deploy is skipped.
  • Swap notifications: send the approval request and confirmation to email, Discord, or any HTTP endpoint.
  • Add a trigger so a merged pull request or a webhook starts the flow automatically.
  • For foldered Jenkins jobs, adjust the lastBuild URI path to include the folder segments.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.