Automatic preview environments

If your service is one of many micro-services, after all your automatic 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. At the end of this build you would be able to open the composition.


You should already have done the tutorials for the basic pipeline and temporary environments.

Launching 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
  1. Commit and push the changes to git repository
  1. Build your service with Codefresh
  1. Click on Compositions on the left sidebar and then choose the Running Compositions tab.
  1. You will see the new preview environment on this page

Launching an environment only on one branch

There is a limit to the number environments you can run concurrently. That’s why it’s a good practice to launch the the composition only on certain condition. Usually the most relevant condition is the branch, since you probably want your environment to be updated by you main branch.

The following instructions would explain 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
  1. Commit and push changes to your git repository master branch.
  1. Build your service with codefresh on branch master
  1. Create a new branch and push it to your git repository under a new branch
  1. Build your service with codefresh on the new branch
  1. When the build would finish, open the its log. You should see something like:

Screen Shot 2017-01-19 at 10.29.16.png