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

fix(#1137): only add image.docker.user if the value exists #1138

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

e-picas
Copy link
Contributor

@e-picas e-picas commented Mar 12, 2024

This fixes #1137

With the original YML in the ticket:

my_job:
  image: node:lts
  script:
    - echo 'test'

The rendering of the --preview option is now safe (no more image.docker.user: null):

$ node ../test-gitlab-ci-local/gitlab-ci-local/src/index.js --preview
---
stages:
  - .pre
  - build
  - test
  - deploy
  - .post
my_job:
  image:
    name: node:lts
  script:
    - echo 'test'

And it passes the ci/lint validation:

$ jq --null-input --arg yaml "$(node ../test-gitlab-ci-local/gitlab-ci-local/src/index.js --preview)" '.content=$yaml' \
| curl "https://gitlab.com/api/v4/projects/${PROJECT_ID}/ci/lint" \
	--header "Authorization: Bearer ${GITLAB_TOKEN}" \
	--header 'Content-Type: application/json' \
	--data @- | jq '.errors'

[]

I also deleted the image.docker.user: null in the test cases.

@firecow
Copy link
Owner

firecow commented Mar 13, 2024

eslint is failing @e-picas

@e-picas
Copy link
Contributor Author

e-picas commented Mar 13, 2024

@firecow ok fixed

@firecow firecow merged commit b1428a9 into firecow:master Mar 14, 2024
9 checks passed
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 this pull request may close these issues.

Preview validation fails because of the image.docker.user: null (actual master, not released yet)
2 participants