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

fix(#119): add new home for configuration files #144

Merged
merged 34 commits into from
May 24, 2018

Conversation

dipak-pawar
Copy link
Contributor

Fixes: #119

@alien-ike
Copy link
Contributor

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 /ok-without-tests as a comment to make the status green.

Your plugin configuration is stored in the file.

@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@MatousJobanek
Copy link
Contributor

Thanks @dipak-pawar for your work, unfortunately, I'm afraid that the task was misunderstood. The new default location of the config files .ike-prow/ should be something that is automatically checked for the presence of the files - for both the configuration file and plugin hint file (with that fact that the location of the plugin hint file can be still customized in config file). It should work in the same way as the .github directory works for the GH templates.
The pkg/assets/config/test-keeper.yaml should stay there where it was - this contains default inclusions and exclusions applicable for all projects the plugins are used in. The .ike-prow/test-keeper.yaml file contains additional configuration specific for the particular project - our own one is here: https://github.com/arquillian/ike-prow-plugins/blob/master/test-keeper.yaml that one should have been moved to the directory.

Copy link
Contributor

@MatousJobanek MatousJobanek left a 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

@MatousJobanek
Copy link
Contributor

[test]

@dipak-pawar
Copy link
Contributor Author

@MatousJobanek can you look into this when you find some time?

Copy link
Contributor

@MatousJobanek MatousJobanek left a 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

@@ -134,3 +135,4 @@ skip_validation_for:

# Our own configurations
- 'regex{{test-keeper\.y[a]?ml$}}'
Copy link
Contributor

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?

@@ -0,0 +1,2 @@
skip_validation_for:
- 'cluster/'
Copy link
Contributor

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)

@alien-ike alien-ike added size/M and removed size/S labels May 18, 2018
@alien-ike alien-ike added size/L and removed size/M labels May 21, 2018
// 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"),
Copy link
Contributor

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


if e == nil {
l.BaseConfig.PluginHint = githubBaseURL + rawFileService.GetRelativePath(pluginHintPath)
}
Copy link
Contributor

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")
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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").
Copy link
Contributor

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

@MatousJobanek
Copy link
Contributor

MatousJobanek commented May 23, 2018

  • Please also change the documentation to explain the "workflow" of loading the *_hint.md files - that when nothing is set in config, then it is automatically loaded from the pre-defined location.

@MatousJobanek
Copy link
Contributor

@dipak-pawar please, take a look at my last changes - if it makes sense to you and you are fine with it.

@dipak-pawar
Copy link
Contributor Author

@MatousJobanek Thanks for all changes. lgtm

@MatousJobanek
Copy link
Contributor

[test]

@MatousJobanek MatousJobanek merged commit 1748860 into arquillian:master May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants