Run a template | Infrastructure as Code | Northflank Application docs
v1

Infrastructure as Code /

Run a template

You can run a template manually from either your account templates page or a project templates page. Only templates related to the project will appear in the project templates view, you can see all your templates in an account from the account templates page.

Open the template you want to use and click run to start a template run. In the project view the run button appears in the header, and in your account view it will appear in the template form.

View run status and history

When you run a template it will be scheduled to run, and enter the pending state.

It will shortly enter the running state, where it will begin running through the workflows defined in the template. You can see the status of each template, as well as the repository and file if GitOps is enabled.

Each of your individual templates contains a list of template runs that display the project the template is related to, the status of the template run, the commit hash (if the template run was triggered by a commit to a repository), and the time the template run was triggered.

View template run

You can click on a template run to view the status of the components of your template, including creating/updating the project, overall workflows, and resources within individual workflows. Each node will indicate the state it is in, which can help you debug templates that are taking longer than expected to complete, or failing.

Each node can be expanded to view the template JSON for running nodes, and successful or failed nodes will also contain a response object from the Northflank API. Nodes can also receive a retries object, detailing the number of attempts and the time of the next attempt.

The response for a node from a template run in the Northflank application

Template node states

Workflows and nodes can have the following states:

Pending: the node or workflow will run when previous steps are executed successfully

Running: the node or workflow is currently being executed

Waiting: the node is waiting for an action to be completed, will eventually timeout unless it receives a successful response

Retrying: the node has failed on previous runs, but is being executed again (up to 3 attempts)

Success: the node or workflow has completed successfully

Failed: the node or workflow has failed to execute, or exceeded 3 retries

Run a template automatically

You can enable run a template automatically so that any changes made to the template made in the Northflank application, API, or the template in a repository (if GitOps is enabled) will trigger a template run.

warning

As your modified template will run as soon as it's updated, make sure your changes are as intended before saving or pushing to the repository, especially if the template affects your production environment.

© 2024 Northflank Ltd. All rights reserved.