Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate template variables in dependencies section during lint #2672

Open
Tracked by #2649
carolynvs opened this issue Mar 30, 2023 · 0 comments
Open
Tracked by #2649

Validate template variables in dependencies section during lint #2672

carolynvs opened this issue Mar 30, 2023 · 0 comments
Labels
pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal

Comments

@carolynvs
Copy link
Member

carolynvs commented Mar 30, 2023

When a bundle that uses advanced dependencies is built, the linter should check that all template variables used in the dependencies section of porter.yaml are in our list of available template variables.

We support the following variables:

  • bundle.*
  • installation.*
  • outputs.OUTPUT_NAME only from the context of a dependency's defined output mappings.

Example:

parameters:
- name: stuff

credentials:
- name: token

outputs:
- name: connstr
  
dependencies:
  requires:
  - name: mysql
    parameters:
      dbstuff: ${bundle.parameters.stuff}
    credentials:
      token: ${bundle.credentials.token}
    outputs:
      connstr: https://${outputs.user}:${outputs.password}@${bundle.parameters.host}:${outputs.port}

In the example above, we would check that the stuff parameter and the token credential are defined on the parent bundle. We would also check that the mysql dependency has an output named port, user and password, and that the parent bundle has a parameter named host.

New outputs variable

The outputs variable is new and is a shorthand for accessing an existing variable, bundle.dependencies.CURRENT_DEP.outputs.OUTPUT_NAME.

Each output mapped for a dependency must be evaluated separately because ${outputs.OUTPUT_NAME} can only be validated in the context of the dependency in which it is defined.

ℹ️ Read PEP003 - Advanced Dependencies for context about how dependencies should work, design details, and notes about desired behavior.

@carolynvs carolynvs changed the title Identify template variables used in the dependency section and validate that they are resolvable Validate template variables in dependencies section during lint Mar 30, 2023
@carolynvs carolynvs added the pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal
Projects
No open projects
Status: No status
Development

No branches or pull requests

1 participant