v1

Build /

Build code from a Git repository

Northflank offers different methods for building code from a Git repository:

  • You can manually or automatically build commits on specified branches or pull requests from a linked Git repository using a build service
  • You can build and deploy commits on a branch from a linked Git repository with continuous integration and delivery in a combined service
  • You can build commits on a branch from a linked Git repository manually or on a regular schedule using a job

Enabling CI will allow you to automatically build code when a new commit is pushed to a linked branch from your repository, or specific branches and/or pull requests. Built code can then be continuously deployed and added to a pipeline to create complex workflows.

You'll need an account on a Git provider that is linked to Northflank to get started.

Build from a repository

To build and run code from one branch on a repository you can use:

  • a combined service
  • a build service linked to a deployment service
  • a cron or manual job

Create a new service or job, select the repository you want to build from, then select the branch.

Once created your service will build an image for every new commit to the branches or pull requests it is monitoring, as long as CI is enabled.

Manually trigger a build

You can manually trigger a build by navigating to the branch or pull request to build from and selecting a commit to build.

You can find the list of branches and pull requests in the build service menu, or by clicking the build button in the build service header.

Northflank will begin building your commit, which may take several minutes. You can monitor the progress from the builds page and click through to view the logs for the build.

Build specific branches or pull requests

You can use a build service to build and run code from specific branches and/or pull requests by specifying build rules when creating a build service. You can edit the build rules of an existing build service on the build options page.

A build service will not build any branches or pull requests without specified build rules. By default, a build service will build from all pull requests (*) and the master branch.

Example build rules:

RegexResult
*Builds every branch or pull request
masterBuilds the branch or pull request called master
feature/*Builds every branch or pull request starting with release/
feature/testBuilds only the branch or pull request feature/test

Build a specific repository directory

If you have a single repository with multiple services, or your repository is structured so that your build context is not the root, you can specify the build context when creating or editing your services.

You can specify the set of files to be used in the build process by referring to a specific subdirectory relative to the root of your repository. To build all files from the root, use / as the build context or refer to a subdirectory such as /directory or /directory/subdirectory.

Learn more about contexts .

© 2022 Northflank Ltd. All rights reserved.