CircleCI-Public / circleci-yaml-language-server

The official language server for CircleCI YAML configuration files
Apache License 2.0
20 stars 18 forks source link

Incorrect `resource_class` validation when using self-hosted runner #279

Closed BMeach closed 6 months ago

BMeach commented 7 months ago

Hello all, I recently started using CircleCI and I am using on-prem self-hosted runners. When I added the VSCode extension it said that my resource_class was invalid, yet when I did Validate current configuration file it says its valid and the workflow works without issues. I think there needs to be a way to detect when using a self hosted runner in the resource class.

When I change the namespace it seems to know what is and is not valid for the namespace but it is determined that my is invalid. Below is the error message I get from VSCode.

Value is not accepted. Valid values: "small", "medium", "medium+", "large", "xlarge", "2xlarge", "2xlarge+", "arm.medium", "arm.large", "arm.xlarge", "arm.2xlarge".

loderunner commented 6 months ago

Hi @BMeach!

Thanks for using the VS Code extension, and providing us with feedback.

Can you tell us which extension is giving you this validation error? VS Code adds the extension identifier to the error tooltip.

For example, this error—that seems similar to yours—is generated by the Red Hat YAML extension.

Screenshot 2024-03-09 at 11 55 18

By contrast, here is a diagnostics message generated by the CircleCI language server.

Screenshot 2024-03-09 at 12 02 04

The Red Hat YAML extension relies on SchemaStore to validate many formats of JSON and YAML. While we do contribute to SchemaStore to support CircleCI config files as best we can, we ultimately aren't in control of these 3rd-party extensions.


If you could provide us with an example config file to reproduce your issue, we'll be sure to look into ensuring that SchemaStore supports your case.

BMeach commented 6 months ago

You're exactly correct. I apologize for the oversight, the error is from yaml-schema. I will add the CircleCI to an exclude file for the YAML validator.

loderunner commented 6 months ago

No worries. If you can, please do provide us with a YAML file to reproduce your bug, and we'll try to contribute to SchemaStore to support your case.

BMeach commented 6 months ago

Here is an example of the lines that I was getting errors on.

version: 2.1

executors:
  management:
    docker:
      - image: hashicorp/terraform:latest
    resource_class: my-org/terraform-k3s-cluster-infrastructure
  test:
    docker:
      - image: hashicorp/terraform:latest
    resource_class: my-org/terraform-k3s-cluster-infrastructure

Here are all of the VSCode extensions I have installed.

Here is a screenshot of the error in VSCode

image

loderunner commented 6 months ago

Thanks!

I'll be closing the issue in this repo, since this is a problem with the schema in SchemaStore. I'm tracking the issue on our internal board, and we'll try to contribute the public schema as soon as possible.

BMeach commented 6 months ago

Thank you for the quick help!