Deploy Template imports

andreas.fluer
andreas.fluer Spryker Customer Posts: 5 🧑🏻‍🚀 - Cadet

Hey all, two quick questions

  1. What are your opinions on this deploy file inheritance?
  2. Is it possible to import one deploy.yml file into another deploy.stage.yml file when both are on PROJECT ROOT (not in config/deploy-templates)

For Context — TL/DR:

I started to clean up my deploy files according to this documentation about the inheritance of templates. I'm DRY-ing up my multiple files and want to import another deploy.yml (not a template, but a 'root'-level deploy file), and can not find out how to do this. Furthermore, I cannot find ANY other example of how to structure these files.

I was now wondering if any of you are doing this or if there is a reason why this is a bad idea.

I have two deploy files on the project root level that should be the same, I want to keep one (for now) for backward compatibility purposes and I do not want to create a new template file for this as it just adds another import layer without no immediate value.

Cheers, Andy

Comments

  • andreas.fluer
    andreas.fluer Spryker Customer Posts: 5 🧑🏻‍🚀 - Cadet

    OK, this is a dead thread, but I wanted to share my findings anyway:

    1. Passing boolean parameters in yaml files is a bad idea because they are converted to strings and true !== 'true' (duh, but I had to learn it the hard way)
    2. Do not inherit the 'groups' section if you are on PaaS / AWS
      There is a script that checks your application list set in your deploy file.
      $(yq '.groups.*.applications' -o json deploy.yml | jq '.|keys[]' | tr '[:upper:]' '[:lower:]' | tr -d '"')
      This command returns null if you import the groups via delpoy-templates, thus the deployment fails.

    Maybe this helps someone in the future…

  • Oleksandr Myrnyi
    Oleksandr Myrnyi Sprykee Posts: 6 🧑🏻‍🚀 - Cadet

    Hi @andreas.fluer,

    > What are your opinions on this deploy file inheritance?

    I would refer to these as either 'override' or 'import' methods, rather than 'inheritance'

    > Is it possible to import one deploy.yml file into another deploy.stage.yml file when both are on PROJECT ROOT (not in config/deploy-templates)

    No, it should be possible to import the prepared template or section into another deploy file with environment-specific parameters but it should be only stored in the config/deploy-templates folder.

    version: '0.1'

    namespace: spryker
    tag: 'dev'

    environment: docker.prod

    imports:
    deploy.base.template.yml:
    parameters:
    parameter1: 'parameter1'
    parameterN: 'parameterN'

    Do not inherit the 'groups' section if you are on PaaS / AWS

    It looks like a bug that was already fixed in the previous version.
    The changes were at the build specs level.

    deployfile_app_list=$(yq '.groups.*.applications' -o json docker/deployment/$${SPRYKER_PROJECT_NAME}/project.yml | jq '.|keys[]' | tr '[:upper:]' '[:lower:]' | tr -d '"')