Checkout strategy
The checkout_strategy
directive in Terrateam allows you to specify how Terrateam performs a code checkout from the pull request.
Configuration
Checkout strategy is configured in the .terrateam/config.yml
file under the checkout_strategy
key. Here’s the default configuration:
Checkout strategy options
The checkout_strategy
key can be set to one of the following values:
Value | Description |
---|---|
merge | (Default) Terrateam will perform a merge of the pull request’s head commit into the base branch. This is equivalent to running git checkout <base_branch> followed by git merge <head_commit> . |
head | Terrateam will checkout the pull request’s head commit directly. This is equivalent to running git checkout <head_commit> . |
Examples
Using the default merge strategy
This configuration will use the default merge
strategy, where Terrateam will perform a merge of the pull request’s head commit into the base branch.
Using the head checkout strategy
This configuration will use the head
strategy, where Terrateam will checkout the pull request’s head commit directly.
Considerations
When choosing a checkout strategy, keep the following in mind:
- The
merge
strategy (default) is generally recommended, as it ensures that the changes being applied are compatible with the current state of the base branch. - The
head
strategy can be useful in situations where you want to test the changes in isolation, without considering any changes that may have been made to the base branch since the pull request was opened. - If you are using a custom workflow that includes steps that modify the working directory (e.g., running tests or linters), be aware that the checkout strategy can impact the files that are present in the working directory.