Skip to content

Update component deps calculation - #177

Merged
Andriy Knysh (aknysh) merged 4 commits into
masterfrom
update-deps
Jul 17, 2022
Merged

Andriy Knysh (aknysh) merged 4 commits into
masterfrom
update-deps

Conversation

@aknysh

@aknysh Andriy Knysh (aknysh) commented Jul 17, 2022 •

Copy link
Copy Markdown
Member

what

  • Update component deps calculation
  • Add tests to check this

why

  • When a component defines inherited YAML base components in metadata.inherits and the stack imported the YAML file(s) where the inherited YAML components are defined, add the imported YAML files to the deps labels
  • Before this fix, only the base terraform component was used in the deps calculation. All imported YAML files where the base YAML components were defined were not included in the deps labels (and the YAML files were missed from the Spacelift dependencies)

For example:

components:
  terraform:
    "test/test-component-override-3":
       metadata:
        component: "test/test-component"
        inherits:
          - "test/test-component-override"
          - "test/test-component-override-2"
          - "mixin/test-1"
          - "mixin/test-2"

In the above config, test/test-component-override-3" inherits test/test-component-override-2 YAML component.
Part of the config for test/test-component-override-2 YAML component is defined in service-1-override-2.yaml file:

components:
  terraform:
    "test/test-component-override-2":
      vars:
        service_1_name: "service-1-override-2"

the service-1-override-2.yaml file was not included in the deps labels because the code only checked for the base terraform component test/test-component in all imports.

After this fix, the code checks all imported files for the base terraform component and ALL base YAML components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants