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/pipelines/jobs/JobGenie.groovy
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
def defaultConfigs = [
EKS_CLUSTER_NAME: "${PROJECT_NAME}-eks-${PROJECT_ENV}",
CICD_TEMPLATE_BASE: 'templates/cicd',
CICD_BASE: "${HOME_DIR}/jenkinsfiles",
VALUES_YMLBASE: "${HOME_DIR}/helm-values",
IMAGE_ECR: "${awsAccountId}.dkr.ecr.${region}.amazonaws.com",
GROUP: "v2",
ENV: "stage"
]
🎩 JobGenie Quick Examples
Simple Application Job
def jobGenie = [
"mcloud": [
[
APP_REPO: 'my-app',
APP_BRANCH: 'master',
appNames: ['my-service']
]
]
]
Multi-Service Job
def jobGenie = [
"mcloud": [
[
APP_REPO: 'monorepo',
APP_BRANCH: 'main',
appNames: ['service-a', 'service-b', 'service-c']
]
]
]
Custom Job with Parameters
def jobGenie = [
"mcloud": [
[
SERVICE: 'custom-service',
CICD_TEMPLATE_NAME: 'custom-template',
JOB_PARAMS: [
[ name: 'TAG', string: 'latest', description: 'Deployment tag' ],
[ name: 'ENV', choices: ['dev', 'prod'], description: 'Environment' ]
]
]
]
]
Advanced Configuration
def jobGenie = [
"mcloud": [
[
APP_REPO: 'my-app',
APP_BRANCH: 'develop',
appNames: ['my-service'],
DOCKER_BUILD_ARGS: 'ENV,TECHTEAM',
DOCKERFILE_PATH: 'services/Dockerfile',
SSH_KEYS: 'default:/var/lib/jenkins/.ssh/id_rsa',
MAVEN_VERSION: 'maven3.9.7',
JDK_VERSION: 'jdk21'
]
]
]
🔧 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
- Check
createjobflag:def globalConfigs = [ createjob: true ] - Verify JobGenie syntax:
def jobGenie = [ "mcloud": [ /* ... */ ] ] - Check seed job logs:
- View console output
- Look for errors
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
JobGenie.groovy:def jobGenie = [ "mcloud": [ [ APP_REPO: 'new-service', APP_BRANCH: 'develop', appNames: ['new-service-api'] ] ] ] - Commit and push:
git add amazon/mcloud/nonprod/pipelines/jobs/JobGenie.groovy git commit -m "Onboard new-service-api" git push origin feature/onboard-new-service - Run seed job:
- Navigate to:
amazon/mcloud/nonprod/0-mCloud-DevOps - Run with your branch
- Navigate to:
- Verify job created:
- Check:
amazon/mcloud/nonprod/deploy/v2/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
Related by Tags
No related documentation found by tags
Related Blog Posts
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...
AIOps: AI-Powered DevOps Automation and Intelligent Operations
Comprehensive guide to implementing AIOps - using AI and machine learning to transform DevOps pra...
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.