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

Revisit if types is indeed an illegal name #1263

Closed
hverlin opened this issue Jun 10, 2024 · 4 comments · Fixed by #1266
Closed

Revisit if types is indeed an illegal name #1263

hverlin opened this issue Jun 10, 2024 · 4 comments · Fixed by #1266
Assignees

Comments

@hverlin
Copy link
Collaborator

hverlin commented Jun 10, 2024

Minimal .gitlab-ci.yml illustrating the issue

---
types:
  script:
    - echo "test"

test:
  needs: [types]
  script:
    - echo "test"

Expected behavior
According to the documentation, it should not work.
https://docs.gitlab.com/ee/ci/jobs/#job-name-limitations

However, it does work:
https://gitlab.com/hverlin/gitlab-ci-local-tests/-/pipelines/1324968259

Probably this is a limitation that they forgot to remove from the documentation?

> gitlab-ci-local
needs: [types] for test could not be found

Two solutions:

  • remove types from:
    static readonly illegalJobNames = new Set([
    "include", "local_configuration", "image", "services",
    "stages", "types", "before_script", "default",
    "after_script", "variables", "cache", "workflow",
    ]);
  • add a warning to the console if a job name matches an invalid name
@ANGkeith
Copy link
Collaborator

ANGkeith commented Jun 11, 2024

hmm,

(personally i would prefer the 2nd solution, because can't really tell if gitlab.com forget to remove or are they reserving those word for future use

@ANGkeith
Copy link
Collaborator

speaking of which,
gitlab-ci-local/src/job.ts

our list seemed to deviate a little from https://docs.gitlab.com/ee/ci/jobs/#job-name-limitations

@ANGkeith
Copy link
Collaborator

The following all works too eventhough the docs says it's illegal lols..

---
"true":
  script:
    - echo "test"

"false":
  script:
    - echo "test"

"nil":
  script:
    - echo "test"

@hverlin
Copy link
Collaborator Author

hverlin commented Jun 12, 2024

Filed an issue https://gitlab.com/gitlab-org/gitlab/-/issues/467170

@hverlin hverlin self-assigned this Jun 26, 2024
firecow pushed a commit that referenced this issue Jun 27, 2024
* Improve validation

* Improve validation

* Add test

* yamllint

* apply suggestions

* improve validation message

* fix sonarqube issue "Refactor this code to not use nested template literals."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants