azukiapp/azk

On Azkfile, system.name resolves to children's system name instead of parent's.

Opened this issue · 3 comments

When extending a system that uses #{system.name} on any path on any mount, this value resolves to the children's name:

  apollo: {
    depends            : ['postgres'],
    image              : { docker: "jturolla/phoenix" },
    provision          : [
      "npm install",
      "mix deps.get",
      "mix ecto.create",
      "mix ecto.migrate",
    ],
    workdir            : "/azk/#{system.name}",
    shell              : "/bin/bash",
    command            : "mix phoenix.server --no-deps-check",
    wait               : { retry: 20, timeout: 2000 },
    mounts             : {
      '/azk/#{system.name}'               : path("./#{system.name}"),   // system.name becomes apollo-test when running the system below, breaking the app.
      '/azk/#{system.name}/deps'          : persistent("#{system.name}/deps"),
      '/azk/#{system.name}/_build'        : persistent("#{system.name}/_build"),
      '/root/.hex'                        : path(env.HOME + '/.hex'),
      '/azk/#{system.name}/node_modules'  : persistent("#{system.name}/node_modules"),
      '/azk/#{system.name}/web/static/js' : path("./#{system.name}/web/static/js"),
      '/azk/#{system.name}/web/static/css': path("./#{system.name}/web/static/css"),
    },
    scalable           : { "default": 1 },
    http               : {
      domains: [ "#{system.name}.#{azk.default_domain}" ]
    },
    ports              : { http: "4000" },
    envs               : { MIX_ENV: "dev" },
  },
  "apollo-test": {
    extends: "apollo",
    depends: ["postgres"],
    command: "exit 0",
    scalable: { default: 0, limit: 1 },
    http: false,
    wait: false,
    envs: {
      MIX_ENV: "test",
      HOST   : "#{system.name}.#{azk.default_domain}",
    },
  }

Yes, @jturolla, the extends just copy and merge everything as a separated system.
When you use #{system.name} apollo-test system the result is apollo-test.

Ok, I see. @gullitmiranda has explained to me. It is changing the extended system name. This is wrong.

@nuxlli discussed that with me on #azk at docke-br slack. The idea was to convert #{system.name} to #{parent.name} when in the context of a children. So #{system.name} would resolve to apollo when using apollo-test.

Although this is the case, idk if this is a bug or a design decision. Guess it needs discussion.