-
Notifications
You must be signed in to change notification settings - Fork 10
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(#119): add new home for configuration files #144
Conversation
Ike Plugins (test-keeper)Thank you @dipak-pawar for this contribution! It appears that no tests have been added or updated in this PR. Automated tests give us confidence in shipping reliable software. Please add some as part of this change. If you are an admin or the reviewer of this PR and you are sure that no test is needed then you can use the command Your plugin configuration is stored in the file. |
Can one of the admins verify this patch? |
Thanks @dipak-pawar for your work, unfortunately, I'm afraid that the task was misunderstood. The new default location of the config files |
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 my comment above
[test] |
@MatousJobanek can you look into this when you find some time? |
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.
Thanks for the change. So the config is already automatically loaded from the default location, it would be great if it would work for the plugin hint file in the same way as well.
Please take a look also at the test failures https://travis-ci.org/arquillian/ike-prow-plugins/builds/380075424?utm_source=github_status&utm_medium=notification
pkg/assets/config/test-keeper.yaml
Outdated
@@ -134,3 +135,4 @@ skip_validation_for: | |||
|
|||
# Our own configurations | |||
- 'regex{{test-keeper\.y[a]?ml$}}' |
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.
is this line still necessary when the configs should be inside of the directory that is excluded?
.ike-prow/test-keeper.yaml
Outdated
@@ -0,0 +1,2 @@ | |||
skip_validation_for: | |||
- 'cluster/' |
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.
there is still also the original file https://github.com/dipak-pawar/ike-prow-plugins/blob/c32f52a822cedb073f21298dda3e98ecb424bf82/test-keeper.yaml - it should be removed (moved here)
pkg/github/service/config_loader.go
Outdated
// revision. Two files are expected to be found there plugin-name.yml or plugin-name.yaml (in that order) | ||
func (l *LoadableConfig) Sources() []config.Source { | ||
return []config.Source{ | ||
l.loadFromRawFile("%s.yml"), | ||
l.loadFromRawFile("%s.yaml"), | ||
l.loadFromRawFile(".ike-prow/%s.yml"), |
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.
make .ike-prow/
a constant as it is used at several places
pkg/github/service/config_loader.go
Outdated
|
||
if e == nil { | ||
l.BaseConfig.PluginHint = githubBaseURL + rawFileService.GetRelativePath(pluginHintPath) | ||
} |
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.
this shouldn't be here. This function is for loading configuration file, not the *_hint file.
In addition, on the line 51 you download the file - that should be lazy. Download it (and generate the default path) only when needed.
This should be part of comment_message.go
@@ -24,8 +24,10 @@ var _ = Describe("Test keeper config loader features", func() { | |||
|
|||
It("should load test-keeper configuration yml file", func() { | |||
// given | |||
NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") |
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 don't think that this is necessary as it checks the suffix
@@ -40,6 +40,8 @@ func CreateCommentMessage(configuration PluginConfiguration, change scm.Reposito | |||
msg = sadIke + paragraph + beginning + paragraph + noConfig | |||
} else if configuration.PluginHint != "" { | |||
msg = getMsgFromConfigHint(configuration, change) | |||
} else if content := defaultFileContent(configuration, change); content != "" { | |||
msg = content |
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.
there is one case that is not covered - when there is no config file, but the hint file is present.
@@ -56,6 +58,18 @@ func getMsgFromConfigHint(configuration PluginConfiguration, change scm.Reposito | |||
return configuration.PluginHint | |||
} | |||
|
|||
func defaultFileContent(configuration PluginConfiguration, change scm.RepositoryChange) string { | |||
pluginHintPath := fmt.Sprintf(ghservice.ConfigHome+"%s_hint.md", configuration.PluginName) |
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.
when formatting function is used, then use it for all parts:
fmt.Sprintf("%s%s_hint.md", ghservice.ConfigHome, configuration.PluginName)
@@ -80,10 +80,10 @@ var _ = Describe("Test Keeper Plugin features", func() { | |||
gockEmptyComments(2) | |||
|
|||
gock.New("https://raw.githubusercontent.com"). | |||
Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/test-keeper.yml"). | |||
Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). |
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.
in configuration_gh_test.go
you have extracted the config file path to a variable: https://github.com/arquillian/ike-prow-plugins/pull/144/files#diff-8881d5433bc67c80efc79906b968d297R25 use it same also here
|
comment_message.go consistent
@dipak-pawar please, take a look at my last changes - if it makes sense to you and you are fine with it. |
@MatousJobanek Thanks for all changes. lgtm |
[test] |
Fixes: #119