Dynamic preview environments
Preview test environments
If your service is one of many microservices, after running automated tests on your service, you would probably want to check the new service with your whole system. In this case, you can launch the composition of your system as part of your build, and at the end of the build, open the composition.
Complete the tutorials for:
Launch the composition
- Open your
codefresh.ymlfile and add a new step:
launch_composition_step: title: "Launch full composition with latest images" type: launch-composition composition: your-composition-name fail_fast: false
- Commit and push the changes to Git repository.
- Build your service with Codefresh.
- In the Codefresh UI, from the Artifacts section on the sidebar, select Compositions, and then select the Running Compositions tab.
The new preview environment is displayed in the list of Running Compositions.
Launch an environment on single branch
There is a limit to the number of environments you can run concurrently. That’s why it’s a good practice to launch the composition only on a certain condition. Usually the most relevant condition is the branch, since you probably want your environment to be updated on the main branch.
The following instructions describe how to launch the environment for only the
- Open your
codefresh.ymlfile and add to the
when: branch: only: - master
- Commit and push changes to your Git repository’s
- Build your service with Codefresh on branch
- Create a new branch and push it to your Git repository under a new branch.
- Build your service with Codefresh on the new branch.
- When the build completes execution, open its log.
You should see something similar to the example below.