-
Notifications
You must be signed in to change notification settings - Fork 97
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
Feature request - Gradle Properties options #18
Comments
Hi @gildor, I can see how this can be annoying. But then you would have to deal with more YAML, I'm not sure I'm fond of it. It's a tradeoff between long arguments and 'complex' YAML. I'm not against such an addition and agree that system properties should be implemented too if we go down that route. The behaviour when one sets the same property in |
Thanks for reply
Agree, probably properties should be added after build arguments, it makes implementation simple (no need to parse and alter arguments somehow) and allows debug what kind properties are passed to gradle in build logs (because properties would be converted to arguments)
It's true, not a huge fan of more yaml, but we have what we have, and more readable workflow file is with a clear separation between tasks arguments and build properties makes sense here |
Converting the properties to arguments sounds good. |
Yes, appending as simple and straight forward solution so properties have precedence |
One of the issues is GitHub actions runner does not provide access to YAML configuration. It supports literal values only, and even YAML lists are not supported yet. On the other hand, the following might be not that bad (I'm not sure if multi-line arguments already work, but it can definitely be supported): - name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: |
build --info
-PsomeService.prod.apiKey=${{ secrets.SOME_SERVICE_API_KEY }}
-PsomeService.prod.secret=${{ secrets.SOME_SERVICE_API_SECRET }}
-PsomeService.prod.projectId=${{ secrets.SOME_SERVICE_PROJECT_ID }} or - name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: build --info
properties: |
someService.prod.apiKey=${{ secrets.SOME_SERVICE_API_KEY }}
someService.prod.secret=${{ secrets.SOME_SERVICE_API_SECRET }}
someService.prod.projectId=${{ secrets.SOME_SERVICE_PROJECT_ID }} |
To pass Gradle property as argument we have 2 choices:
The issue of this approach is that it doesn't support properties with dots (very common practice, because of properties file)
Works fine until you have 1-2 property, but becomes issue if you have many of them, multiline support would help but it also have issues in YML, requires special syntax and not very convenient to use, it also easy to forgot slash in command
So I suggest adding support for gradle properties in yml syntax:
Tho, there is an issue with it, because key with dot requires escaping in YML:
some.secret
should be escaped like:"[some.secret]"
Still fine, but not perfect. There is another option. Support dot as yml separator:
For 1 simple property it may be overkill and escape will work just fine
But check this real-life example:
As you see, now it's not easy to follow what is going on. it will be better with nested properties syntax:
So much better even if debug and dev environments are configured
Maybe it should be considered to do the same for system properties, which are also very common
If you think it reasonable, I may try to implement it and contribute
The text was updated successfully, but these errors were encountered: