Imagine a world where infrastructure tasks deploy themselves with a simple push to GitHub.
Sounds interesting, huh?
Here’s how you can bring this imagination to reality.
In this blog, you will learn how to leverage Progress Chef Courier to create a streamlined CI/CD pipeline for precise job execution. More specifically, you will learn how adding a JSON file to GitHub will trigger an automated workflow in Jenkins!
This isn’t just automation—it’s intelligent orchestration. While Jenkins acts as the automation engine, Chef Courier introduces a layer of sophistication with features like granular targeting, retry mechanisms and detailed logging.
Why Should You Integrate Chef Courier Into Your CI/CD Pipeline?
Integrating Chef Courier into your CI/CD pipeline transforms basic automation into a robust, resilient deployment system. Whether managing nodes across a vast infrastructure or fine-tuning deployments for specific environments, this setup maintains precision, reliability and scalability.
Let’s dive into how you can revolutionize deployments with this powerful integration.
Why Chef Courier?
Chef Courier is not just an orchestration tool; it is what will help modern infrastructure to run smoothly and efficiently. Here's why it stands out:
- Seamless API Integration: Use Courier to bridge platforms like Jenkins effortlessly.
- Granular Targeting: Execute tasks on specific nodes with pinpoint accuracy.
- Enhanced Reliability: Use built-in retries, state consistency and robust logging for foolproof deployments.
By coupling Jenkins with Chef Courier, you can unlock a CI/CD pipeline capable of managing even the most complex workflows.
Pipeline Overview
Workflow Breakdown:
- Push a JSON configuration file to a GitHub repository.
- A GitHub webhook notifies Jenkins of the change.
- Jenkins pulls the repository, processes the JSON and invokes Chef Courier via the CLI to create a job.
- The job is reflected in Chef Courier's UI, ready for execution.
GitHub Integration
GitHub serves as the source of truth for your JSON files. Setting up webhooks ensures Jenkins is immediately notified of any changes.
Configure Webhooks:
1. Navigate to your repository:
- Go to Settings > Webhooks > Add Webhook in your repository.
2. Enter Webhook Details:
- a. Payload URL:
http://<Jenkins-IP>:<port>/github-webhook/
- b. Select Content Type: Select
application/json.
3. Choose Trigger Events:
Select 'push' events to trigger Jenkins whenever new files are added.
4. Make sure you have a green check next to your webhook.
Jenkins Configuration
Jenkins is the automation hub. With the right plugins and credentials, it seamlessly integrates with GitHub and Chef Courier.
Install Essential Plugins
- Git Plugin: For repository cloning.
- Pipeline Plugin: To write and manage pipelines as code.
- GitHub Integration Plugin: To manage webhooks and repository connections.
Add GitHub Credentials
- Make sure to generate a GitHub Personal Access Token with repo and admin:repo_hook permissions if the repo is private.
- If the repository is public, add the GitHub details under the Manage Jenkins section.
In this demonstration, I have registered my Jenkins workstation with Chef 360. We can also use Courier APIs to authenticate, access and run Courier jobs. Please follow the link to understand more on this.
Add Courier 360 workstation under the server list, where you’ll write your Courier jobs. Provide details like the Server Name and IP address of the machine.
To create a pipeline, click on New Item from the Jenkins Dashboard -> Either use freestyle/pipeline project based on your requirement and fill in the necessary details.
Provide Git repository under Source Code Management section, specify branch name and credentials if required.
- Under Build Triggers section choose GitHub hook trigger for GITScm polling.
- Select Build Environment if necessary.
- Provide the command under Build Steps, either through remote execution or select from wide range of options based on your use case.
In this scenario, we use a Remote shell to execute the command directly on the registered Jenkins machine.
![](/images/cheflibraries/about/buildstepsremoteshell.png?sfvrsn=9c259cf6_1)
Click on Save then Apply.
Execution:
Next, once you draft your courier job and merge it with the main branch of GitHub, a build will be triggered per the Jenkins configuration.
![](/images/cheflibraries/about/consoleoutput.png?sfvrsn=3ace9232_1)
As per the configuration, this build will log in to the Courier workstation (Jenkins machine) and execute the create job command on Chef 360.
Confirming the same on Chef 360 UI.
![](/images/cheflibraries/about/jobthroughjenkins.png?sfvrsn=a7b73c5e_1)
Elevate with Enhancements
Take your automation to the next level:
- Add Validations: Use tools like JSON lint to validate JSON structure before processing.
- Error Handling: Implement retry logic and error reporting for failed stages.
- Notifications: Integrate Slack or email notifications to stay updated on pipeline status.
Using a Jenkins Pipeline instead of manually executing tasks on Chef Courier offers several advantages, such as Automation and consistency, automatically detecting JSON file updates and pushing them to Chef Courier, Error Handling and notifications, Version Control and traceability, Security & https://docs.chef.io/360/1.1/reference/api/platform_authz/, and Scheduled or Event-Driven Execution.
Conclusion
Integrating GitHub, Jenkins and Chef Courier creates a robust CI/CD pipeline that transforms a simple GitHub commit into a more seamless workflow—precisely detecting, validating and orchestrating jobs. This integration leverages Jenkins for automation and Chef Courier for reliable, targeted deployments, maintaining consistency and future-proofing every step.
This solution simplifies deployments and lays the groundwork for scaling infrastructure management with advanced features like phased rollouts and API-driven orchestration.
Reference:
More information on Chef Job Orchestration.
Documentation on Chef platform auth cli.
Documentation on Chef Courier CLI.
How to Integrate Progress Chef Compliance with Jenkins Pipelines
If you want to learn more about Progress Chef Courier, please contact your account team or fill out this form.