Jenkins Integration
Integrate Cloudgeni security scanning into your Jenkins pipelines to automatically check Infrastructure as Code for security issues during your build process.What You'll Get
- Automated security scanning in your CI/CD pipeline
- Build quality gates that block insecure code
- Pipeline integration with declarative and scripted syntax
- Detailed reports published as build artifacts
- Webhook triggers for automated scanning
Prerequisites
Before You Start
Before You Start
- Jenkins server with Pipeline plugin installed
- Cloudgeni account and API key
- Repository containing IaC files (
.tf,.bicep,.hcl,.yaml, etc.)
Quick Start
Step 1: Create API Key
- Go to Settings → API Keys in Cloudgeni
- Click Create API Key
- Name it
jenkins - Copy the generated key
Step 2: Add Jenkins Credential
- Go to Manage Jenkins → Manage Credentials
- Select appropriate domain (or Global)
- Click Add Credentials
- Configure:
- Kind: Secret text
- Secret: Your Cloudgeni API key
- ID:
cloudgeni-api-key - Description: Cloudgeni API Key
- Click OK
Step 3: Create Pipeline
Create aJenkinsfile in your repository:
Configuration Options
Scanner Options
| Option | Description | Default |
|---|---|---|
--api-key | Cloudgeni API key | Required |
--fail-on-critical | Exit 1 on critical findings | false |
--fail-on-high | Exit 1 on high findings | false |
--path | Directory to scan | . |
--exclude | Paths to exclude | None |
--output | Output format (text, json, junit) | text |
Basic Stage
Strict Mode
Pipeline Examples
Declarative Pipeline
Scripted Pipeline
Production Pipeline
Multi-Branch Pipeline
Docker Agent
Using Docker for consistent environments:Reports and Artifacts
JUnit Report
Publish as test results:HTML Report
Generate HTML report:JSON Artifact
Archive JSON report:Webhook Triggers
GitHub Webhook
Configure webhook to trigger on push:- In Jenkins, create a new Pipeline job
- Configure Build Triggers → GitHub hook trigger for GITScm polling
- In GitHub, add webhook pointing to Jenkins
GitLab Webhook
- Install GitLab plugin in Jenkins
- Configure GitLab connection in Jenkins
- Enable Build when a change is pushed to GitLab
- Add webhook in GitLab project settings
Shared Libraries
Create reusable scanning function:Troubleshooting
Common Issues
Common Issues
Credential Not Found:
- Verify credential ID matches
- Check credential scope includes the job
- Ensure credential type is correct (Secret text)
- Verify installation step completed
- Check PATH includes Cloudgeni binary
- Try using full path to binary
- Check workspace permissions
- Verify Jenkins user can execute scripts
- Review file permissions on IaC files
- Add timeout to pipeline options
- Consider scanning specific paths
- Check for large files in repository
- Verify output format is junit
- Check file path in junit step
- Ensure scan completed successfully