Quick Reference Guide - Jenkins as Code
Quick reference for common tasks and configurations in Jenkins as Code
Quick Reference Guide
Quick reference for common tasks and configurations in Jenkins as Code
📋 Table of Contents
- Common Commands
- Configuration Quick Reference
- JobGenie Quick Examples
- Troubleshooting Quick Fixes
- Useful Links
🚀 Common Commands
Ansible Commands
# Run full deployment
ansible-playbook packer.yml \
-e "target_host=packer_al2023_aarch64_devops_jenkins" \
-t deploy,monitoring
# Check connectivity
ansible target_host -m ping
# Run with verbose output
ansible-playbook packer.yml -e "target_host=..." -vvv
# Dry run (check mode)
ansible-playbook packer.yml -e "target_host=..." --check
Git Commands
# Create feature branch
git checkout -b feature/onboard-new-service
# Commit changes
git add amazon/mcloud/nonprod/jobs/mcloud-nonprod-jobs.yml
git commit -m "Onboard new-service-api"
# Push and create PR
git push origin feature/onboard-new-service
Jenkins Commands
# Check Jenkins service
systemctl status jenkins
# View Jenkins logs
tail -f /var/log/jenkins/jenkins.log
# Restart Jenkins
systemctl restart jenkins
⚙️ Configuration Quick Reference
Essential Ansible Variables
# Jenkins Version
jenkins_version: 2.528.2
# Jenkins Home
jenkins_home: "/var/lib/jenkins"
# Project Name
jenkins_project_name: amazon
# Jenkins URL
jenkins_location:
url: "https://jenkins.mcloud.com/"
adminAddress: "mcloud-jenkins@mcloud.com"
# Security
jenkins_securityRealm:
local:
allowsSignup: false
users:
- id: "admin"
password: "Admin@123"
User Access Configuration
# Read Users
overall_read_users:
amazon:
mcloud:
- user: "dev"
qa:
- user: "qa-user"
# Admin Users
overall_admin_users:
devops_managers:
- user: "hari_25585"
- user: "admin"
JobGenie Default Config
# Default section in YAML job definition file
jobgenie:
default:
HOME_DIR: prod
GROUP: "v4"
ENV: "prod"
jobs:
# Jobs defined here
🎩 JobGenie Quick Examples
Simple Application Job
# File: amazon/mcloud/prod/jobs/mcloud-prod-jobs.yml
jobgenie:
default:
HOME_DIR: prod
GROUP: "v4"
ENV: "prod"
jobs:
- NAME: "my-service"
PARAMETERS:
- { name: 'GitBranch', string: 'master', description: 'Application branch.' }
CONFIGS:
APP_REPO: "my-app"
APP_BRANCH: "master"
Multiple Jobs in One File
jobgenie:
default:
HOME_DIR: prod
GROUP: "v4"
ENV: "prod"
jobs:
- NAME: "service-a"
CONFIGS:
APP_REPO: "monorepo"
APP_BRANCH: "main"
- NAME: "service-b"
CONFIGS:
APP_REPO: "monorepo"
APP_BRANCH: "main"
- NAME: "service-c"
CONFIGS:
APP_REPO: "monorepo"
APP_BRANCH: "main"
Custom Job with Parameters
jobgenie:
default:
HOME_DIR: prod
GROUP: "v4"
ENV: "prod"
jobs:
- NAME: "custom-service"
PARAMETERS:
- { name: 'TAG', string: 'latest', description: 'Deployment tag.' }
- { name: 'Environment', choices: ['dev', 'prod'], description: 'Target environment.' }
CONFIGS:
SERVICE: "custom-service"
CICD_TEMPLATE_NAME: "custom-template"
APP_REPO: "custom-app"
APP_BRANCH: "main"
Advanced Configuration
jobgenie:
default:
HOME_DIR: prod
GROUP: "v4"
ENV: "prod"
jobs:
- NAME: "my-service"
PARAMETERS:
- { name: 'GitBranch', string: 'develop', description: 'Application branch.' }
CONFIGS:
APP_REPO: "my-app"
APP_BRANCH: "develop"
DOCKER_BUILD_ARGS: "ENV,TECHTEAM"
DOCKERFILE_PATH: "services/Dockerfile"
SSH_KEYS: "default:/opt/jenkins/keys/prod_key_rsa"
🔧 Troubleshooting Quick Fixes
Jenkins Not Accessible
# Check service
systemctl status jenkins
# Check port
netstat -tlnp | grep 8080
# Check logs
tail -f /var/log/jenkins/jenkins.log
Configuration Not Applied
- Reload Configuration as Code:
- Navigate to:
amazon/manage-infra/Reload-ConfigAsCode - Run job
- Navigate to:
- Check Configuration:
- Navigate to: Manage Jenkins → Configuration as Code
Jobs Not Generated
- Verify YAML file naming:
- Must end with
-jobs.ymlor-jobs.yaml - Path:
{org}/{project}/{env}/jobs/{project}-{env}-jobs.yml
- Must end with
- Verify YAML syntax:
jobgenie: default: HOME_DIR: prod GROUP: "v4" ENV: "prod" jobs: - NAME: "my-service" CONFIGS: APP_REPO: "my-app" - Check seed job logs:
- View console output
- Look for YAML parsing errors
- Verify file path matches expected structure
Permission Denied
- Check user in configuration:
overall_read_users: amazon: mcloud: - user: "username" -
Verify role patterns match job paths
- Test as user to verify access
📚 Additional Resources
📖 Related Documentation
- 🏠 Main Documentation - Complete Jenkins as Code framework overview
- 🏗️ Architecture Guide - System architecture and design
- ⚙️ JobGenie Guide - JobGenie usage and examples
- 🔧 Setup Guide - Setup and configuration guide
- 🚀 DevOps as a Service - Self-service CI/CD platform guide
- ✅ Best Practices - Recommended practices and guidelines
🧭 Navigation
Related Topics:
- See Setup Guide for detailed setup instructions
- Review JobGenie Guide for job configuration examples
- Check Best Practices for recommended approaches
Jenkins
- Jenkins URL:
https://jenkins.mcloud.com/ - Configuration as Code: Manage Jenkins → Configuration as Code
- Credentials: Manage Jenkins → Credentials
Git Repositories
- mCloud-Jenkins:
https://github.com/HarryTheDevOpsGuy/mCloud-Jenkins.git - mCloud-infra:
https://github.com/HarryTheDevOpsGuy/mCloud-infra.git
Support
- Email: devops-admin@example.com
- Slack: #devops-alerts
📝 Common Workflows
Onboard New Service
- Edit YAML job definition file:
# File: amazon/mcloud/nonprod/jobs/mcloud-nonprod-jobs.yml jobgenie: default: HOME_DIR: nonprod GROUP: "v4" ENV: "stage" jobs: - NAME: "new-service-api" PARAMETERS: - { name: 'GitBranch', string: 'develop', description: 'Development branch.' } CONFIGS: APP_REPO: "new-service" APP_BRANCH: "develop" - Commit and push:
git add amazon/mcloud/nonprod/jobs/mcloud-nonprod-jobs.yml git commit -m "Onboard new-service-api" git push origin feature/onboard-new-service - Run seed job:
- Navigate to:
0-JobGenie-Generator - Set
GitBranchparameter to your branch - Click Build
- Navigate to:
- Verify job created:
- Check:
amazon/mcloud/nonprod/deploy/v4/stage/new-service-api
- Check:
Update Configuration
- Edit Ansible variables:
vim group_vars/packer_al2023_aarch64_devops_jenkins.yml - Run Ansible playbook:
ansible-playbook packer.yml \ -e "target_host=packer_al2023_aarch64_devops_jenkins" \ -t deploy - Reload Configuration as Code:
- Run:
amazon/manage-infra/Reload-ConfigAsCode
- Run:
Add New User
- Edit Ansible variables:
overall_read_users: amazon: mcloud: - user: "new-user" - Run Ansible playbook:
ansible-playbook packer.yml \ -e "target_host=packer_al2023_aarch64_devops_jenkins" \ -t deploy - Reload Configuration as Code
🎯 Quick Checklist
Initial Setup
- Ansible playbook configured
- Jenkins server provisioned
- Configuration as Code loaded
- Credentials added
- Seed jobs created
Onboarding Service
- JobGenie config created
- Changes committed to Git
- Seed job run successfully
- Jobs generated correctly
- Test build successful
Maintenance
- Regular backups configured
- Monitoring enabled
- Security audit completed
- Documentation updated
- Team trained
Maintained by the DevOps Team
Quick reference for common tasks
Related Documentation
More from Tools
Architecture Documentation - Jenkins as Code
Comprehensive architecture guide for Jenkins as Code automation framework
Best Practices Guide - Jenkins as Code
Recommended practices for using Jenkins as Code automation framework
DevOps as a Service - Automated CI/CD Management
Transforming Jenkins from a bottleneck to a self-service platform for develop...
JobGenie - Complete Job Creation Guide
Step-by-step guide to creating and configuring Jenkins jobs using JobGenie YA...
JobGenie - Complete Guide
Your friendly Jenkins job generator - Comprehensive guide to JobGenie job gen...
Jenkins as Code - Complete Setup Guide
Step-by-step guide to set up Jenkins as Code with plugins, access control, an...
Jenkins as Code - Enterprise CI/CD Automation
Complete Jenkins automation framework with Infrastructure as Code, Configurat...
BG Deployer
Automated blue-green deployment for zero-downtime AWS releases
DevOps Tools & Utilities | Hari Prasad
Custom-built DevOps tools for automation, monitoring, deployment, and security
JobGenie Getting Started
Your DevOps Superpower Unleashed - Transform CI/CD with YAML-driven Jenkins j...
JobGenie
Your DevOps Superpower Unleashed - Transform CI/CD with YAML-driven Jenkins j...
mCert
SSL certificate monitoring with Slack/email alerts & Telegram
mTracker
Real-time Linux user activity monitoring with Slack notifications
mWatcher
Server health monitoring for CPU, memory, disk with alerting
Sample DevOps Tool Documentation
A comprehensive guide to using our sample DevOps tool for automation and moni...
Typography Demo
Demonstration of enhanced typography features in the documentation template
Related Blog Posts
JobGenie: Transform Jenkins Job Creation with Jobs as Code
Learn how to integrate JobGenie into your existing Jenkins instance to create jobs as code using ...
OpenResty Production Setup: Supercharge with Lua-Based Metrics and Monitoring
Complete guide to deploying production-ready OpenResty with advanced Lua-based metrics collection...
KEDA on EKS: Complete Guide to Event-Driven Autoscaling with Real-World Examples
Master KEDA implementation on Amazon EKS with comprehensive examples for multiple scaling scenari...
Related Tools & Projects
BG Deployer
Automated blue-green deployment for zero-downtime AWS releases
mCert
SSL certificate monitoring with Slack/email alerts & Telegram
mTracker
Real-time Linux user activity monitoring with Slack notifications
mWatcher
Server health monitoring for CPU, memory, disk with alerting
gCrypt
Git-crypt wrapper for secure file encryption & access management
Interactive Tools
AWS VPC Designer, EKS Cost Calculator, and more utilities
External Resources
Quick Actions
Found this helpful?
Help us improve this documentation by sharing your feedback or suggesting improvements.