RunwayJob
This type of workload deploys a Cloud Run Job. Jobs can be triggered on a schedule and/or on-demand (manually triggered CI job).
You can only define a single job per Runway workload. If you need to define multiple jobs, you will have to create a new Runway service in the provisioner for every job.
Example
Unlike services (which can be deployed to multiple
regions), jobs can only be deployed and executed in a single region
(default: us-east1
).
Refer to the schema for all supported configuration options.
Schedule
To configure a job to run on a schedule, simple set the spec.schedule.cron
attribute to any valid
crontab compatible
string as shown in the example above.
To pause a cronjob, simply set spec.schedule.paused
to true
:
On-demand
To have the ability to trigger a job on-demand, you will need to add a job to
your .gitlab-ci.yml
similar to the following:
Replace example-job-431wm0
with your Runway service ID for your desired job.
You will see two new jobs appear in your pipelines:
To actually trigger these jobs manually, you need to expand the downstream jobs and click on the play button:
Overriding job arguments
If you want to be able to trigger on-demand jobs on your Docker image with
different arguments, you can make use of the RUNWAY_JOB_OVERRIDE_ARGS
variable and avoid creating a Runway service for each job that you want to
trigger with different arguments:
Instead of:
… you can achieve the same thing using RUNWAY_JOB_OVERRIDE_ARGS
and just one
service:
Limitations
-
Jobs do not have access to network connectivity to GitLab internal-facing endpoints. For example: you cannot run a job that hits the alert manager endpoint as this is an internal-only facing endpoint.
-
By default, each task runs for a maximum of 10 minutes (configurable via
spec.timeout
in seconds), however the max value for the timeout (i.e., maximum runtime allowed) is 24 hours (86400
seconds).
Links
- Google documentation for best practices around error-handling.