Jenkins Pipeline
This directory contains Jenkins pipeline configuration using Jenkinsfile.
Setup
Install Jenkins (if not already installed):
- Local: Use Docker or install directly
- Server: Follow Jenkins installation guide
Install Required Plugins:
- Pipeline
- Docker Pipeline
- Kubernetes
- Git
- AWS Steps (optional)
Configure Credentials (Manage Jenkins > Credentials):
- AWS Access Key ID and Secret Access Key
- Docker Registry credentials (if needed)
- Kubernetes kubeconfig (if deploying to K8s)
Create Pipeline:
- New Item > Pipeline
- Select "Pipeline script from SCM"
- Set SCM to Git
- Point to repository with Jenkinsfile
- Script Path:
labs/03-cicd-pipelines/jenkins/Jenkinsfile
Configure Environment Variables:
AWS_REGION: AWS region (default: us-west-2)AWS_ACCOUNT_ID: Your AWS account IDEKS_CLUSTER_NAME: EKS cluster name (if deploying)
Pipeline Stages
- Checkout: Get source code
- Test: Run unit and integration tests in parallel
- Build: Build and push Docker image to ECR
- Security Scan: Scan image for vulnerabilities
- Deploy Staging: Deploy to staging environment
- Deploy Production: Manual approval required
Usage
- Build automatically on push (if webhook configured)
- Or trigger manually from Jenkins UI
- Production deployment requires manual approval
Customization
Edit Jenkinsfile to:
- Add additional stages
- Modify test commands
- Change deployment strategies
- Add notifications