action icon indicating copy to clipboard operation
action copied to clipboard

Error using dependsOn in a feature

Open rynowak opened this issue 2 years ago • 2 comments

Summary

We're building a devcontainer feature that includes a dependsOn another feature. This is causing failures using @devcontainers/action but seems to work with the devcontainers CLI.

The documentation says that dependsOn is a preview feature. Is there something I need to do to opt-in to preview features?

Our feature definition is here: https://github.com/radius-project/radius/blob/ae9d95267ce52193ef3cab6ae121faf43dea5a8f/deploy/devcontainer-feature/src/radcli/devcontainer-feature.json

Successful output with CLI

I'm able to successfully package the feature with the CLI.

❯ devcontainer features package deploy/devcontainer-feature/src --output-folder ../../../testing -f
[550 ms] @devcontainers/cli 0.54.2. Node.js v21.3.0. darwin 23.1.0 arm64.
[550 ms] Packaging feature collection...
[551 ms] Processing feature: radcli...
[562 ms] Packaged 1 features!

Failing with actions

The failing workflow is here: https://github.com/radius-project/radius/actions/runs/7183715348/workflow

Here's an example run: https://github.com/radius-project/radius/actions/runs/7183715348/job/19563129086

Output:

Run devcontainers/action@v1
  with:
    publish-features: true
    base-path-to-features: ./deploy/devcontainer-feature/src
    generate-docs: false
    disable-schema-validation: false
    validate-only: false
    disable-repo-tagging: false
    publish-templates: false
  env:
    GITHUB_TOKEN: ***
Validating Feature metadata...
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/onCreateCommand" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/onCreateCommand/additionalProperties" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/updateContentCommand" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/updateContentCommand/additionalProperties" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/postCreateCommand" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/postCreateCommand/additionalProperties" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/postStartCommand" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/postStartCommand/additionalProperties" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/postAttachCommand" (strictTypes)
strict mode: use allowUnionTypes to allow union type keyword at "#/properties/postAttachCommand/additionalProperties" (strictTypes)
Error: (!) ERR: 'deploy/devcontainer-feature/src/radcli/devcontainer-feature.json' is not valid:
[
    {
        "instancePath": "",
        "schemaPath": "#/additionalProperties",
        "keyword": "additionalProperties",
        "params": {
            "additionalProperty": "dependsOn"
        },
        "message": "must NOT have additional properties"
    },
    {
        "instancePath": "",
        "schemaPath": "#/oneOf",
        "keyword": "oneOf",
        "params": {
            "passingSchemas": null
        },
        "message": "must match exactly one schema in oneOf"
    }
]

rynowak avatar Dec 12 '23 16:12 rynowak

As a suggestion, it would be really helpful if the action would print the CLI version that's being used, and the CLI command that's being run. This way I could do the investigation outside of a pipeline.

rynowak avatar Dec 12 '23 16:12 rynowak

Apologies, looks like I missed adding dependsOn to the schema, which is validated against in the action for convenience.

I'll make sure to add it to the schema, which will solve this issue. In the meantime, you can turn off the schema validation temporarily with the disable-schema-validation option.

print the CLI version that's being used

Thanks for the feedback, i'm surprised the output doesn't have the version in it today. As an FYI, the action will dynamically fetch the latest published CLI each time, unless you override it.

joshspicer avatar Dec 19 '23 13:12 joshspicer