-
Notifications
You must be signed in to change notification settings - Fork 482
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 (jkube-kit/generator) : Add configuration option in BaseGenerator to add tags (#1188) #1462
feat (jkube-kit/generator) : Add configuration option in BaseGenerator to add tags (#1188) #1462
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1462 +/- ##
=========================================
Coverage 51.34% 51.34%
Complexity 3812 3812
=========================================
Files 458 458
Lines 20681 20692 +11
Branches 2807 2808 +1
=========================================
+ Hits 10618 10624 +6
- Misses 8947 8952 +5
Partials 1116 1116
Continue to review full report at Codecov.
|
protected void addTagsFromConfig(BuildConfiguration.BuildConfigurationBuilder buildConfigurationBuilder) { | ||
String commaSeparatedTags = getConfig(Config.TAGS); | ||
if (StringUtils.isNotBlank(commaSeparatedTags)) { | ||
String[] tags = commaSeparatedTags.split(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we trim whitespaces here?
b30f5d5
to
4bd6cc9
Compare
@@ -227,6 +231,14 @@ protected void addLatestTagIfSnapshot(BuildConfiguration.BuildConfigurationBuild | |||
} | |||
} | |||
|
|||
protected void addTagsFromConfig(BuildConfiguration.BuildConfigurationBuilder buildConfigurationBuilder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tags should be consistent with the requirements from https://docs.docker.com/engine/reference/commandline/tag/
A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.
Please consider adding into code and cover them with unit tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tag validation is currently by docker APIServer while processing tag request submitted by jkube.
Is it necessary to do validation again on our side?
|
||
| *tags* | ||
| A comma separated list of additional tags you want to tag your image with | ||
| `jkube.generator.tags` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder to create a new Issue:
These property names are misleading, they should be renamed to:
jkube.generator.${generatorName}.tags
or applicable
Then add a note indicating that the ${generatorName}
placeholder should be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or does it work without the generator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question was meant so that we tested it and create an issue, I'm not sure you did.
However, you have changed the documentation...
I'm sure that jkube.generator.from
and others work when not specifying the generator name. We need to verify and make sure which properties need to be changed, and decide the approach.
Please, provide feedback before doing any action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. In BaseGenerator there is a method getConfigWithFallback
which checks system and project properties with given key for config field value:
BaseGenerator config fields name
, alias
, from
, fromMode
, registry
seems to be using getConfigWithFallback
method so they seem to work with jkube.generator
prefix with and without generator name.
add
and tags
(added in this PR) don't seems to be aligned with this approach. Right now they don't work with jkube.generator
prefix and require generator name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted my doc changes and created #1489
...e-kit/generator/api/src/main/java/org/eclipse/jkube/generator/api/support/BaseGenerator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See trimming comment
4bd6cc9
to
7beb92a
Compare
…r to add tags (eclipse-jkube#1188) Right now there isn't a way to add tags to BuildConfiguration while using zero config mode in generators. Adding a configuration field in BaseGenerator which would expect comma separated tags which can be picked up by Generator while building opinionated Image configuration Signed-off-by: Rohan Kumar <rohaan@redhat.com>
7beb92a
to
1d626c6
Compare
Kudos, SonarCloud Quality Gate passed! |
Description
Fix #1188
Right now there isn't a way to add tags to BuildConfiguration while
using zero config mode in generators. Adding a configuration field in
BaseGenerator which would expect comma separated tags which can be
picked up by Generator while building opinionated Image configuration
Signed-off-by: Rohan Kumar rohaan@redhat.com
Type of change
test, version modification, documentation, etc.)
Checklist