Jobs are the executable units of your pipelines that can execute any DevOps activity. A simple way to think of it is, if something can execute in the shell of your laptop, it can execute as a Job.
Jobs take Inputs in the form of Resources, execute tasks that perform the operations necessary and then produce a result i.e. Output(s). Now these Outputs can become Inputs to other jobs and so on forming a dependency-based, event-driven DevOps Assembly Line.
Please note that each job runs on a separate node, but can share information with other jobs.
Typical examples of jobs are:
- Execute Continuous Integration (CI) on a repository
- Build, Test and Push Docker images to registries like Docker Hub. Quay, JFrog etc.
- Build deployable machine images with tools like Packer
- Provisioning infrastructure using various automation tools like Ansible, Terraform, Chef, Puppet, etc.
- Deploy applications to Container Orchestration Services like Kubernetes, Amazon ECS, Google Container Engine, Azure Container Service,
- Deploy an application version to a VM cluster
- Execute a functional/integration test suite
- Create immutable service definitions so that applications can roll-forward and roll-back
- Deploy applications with Continuous Deployment(CD) tools like Capistrano, Distelli, Ansible etc.
- Implementing deployment strategies like Blue/Green, Upgrades and Replace
- Perform timely backups of DB, key-value stores etc.
- Create or update an application release version
Jobs are defined in
shippable.yml as shown below:
jobs: - name: <string> type: <job type name> dependencyMode: <chrono/strict/immediate> steps: - IN: <job> - IN: <resource> - OUT: <resource> - TASK: - script: <any shell command> - script: <any shell command> flags: - <flag 1> - <flag 2>
For more information, read the jobs section of the anatomy of shippable.yml page.
When does a Job execute?
Jobs can be triggered in multiple ways, including both automated and manual triggers. For example, consider the configuration below for my-deploy:
In this configuration, Job-4 will be triggered in one of 4 ways:
- A previous job in the Assembly Line changes an
INresource, i.e. Job-4 will be triggered every time Job-3 updates resource-2.
INjob successfully completed execution, i.e. Job-4 will be triggered every time Job-2 succeeds. A couple of exceptions to this rule are:
- If any Jobs defined as
INs are currently processing, have queued builds or are in a failed state. So in the example above, if Job-1 is in failed state or is queued, Job-4 will not trigger even when Job-2 completes successfully.
- If the Job is in inconsistent state due to dependency failures
- If any Jobs defined as
- You commit to a trigger that is an
INfor the job, i.e. trigger-1 in this example
- Manual trigger: You right click on Job-4 in the SPOG UI and click on Run or Select Run for Job-4 in the Jobs list in the Grid view.
Job-1 will not trigger Job-4 automatically since the dotted line between them indicates that automatic trigger has been switched off. A dark gray border will appear on Job-4 after Job-1 runs until Job-4 is next triggered.
Please note that changing some resources like cluster, replicas, or dockerOptions manually through a yml commit will not automatically trigger a job. This behavior is meant to prevent unexpected pipeline behavior, since a single commit can contains changes to several resources and cause several trigger points in the pipeline. If you want your job to be triggered when resources are manually edited in the yml, you can add a trigger input for the job and include a change to the trigger resource in the commit every time you want to automatically run your job.
What happens when a Job executes?
When triggered, a Job does the following:
- Get the latest versions of
INresources or latest state information from an
INjob. If an input resource version is pinned, then use that version instead of latest.
- Replace any templated values in the
- Execute all commands to perform the activity. The set of commands depends on job type.
- Update all
Every time a job executes, a new immutable version is created. This makes it easy to 'replay' older job versions, though you should do this only after verifying that the old input values will not create problems in your Assembly Line.
Supported job types
Shippable supports the following jobs types:
|deploy||Deploy apps/services to Container Platforms or VM clusters|
|manifest||Create App/Service definition (configuration) that is immutable|
|provision||Provision specific resources needed by Container Orchestration Platforms|
|release||Release management for Apps/Services|
|runCI||Execute Shippable CI Job|
|runSh||Execute any Shell command or scripts or supported Command Line Interface commands|
If you need a job that is not listed above, send us an email at email@example.com