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

  1. Open your codefresh.yml file and add a new step:
     title: "Launch full composition with latest images"
     type: launch-composition
     composition: your-composition-name
     fail_fast: false
  2. Commit and push the changes to Git repository.
  3. Build your service with Codefresh.
  4. 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 master branch:

  1. Open your codefresh.yml file and add to the launch_composition_step the following:
         - master
  2. Commit and push changes to your Git repository’s master branch.
  3. Build your service with Codefresh on branch master.
  4. Create a new branch and push it to your Git repository under a new branch.
  5. Build your service with Codefresh on the new branch.
  6. When the build completes execution, open its log.
    You should see something similar to the example below.

Launch environment on single branch

Launch environment on single branch

Codefresh YAML for pipeline definitions
Creating compositions
Integration tests
Service containers