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.

Pre-Requisites

You should already have done the tutorial

Launching The Composition

  1. Open your codefresh.yml file and add a new step:

YAML

launch_composition_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. Go to the environment page

Screen Shot 2017-01-19 at 09.27.53.png

  1. You can see the new environment on this page

Launching environment only on one branch

Always remember that the number of your environment is limited. 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 who to launch the environment for only the master branch:

  1. Open your codefresh.yml file and add to the ‘launch_composition_step` the following:

YAML

when:
    branch:
      only:
        - 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 with the new branch
  1. When the build would finish, open the it’s log. You should see something like:

Screen Shot 2017-01-19 at 10.29.16.png