v1

Run /

Run an image once or on a schedule

You can run code from a Git registry or an image from a container registry as a job that will terminate after the container has finished running. You can create either a manual job, to run once whenever you trigger it, or a cron job to run on a schedule.

You can create a job from the following sources:

From the job overview you can run manual jobs, or pause and resume scheduled jobs.

Configure CI/CD for a job

Continuous integration (CI) is available to your jobs created with version control as their source. When CI is active on your job, every new commit to the tracked branch of the linked repository will automatically result in a new build. You can change the repository and branch from the build options page.

Continuous delivery (CD) is available on your jobs that have version control or a Northflank build service as their source. When CD is active new job runs will automatically use the latest available build.

The schedule for cron jobs can be toggled between inactive and active. If a job is inactive it will still build the latest commits (if CI is enabled), but it will not run the build.

Pausing a job will disable CI/CD and, for scheduled jobs, stop it from running on a schedule.

Run on image change

You can configure a job to run, or not run, when the source image is changed. You can set this when creating the job, and change it from the job settings page. The following options are available:

  • Never: the job will not automatically run when the image changes. The job will continue to run on a schedule, or when run manually, and the image deployed will be according to the CI/CD configuration
  • CD & pipeline promotion: the job will be triggered to run if a build finishes and CD is enabled, or if an image is promoted to the job via a pipeline
  • Always: the job will run every time the image is deployed via the UI, if a build finishes and CD is enabled, or if an image is promoted via a pipeline

Set the cron schedule and concurrency policy

For scheduled cron jobs you must set a schedule and concurrency policy to dictate when the job will run.

Job schedule

The job schedule is a cron expression. It consists of five fields representing the time at which to execute a specified command.

* * * * *
| | | | |
| | | | |___ day of week (0-6) (Sunday is 0)
| | | |_____ month (1-12)
| | |_______ day of month (1-31)
| |_________ hour (0-23)
|___________ minute (0-59)

For simple cron expressions you have option to use the following variables: @yearly, @annually, @monthly, @weekly, @daily or @hourly.

Concurrency policy

Choose whether to allow this job to run while another instance of the job is running, or to replace the currently running instance.

  • Allow will enable multiple instances of this job to run.
  • Forbid will keep the current instance of the job running and stop a new instance from being run.
  • Replace will terminate any currently running instance of the job and start a new one.

The concurrency policy does not apply when initiating a job run manually.

Set the retry and time limit

Retry limit

You can specify the maximum number of attempts to run a job before it is marked as failed.

Time limit

You can specify (in seconds) the maximum amount of time for a job to run, whether it has failed or not. This will take precedence over the Retry Limit.

For example, if you set a Retry Limit of 6 and a Time Limit of 480, the job will terminate after 8 minutes regardless of how many times it attempted to run.

© 2022 Northflank Ltd. All rights reserved.