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

feat(docker-compose): yaml parser option removeTemplates #31206

Merged
merged 8 commits into from
Sep 10, 2024

Conversation

Nemental
Copy link
Contributor

@Nemental Nemental commented Sep 4, 2024

Changes

Add option removeTemplates: true to docker-compose managers parseSingleYaml function call.

Context

My docker compose files are templated with jinja2 because I use them with ansible for my deployment automation.
Things like that aren't possible:

...
services:
  app:
    image: collabora/code:24.04.6.1.1
    restart: unless-stopped
    environment:
      {{ services['app']['environment'] | to_nice_yaml | indent(6) | trim }}
    networks:
      - traefik
      - collabora
...
"stack": "YAMLException: missed comma between flow collection entries (7:18)

 4 |     image: collabora/code:24.04.6.1.1
 5 |     restart: unless-stopped
 6 |     environment:
 7 |       {{ services['app']['environment'] | to_nice ...
----------------------^
 8 |     networks:
 9 |       - traefik
    at generateError (./node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (./node_modules/js-yaml/lib/loader.js:187:9)
    at readFlowCollection (./node_modules/js-yaml/lib/loader.js:758:7)
    at composeNode (./node_modules/js-yaml/lib/loader.js:1442:11)
    at readFlowCollection (./node_modules/js-yaml/lib/loader.js:780:5)
    at composeNode (./node_modules/js-yaml/lib/loader.js:1442:11)
    at readBlockMapping (./node_modules/js-yaml/lib/loader.js:1104:12)
    at composeNode (./node_modules/js-yaml/lib/loader.js:1441:12)
    at readBlockMapping (./node_modules/js-yaml/lib/loader.js:1164:11)
    at composeNode (./node_modules/js-yaml/lib/loader.js:1441:12)
    at readBlockMapping (./node_modules/js-yaml/lib/loader.js:1164:11)
    at composeNode (./node_modules/js-yaml/lib/loader.js:1441:12)
    at readBlockMapping (./node_modules/js-yaml/lib/loader.js:1164:11)
    at composeNode (./node_modules/js-yaml/lib/loader.js:1441:12)
    at readDocument (./node_modules/js-yaml/lib/loader.js:1625:3)
    at loadDocuments (./node_modules/js-yaml/lib/loader.js:1688:5)
    at load (./node_modules/js-yaml/lib/loader.js:1714:19)
    at parseSingleYaml (./node_modules/renovate/lib/util/yaml.ts:63:29)
    at Object.extractPackageFile (./node_modules/renovate/lib/modules/manager/docker-compose/extract.ts:39:29)
    at extractPackageFile (./node_modules/renovate/lib/modules/manager/index.ts:75:9)"
}

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@CLAassistant
Copy link

CLAassistant commented Sep 4, 2024

CLA assistant check
All committers have signed the CLA.

@rarkins rarkins requested a review from secustor September 4, 2024 13:26
Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test case for this.

viceice
viceice previously approved these changes Sep 4, 2024
auto-merge was automatically disabled September 5, 2024 09:54

Head branch was pushed to by a user without write access

@Nemental Nemental requested review from viceice and secustor September 5, 2024 13:48
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see open conversation

@viceice viceice added this pull request to the merge queue Sep 10, 2024
Merged via the queue into renovatebot:main with commit b2d9dd3 Sep 10, 2024
38 checks passed
@Nemental Nemental deleted the feat/docker-compose-templates branch September 10, 2024 16:55
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 38.74.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants