# devops-deploy-job > Scaffold job deployment configuration. Keywords: deploy, job, devops, scaffolding. - Author: willyu1007 - Repository: willyu1007/AI_First_Template - Version: 20251224182030 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-07 - Source: https://github.com/willyu1007/AI_First_Template - Web: https://mule.run/skillshub/@@willyu1007/AI_First_Template~devops-deploy-job:20251224182030 --- --- name: devops-deploy-job description: "Scaffold job deployment configuration. Keywords: deploy, job, devops, scaffolding." --- # Scaffold: Job Deployment This document is an entrypoint for job deployment scaffolding. The step-by-step flow is in /.system/skills/ssot/repo/scaffolding/devops-deploy-job/SKILL.md. --- ## 1. Purpose & Scope **Purpose**: Generate deployment skeleton for running a batch job in target environments (Kubernetes CronJob, scheduled tasks, etc.). **Scope**: - Creates job deployment configuration files - Sets up schedule configuration - Generates deployment scripts - Records deployment decisions in workdocs **Out of scope**: - Actual deployment execution (requires human with credentials) - Packaging/Docker build (see devops_packaging_job.md) - HTTP service deployment (see devops_deploy_service.md) - Infrastructure provisioning --- ## 2. Inputs & Preconditions ### Required Inputs | Parameter | Type | Description | |-----------|------|-------------| | `job_name` | string | Job identifier (matches packaging) | | `environment` | string | Target environment: `dev`, `staging`, `prod` | ### Optional Inputs | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `image_tag` | string | `latest` | Docker image tag | | `schedule` | string | "" | Cron schedule (e.g., `0 2 * * *`) | | `resources` | object | {} | CPU/memory limits | | `env_vars` | object | {} | Environment variables | | `secrets` | array | [] | Secret references | | `concurrency_policy` | string | `Forbid` | CronJob concurrency: `Allow`, `Forbid`, `Replace` | | `restart_policy` | string | `OnFailure` | Pod restart policy | ### Preconditions 1. Job has been packaged (see devops_packaging_job.md) 2. `/ops/deploy/` directory exists 3. Human has deployment credentials for target environment 4. Target environment infrastructure exists --- ## 3. Step-by-Step Flow (AI + Human) See /.system/skills/ssot/repo/scaffolding/devops-deploy-job/SKILL.md. --- ## 4. Tools & Scripts | Tool | Purpose | |------|---------| | `scripts/devops/scaffold/devops_deploy_job.py` | Orchestrator script | | `/ops/deploy/scripts/deploy.sh` | Generated deploy script | --- ## 5. Outputs & Side Effects ### Files Created ``` ops/deploy/jobs/// cronjob.yaml # Kubernetes CronJob configmap.yaml # ConfigMap (if env_vars) config.yaml # Deployment configuration deploy.sh # Deployment script run-once.sh # Manual trigger script README.md # Human-facing documentation ``` ### Kubernetes CronJob Template ```yaml # Auto-generated by devops_deploy_job scaffold apiVersion: batch/v1 kind: CronJob metadata: name: namespace: spec: schedule: "" concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 jobTemplate: spec: backoffLimit: 3 activeDeadlineSeconds: 3600 template: spec: restartPolicy: OnFailure containers: - name: image: /: resources: limits: cpu: "1000m" memory: "1Gi" requests: cpu: "100m" memory: "256Mi" ``` ### Configuration File ```yaml job_name: environment: image_tag: latest schedule: "0 2 * * *" concurrency_policy: Forbid restart_policy: OnFailure timeout: 3600 backoff_limit: 3 resources: limits: cpu: "1000m" memory: "1Gi" requests: cpu: "100m" memory: "256Mi" env_vars: {} secrets: [] ``` --- ## 6. Safety & Rollback ### Safety Measures - `--dry-run` always available for preview - Human approval required before execution - No actual deployment during scaffold - Credentials not stored in generated files - Production jobs require additional approval ### Rollback Procedure For job suspension (human executes): ```bash kubectl patch cronjob/ -n -p '{"spec":{"suspend":true}}' ``` For scaffold rollback: 1. Delete the deployment directory: ```bash rm -rf ops/deploy/jobs/// ``` --- ## 7. Job Operations (Human Required) After scaffold, human manages job: ### Deploy CronJob ```bash kubectl apply -f ops/deploy/jobs/// ``` ### Trigger Manual Run ```bash kubectl create job --from=cronjob/ -manual-$(date +%s) -n ``` ### Check Job Status ```bash kubectl get cronjobs -n kubectl get jobs -n -l app= kubectl logs -n job/-xxx ``` ### Suspend/Resume Job ```bash # Suspend kubectl patch cronjob/ -n -p '{"spec":{"suspend":true}}' # Resume kubectl patch cronjob/ -n -p '{"spec":{"suspend":false}}' ``` --- ## 8. Related Documents - `/.system/skills/ssot/repo/scaffolding/devops-deploy-job/templates/deploy_template.md` - Deployment knowledge template - `/.system/skills/ssot/repo/scaffolding/devops-packaging-job/SKILL.md` - Job packaging scaffold - `/.system/skills/ssot/repo/scaffolding/devops-deploy-service/SKILL.md` - Service deployment scaffold - `/ops/deploy/AGENTS.md` - Deployment strategy