Service Composition can't read docker-compose.yml file

NOTE: This is codefresh running on-prem on version 2.0.17

Hi,

I am trying to use a docker-compose.yml file in the service: composition step like so

service:
  composition: <path-to-file>/docker-compose-postgres.yml

However, no matter what I try I get the same error

 Message             Failed to prepare composition: services                                                                                                                                                                     
 Caused by           Failed to read file /codefresh/volume/<path-to-file>/docker-compose-postgres.yml 

I have tried setting the working directory, copying the docker-compose to the top level, and changing its access permissions but I keep getting the same error.

I have verified that the folder path and file exist.

Full step

integration_tests:
  title: Integration tests
  stage: code build & test
  image: ${{build image}}
  # working_directory: ${{clone}} get the error regardless if I use this
  environment:
    - ENVIRONMENT_DATASOURCE_POSTGRESHOST=my_postgres
    - ENVIRONMENT_RABBITMQ_ADDRESSES=rabbitmq:5672
    - ENVIRONMENT_RABBITMQ_PASSWORD=guest
  commands: 
    - ${{mvn_cmd}}
  services:
    composition: <path-to-file>/docker-compose-postgres.yml
    readiness:
      timeoutSeconds: 30
      periodSeconds: 15
      image: <image>
      commands:
        - "pg_isready -h my_postgres -U postgres"
  when:
    condition:
      all:
        integrationTestNotDisabled: '"${{DISABLE_INTEGRATION_TEST}}" != "true"'
        developOrReleaseBranch: "match('${{CF_BRANCH}}', '^release\/.*|^develop*|^${{OVERRIDE_BRANCH}}', true)"

Docker

name: integration_tests_postgres
services:
  my_postgres:
    image: "<postgres-image>"
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    volumes:
      - '${CF_VOLUME_NAME}:${CF_VOLUME_PATH}'
    command:
        - sh -c 'ln -s /codefresh/volume/${CF_REPO_NAME}/init.sql /docker-entrypoint-initdb.d/ &&  /usr/local/bin/docker-entrypoint.sh -c "shared_buffers=256MB" -c "max_connections=200"'
  rabbitmq:
    image: "<rabbitmq-image>"
    environment:
      - RABBITMQ_DEFAULT_USER=guest
      - RABBITMQ_DEFAULT_PASS=guest
    ports:
      - "5672:5672"
      - "15672:15672"

I have read through Best practices for config reusability? - #5 by Miguel_Medina. However none of the solutions proposed seem to work for me.

Hello

It is a bit hard to diagnose this just by looking at the yaml file

First of all the working_directory: ${{clone}} will only work if your clone step is actually named clone. Is this true in your case?

Alternatively you can specify the full path there working_directory: /codefresh/volume/my-project/my-path and see if it works for you.

Yet another idea is to place a breakpoint in the pipeline to verify that the file is indeed where you expect it to be Debugging pipelines ยท Codefresh | Docs

If you use the on-prem version of Codefresh, it probably means that you have dedicated support help and priority from our support team.

I would be much easier to contact our support team and they will guide you better than the community forum.