|
1 | | -import { Tabs, TabsList, TabsTrigger, TabsContent, TabsContentWrapper } from "docs-ui" |
| 1 | +import { Tabs, TabsList, TabsTrigger, TabsContent, TabsContentWrapper, InlineIcon } from "docs-ui" |
| 2 | +import { XMark } from "@medusajs/icons" |
2 | 3 |
|
3 | 4 | export const metadata = { |
4 | 5 | title: `Preview Environments`, |
@@ -149,22 +150,31 @@ While you can manage each preview environment's settings individually, you can a |
149 | 150 |
|
150 | 151 | For example, you can define environment variables that are common to all preview environments. |
151 | 152 |
|
| 153 | +Shared settings are also useful to specify when preview environments are created for pull requests. For example, you can disable preview environments for pull requests of specific branches and authors. |
| 154 | + |
152 | 155 | To manage the shared settings for preview environments: |
153 | 156 |
|
154 | | -1. In a [project's dashboard](../../projects/page.mdx#open-project-dashboard), click on the "Settings" tab. |
155 | | -2. Choose the "Previews" tab from the sidebar. |
156 | | -3. In the Previews settings, you can: |
157 | | - - Manage environment variables, as explained in the [Manage Environment Variables](../environment-variables/page.mdx) guide. All preview environments created after making changes will inherit these variables. |
158 | | - - Specify which database to create the preview environment's database from. By default, a new database will be created from the Production environment's database. You can change this to use a different environment's database, such as Staging. |
| 157 | +1. In a [project's dashboard](../../projects/page.mdx#open-project-dashboard), click on the **Settings** tab. |
| 158 | +2. Choose **Previews** from the sidebar. |
| 159 | +3. This opens the shared settings page for both Backend and Storefront. You can change the view by toggling the **Backend** or **Storefront** tabs. It includes the following settings: |
| 160 | + - **Environment variables**: Manage environment variables shared across all preview environments, as explained in the [Manage Environment Variables](../environment-variables/page.mdx) guide. All preview environments created after making changes will inherit these variables. |
| 161 | + - **Provisioning Rules**: (Backend tab) Define conditions that control when a preview environment is provisioned for a pull request (PR). To add new conditions: |
| 162 | + - Click **Add condition**. |
| 163 | + - Choose a condition parameter from the first dropdown. It can be **Author** to apply conditions based on who opened the PR, **Branch** to apply conditions on the PR's branch, or **PR title**, **PR description**, and **PR label** to apply conditions on these PR attributes. |
| 164 | + - Choose a condition operator from the second dropdown to specify how the condition value matches. It can be **is** for equality matching, **is not** for inequality matching, and **contains** for specifying a value that is contained in the parameter's value. |
| 165 | + - Choose a condition value in the last input that is used for the condition matching. For example, enter the name of the author that the PR must have to provision a preview (**Author** **is** **example**), text that must be contained in a PR description (**PR description** **contains** **create preview**), or a branch name that preview environment must not be provisioned for (**Branch** **is not** **docs**) |
| 166 | + - To remove an existing or new condition, click the <InlineIcon Icon={XMark} alt="X" /> icon. |
| 167 | + - If you add multiple conditions, you can change how the conditions are joined. Choose **and** to match all conditions; choose **or** to match one of the conditions. |
| 168 | + - Once you're done, click the **Save** button. |
| 169 | + - **Deploy Rules**: Define conditions that control when a provisioned preview environment is deployed. Available fields are **Author** and **Commit message**. Use the same operators and logic options as provisioning rules. Click **Save** to apply changes. |
| 170 | + - **Database base branch**: Specify which environment's database to create the preview environment's database from. By default, a new database is created from the Production environment's database. You can change this to use a different environment's database, such as Staging. |
159 | 171 |
|
160 | 172 | <Note> |
161 | 173 |
|
162 | 174 | Making changes to the shared settings will affect all preview environments created after the changes. Existing preview environments will not be affected by the changes. |
163 | 175 |
|
164 | 176 | </Note> |
165 | 177 |
|
166 | | - |
167 | | - |
168 | 178 | --- |
169 | 179 |
|
170 | 180 | ## Preview Environment's Database |
|
0 commit comments