backstage / backstage

Backstage is an open framework for building developer portals
https://backstage.io/
Apache License 2.0
26.73k stars 5.52k forks source link

🐛 Bug Report: Scaffolder template - If statement in output spec no applied #24805

Open gabriel-farache opened 2 weeks ago

gabriel-farache commented 2 weeks ago

📜 Description

In the output field of the template spec, if statement are not applied:

output:
    links:
      - if: ${{ parameters.CI === "Yes" }}
        title: Title
        url: URL

With the above spec, the link is always displayed even if CI is not equal to Yes

👍 Expected behavior

THe if statement should be matched and the link should only be applied/displayed if the condition matches

👎 Actual Behavior with Screenshots

The link is displayed no matter if the condition is matched.

👟 Reproduction steps

Create a template with the following or similar output spec:

output:
    links:
      - if: ${{ parameters.CI === "Yes" }}
        title: Title
        url: URL

📃 Provide the context for the Bug.

No response

🖥️ Your Environment

No response

👀 Have you spent some time to check if this bug has been raised before?

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

None

benjdlambert commented 2 weeks ago

Hey :wave: Thanks for raising this!

Unfortunately this isn't a bug, more of a feature request as the if option isn't supported on the outputs yet. Think it seems like a good idea though to be able to implement this.

The output object however is pretty unstructured, so wondering how best to implement this. The links part is standard, but there could be other properties in there so how do we best carry the if option into those blocks too, could be tricky.