Creating compositions

Create environment configurations in Codefresh

Compositions can be launched as part of a unit test step, an integration test step, or to run an image for manual testing. You can create compositions from scratch or import an existing docker-compose.yml file.

Create composition

  1. In the Codefresh UI, from Artifacts in the sidebar, select Compositions.
  2. Click Create Composition.

Add composition

1.In the Composition Name text box, type a name for your composition, and click Next.

Composition name

Composition name
  1. Select the type of composition to create:
    • From file in repo: Start a new composition from a Docker Compose file in your repository.
    • From template: Use a template as a starting point for the composition, if your repository doesn’t include a docker-compose.yml file.
    • Empty composition: Create a composition from scratch.

Composition starting point

Composition starting point
  1. Click Next, and continue with one of the following:

From file in repo

Start a new composition from a Docker Compose file in your repository.

Add composition from file in repo

Add composition from file in repo
  1. To search for the repo, in the search box, type the name of the repository.
    OR
    Click Add by URL, and then enter the URL of the repo.
  2. From the Branch dropdown, select a branch for the first build.
  3. Click Next.
  4. Enter the path to docker-compose.yml.
    By default, Codefresh searches for your docker-compose.yml at the root level of your repository, for the name docker-compose.yml. If your docker-compose.yml is in a subdirectory, provide the path as well, for example, ./foo/bar/docker-compose.yml.

Path to Compose file

Path to Compose file
  1. Click Next.

    NOTE
    We don’t support the build property of Docker Compose. We will replace it with images automatically using a pipeline that is automatically created.

Replacing build with image

Replacing build with image
  1. Click Create. Once ready, your composition is displayed in the Compositions list.

Composition list

Composition list

From template

If your repository doesn’t include a docker-compose.yml file, use one of our templates to see how it works.

  1. Choose the template.
  2. Click Create.

 Select composition template

Select composition template

You will see the Composition editor, where you can tweak the template as needed, and then launch the composition to see results.

Edit selected template

Edit selected template

TIP
To launch this composition, click the rocket icon.

Empty composition

Create a composition from scratch.

  1. To add a service, click the Add Service button.
    You can add existing services, or provide the name for the Docker image to be pulled from the Docker registry.

Empty composition

Empty composition
  1. (Optional) Click Edit, and modify the content based on Docker Compose YAML .
  2. Click Save on the upper-right corner.

Working with existing compositions

You can edit any composition you created, regardless of the method used to create it, by selecting it from the Compositions list. Edit as needed in the YAML editor.

Edit existing composition

Edit existing composition

Manually launching compositions

When you are ready with the composition, launch it to inspect your application. Launching a composition creates a temporary test environment in your Codefresh account that you can use to inspect your application.

  1. In the Codefresh UI, from Artifacts in the sidebar, select Compositions.
  2. From the list, select the composition to launch.

Composition list

Composition list
  1. Click the Launch icon.

Launch composition

Launch composition
  1. To verify that the launch completed successfully, review the log.

Composition log

Composition log

Sharing the environment URL

View a record for the running environment and all containers for the environment in the Running Compositions tab.

  1. In the Codefresh UI, from Artifacts in the sidebar, select Compositions.
  2. Click Running Compositions.

Active test environments

Active test environments
  1. To share your environment with your team, click the Hashtag icon.

Link for sharing environment

Link for sharing environment

Unit tests
Integration tests
Creating test reports