Schedule Jenkins builds every 5 minutes

Recipe ToolsMarketingDeveloper ToolAPI Integration

What it does

When the clock triggers every 5 minutes, this automation creates a Jenkins build with security credentials and parameters. It retrieves the Jenkins crumb, sends the build request, and logs any errors to the job report.

Who it's for

Engineering teams who need to run Jenkins builds on a regular schedule without manual intervention.

How teams use this

Run scheduled builds for continuous integration

Automatically trigger Jenkins builds every 5 minutes to run tests and deployments on a fixed schedule without manual kicks or oversight.

Route build failures to a Slack channel

Send error logs from failed builds to Slack so the engineering team sees failures in real time and can respond immediately.

Require approval for production builds

Add a condition to check if gitStage is set to production and require approval before the build starts. Only production builds need the extra gate.

How it works

  1. Start on a 5-minute interval. The automation begins every 5 minutes to initiate the Jenkins build process with no manual intervention needed.
  2. Set build parameters in Jenkins. Create variables for token, manifestId, projectName, gitStage, and gitBranchName that define the build configuration and environment.
  3. Retrieve the Jenkins crumb via Rest. Make a request to get the Jenkins crumb, a security token required to trigger builds on protected Jenkins instances.
  4. Send build request to Jenkins via Rest. Send a request to Jenkins with the build parameters and crumb to start the build process on the specified branch and stage.
  5. Log errors to the job report. If an error occurs during the build, log the error message to the job report so the team can troubleshoot and monitor failures.