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

Allow forcing the use of the generic updater in extra-files #2205

Closed
LoicFerrot opened this issue Jan 29, 2024 · 2 comments · Fixed by #2227
Closed

Allow forcing the use of the generic updater in extra-files #2205

LoicFerrot opened this issue Jan 29, 2024 · 2 comments · Fixed by #2227
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@LoicFerrot
Copy link

Is your feature request related to a problem? Please describe.
Since #2072, any JSON, XML, YAML or TOML file is updated using their corresponding updater, meaning that the value of a top level version key, if existing, is bumped. It should be possible to override this default behavior.

My use case is to bump a docker image tag in a docker-compose.yaml file, that contains a top-level version key, like such:

# docker-compose.yaml
version: "3.8"  # Docker version: https://docs.docker.com/compose/compose-file/04-version-and-name/

services:
  my-service:
    ...
    image: my-org/my-repo:v0.1.0 # x-release-please-version

I tried two things:

"extra-files": ["docker-compose.yaml"]

When using this config, the version: "3.8" is replaced by version: v0.1.1, and the image value is left untouched.

"extra-files": [
  {
    "type": "yaml",
    "path": "docker-compose.yaml",
    "jsonpath": "services.my-service.image"
  }
]

When using this second config, the image value is transformed to v0.1.1, deleting the my-org/my-repo: part.

Describe the solution you'd like
Allow something like this, that won't attempt to modify the top-level version:

"extra-files": [
  {
    "type": "generic",
    "path": "docker-compose.yaml"
  }
]

Describe alternatives you've considered
As specified there, the version key is not strictly necessary for a docker-compose file, so removing this key leads to the desired behavior. However, this is only a temporary workaround.

@LoicFerrot LoicFerrot added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jan 29, 2024
@regseb
Copy link
Contributor

regseb commented Feb 9, 2024

The jsonpath must begin with a $. You'll get an error because jsonpath library doesn't support - (dchester/jsonpath#90 (comment)):

Error: release-please failed: Lexical error on line 1. Unrecognized text.
$.services.my-service.image
-------------^

The property must be enclosed in quotes:

"extra-files": [
  {
    "type": "yaml",
    "path": "docker-compose.yaml",
    "jsonpath": "$.services[\"my-service\"].image"
  }
]

@philippeboyd
Copy link

philippeboyd commented Feb 15, 2024

@regseb this won't work with type as it will reformat the file, remove comments and purge quotes as per issues https://github.com/google-github-actions/release-please-action/issues/896 and #2195

We would want to keep the generic updater with yaml files if we want or prevent the yaml updater from reformating the whole file when setting the new version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants