From cb5a4dae3da3fcfaa8e8809d0136f66e85ba683c Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 17 May 2018 12:47:17 +0530 Subject: [PATCH 01/26] chore: ignore .dockerignore and .ike-prow directory --- pkg/assets/config/test-keeper.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/assets/config/test-keeper.yaml b/pkg/assets/config/test-keeper.yaml index 81d50bf..f9a6435 100644 --- a/pkg/assets/config/test-keeper.yaml +++ b/pkg/assets/config/test-keeper.yaml @@ -60,6 +60,7 @@ skip_validation_for: ## Docker - 'regex{{docker-compose.*\.y[a]?ml$}}' - 'Dockerfile*' + - '.dockerignore' ## Others - 'Makefile' @@ -134,3 +135,4 @@ skip_validation_for: # Our own configurations - 'regex{{test-keeper\.y[a]?ml$}}' + - '.ike-prow/' From 7cb818a7d986f28420e292eb2ab0768a177a0861 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 17 May 2018 12:48:19 +0530 Subject: [PATCH 02/26] chore: update path to take .ike-prow dir for configuration --- pkg/github/service/config_loader.go | 6 +++--- .../github_calls/prs/with_tests/test-keeper.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/github/service/config_loader.go b/pkg/github/service/config_loader.go index 107749c..0c33057 100644 --- a/pkg/github/service/config_loader.go +++ b/pkg/github/service/config_loader.go @@ -17,12 +17,12 @@ type LoadableConfig struct { BaseConfig *config.PluginConfiguration } -// Sources provides default loading strategies for a plugin looking it up in the root of the repository for a given +// Sources provides default loading strategies for a plugin looking it up in the .ike-prow directory of the repository for a given // 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"), + l.loadFromRawFile(".ike-prow/%s.yaml"), } } diff --git a/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/with_tests/test-keeper.yml b/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/with_tests/test-keeper.yml index db46947..f391b1a 100644 --- a/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/with_tests/test-keeper.yml +++ b/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/with_tests/test-keeper.yml @@ -3,4 +3,4 @@ test_patterns: skip_validation_for: - 'regex{{.*\.[xsd]?html$}}' # combine_defaults: false # -plugin_hint: plugins/test-keeper_hint.md # \ No newline at end of file +plugin_hint: .ike-prow/test-keeper_hint.md # \ No newline at end of file From a2c1115f7e631f8e2e64ac3fd267a50d765b73b1 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 17 May 2018 12:48:55 +0530 Subject: [PATCH 03/26] chore: update doc for plugin hint configuration --- docs/plugins.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.adoc b/docs/plugins.adoc index 6ebd76b..7124f62 100644 --- a/docs/plugins.adoc +++ b/docs/plugins.adoc @@ -23,7 +23,7 @@ To enable customized plugin hint comment messages edit plugin's configuration fi .test-keeper.yaml [source, yml, indent=0] ---- -plugin_hint: plugins/test-keeper_hint.md +plugin_hint: .ike-prow/test-keeper_hint.md ---- The `plugin_hint` property can either have an inline string directly written inside of the config file or another file with case insensitive filename PLUGINNAME_HINT.md that contains the hint. The location of the file can be set by either a relative path or an absolute URL. If nothing is set then a default message is used. From 96604b8649b20e7f7bcdbab4f5b902bb1596d38d Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 17 May 2018 13:10:00 +0530 Subject: [PATCH 04/26] chore: move our test-keeper configuration in .ike-prow dir --- .ike-prow/test-keeper.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .ike-prow/test-keeper.yaml diff --git a/.ike-prow/test-keeper.yaml b/.ike-prow/test-keeper.yaml new file mode 100644 index 0000000..af49f96 --- /dev/null +++ b/.ike-prow/test-keeper.yaml @@ -0,0 +1,2 @@ +skip_validation_for: + - 'cluster/' From 64e63f2ded5c371f7969dbc0bd8415a6d6d95190 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Fri, 18 May 2018 11:21:26 +0530 Subject: [PATCH 05/26] chore: removes test-keeper.yaml from root dir --- test-keeper.yaml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 test-keeper.yaml diff --git a/test-keeper.yaml b/test-keeper.yaml deleted file mode 100644 index af49f96..0000000 --- a/test-keeper.yaml +++ /dev/null @@ -1,2 +0,0 @@ -skip_validation_for: - - 'cluster/' From 3acc1b82d5196dcbfe31b611f2336f1265b0e321 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Fri, 18 May 2018 11:24:48 +0530 Subject: [PATCH 06/26] chore: removes unnecessary regex test-keeper.yaml from config --- pkg/assets/config/test-keeper.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/assets/config/test-keeper.yaml b/pkg/assets/config/test-keeper.yaml index f9a6435..c25cf86 100644 --- a/pkg/assets/config/test-keeper.yaml +++ b/pkg/assets/config/test-keeper.yaml @@ -134,5 +134,4 @@ skip_validation_for: - '*.bat' # Our own configurations - - 'regex{{test-keeper\.y[a]?ml$}}' - '.ike-prow/' From 6ec0087c6dad1ea48b3fb2be219dc98c457cf1ae Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Fri, 18 May 2018 11:36:00 +0530 Subject: [PATCH 07/26] fix: modify test to new use new config location --- pkg/plugin/test-keeper/configuration_gh_test.go | 10 +++++----- pkg/plugin/test-keeper/event_handler_gh_test.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/plugin/test-keeper/configuration_gh_test.go b/pkg/plugin/test-keeper/configuration_gh_test.go index 40233bc..27aa7a3 100644 --- a/pkg/plugin/test-keeper/configuration_gh_test.go +++ b/pkg/plugin/test-keeper/configuration_gh_test.go @@ -25,7 +25,7 @@ var _ = Describe("Test keeper config loader features", func() { It("should load test-keeper configuration yml file", func() { // given gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + testkeeper.ProwPluginName + ".yml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yml"). Reply(200). BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n" + @@ -41,7 +41,7 @@ var _ = Describe("Test keeper config loader features", func() { configuration := testkeeper.LoadConfiguration(logger, change) // then - Expect(configuration.LocationURL).To(Equal("https://github.com/owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/test-keeper.yml")) + Expect(configuration.LocationURL).To(Equal("https://github.com/owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/test-keeper.yml")) Expect(configuration.PluginName).To(Equal(testkeeper.ProwPluginName)) Expect(configuration.PluginHint).To(Equal("http://my.server.com/message.md")) }) @@ -49,7 +49,7 @@ var _ = Describe("Test keeper config loader features", func() { It("should load test-keeper configuration yml file", func() { // given gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + testkeeper.ProwPluginName + ".yml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yml"). Reply(200). BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n" + @@ -76,7 +76,7 @@ var _ = Describe("Test keeper config loader features", func() { NonExistingRawGitHubFiles("test-keeper.yml") gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + testkeeper.ProwPluginName + ".yaml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). Reply(200). BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n" + @@ -103,7 +103,7 @@ var _ = Describe("Test keeper config loader features", func() { NonExistingRawGitHubFiles("test-keeper.yml") gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + testkeeper.ProwPluginName + ".yaml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). Reply(404) change := scm.RepositoryChange{ diff --git a/pkg/plugin/test-keeper/event_handler_gh_test.go b/pkg/plugin/test-keeper/event_handler_gh_test.go index 5de2aab..4ab41b4 100644 --- a/pkg/plugin/test-keeper/event_handler_gh_test.go +++ b/pkg/plugin/test-keeper/event_handler_gh_test.go @@ -77,7 +77,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve opened pull request when tests included based on configured pattern and defaults (implicitly combined)", func() { // given gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). Reply(200). BodyString("test_patterns: ['**/*_test_suite.go']\n" + "skip_validation_for: ['README.adoc']") @@ -104,7 +104,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve new pull request without tests when it comes with configuration excluding all files from test presence check (implicitly combined)", func() { // given gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/prs/without_tests/test-keeper-ignore-randomfile.yml")) @@ -130,10 +130,10 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should reject opened pull request when no tests are matching defined pattern with no defaults implicitly combined", func() { // given - NonExistingRawGitHubFiles("plugins/test-keeper_hint.md") + NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/prs/with_tests/test-keeper.yml")) From 1d3531f12d4c2e45cd767f27c346956ae3684c9e Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Fri, 18 May 2018 12:57:35 +0530 Subject: [PATCH 08/26] chore: update test-fixture with new location for config file --- ...h-test-keeper-config-excluding-other-file-from-PR.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/without_tests/changes-with-test-keeper-config-excluding-other-file-from-PR.json b/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/without_tests/changes-with-test-keeper-config-excluding-other-file-from-PR.json index 325dbe7..2fae6d7 100644 --- a/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/without_tests/changes-with-test-keeper-config-excluding-other-file-from-PR.json +++ b/pkg/plugin/test-keeper/test_fixtures/github_calls/prs/without_tests/changes-with-test-keeper-config-excluding-other-file-from-PR.json @@ -13,14 +13,14 @@ }, { "sha": "328a601724d79193c48e7828033f0908d14399cb", - "filename": "test-keeper.yml", + "filename": ".ike-prow/test-keeper.yml", "status": "added", "additions": 2, "deletions": 0, "changes": 2, - "blob_url": "https://github.com/bartoszmajsak/wfswarm-booster-pipeline-test/blob/78fe5f4d0ece3fe84793642e976563217277ca6b/test-keeper.yml", - "raw_url": "https://github.com/bartoszmajsak/wfswarm-booster-pipeline-test/raw/78fe5f4d0ece3fe84793642e976563217277ca6b/test-keeper.yml", - "contents_url": "https://api.github.com/repos/bartoszmajsak/wfswarm-booster-pipeline-test/contents/test-keeper.yml?ref=78fe5f4d0ece3fe84793642e976563217277ca6b", + "blob_url": "https://github.com/bartoszmajsak/wfswarm-booster-pipeline-test/blob/78fe5f4d0ece3fe84793642e976563217277ca6b/.ike-prow/test-keeper.yml", + "raw_url": "https://github.com/bartoszmajsak/wfswarm-booster-pipeline-test/raw/78fe5f4d0ece3fe84793642e976563217277ca6b/.ike-prow/test-keeper.yml", + "contents_url": "https://api.github.com/repos/bartoszmajsak/wfswarm-booster-pipeline-test/contents/.ike-prow/test-keeper.yml?ref=78fe5f4d0ece3fe84793642e976563217277ca6b", "patch": "@@ -0,0 +1,2 @@\n+skip_validation_for:\n+ - '**/Randomfile'" } ] From fb4f0d41c3ddd52ffae925af71468677b230340a Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Fri, 18 May 2018 16:14:08 +0530 Subject: [PATCH 09/26] feat: load hint file from .ike-prow/ by default --- pkg/github/service/config_loader.go | 10 +++++ .../test-keeper/configuration_gh_test.go | 40 ++++++++++++++++++- .../test-keeper/event_handler_gh_test.go | 5 +++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/pkg/github/service/config_loader.go b/pkg/github/service/config_loader.go index 0c33057..102dc27 100644 --- a/pkg/github/service/config_loader.go +++ b/pkg/github/service/config_loader.go @@ -44,6 +44,16 @@ func (l *LoadableConfig) loadFromRawFile(pathTemplate string) config.Source { l.BaseConfig.LocationURL = githubBaseURL + rawFileService.GetRelativePath(filePath) l.BaseConfig.PluginName = l.PluginName + + pluginHintPath := fmt.Sprintf(".ike-prow/%s_hint.md", l.PluginName) + hintURL := rawFileService.GetRawFileURL(pluginHintPath) + + _, e := utils.GetFileFromURL(hintURL) + + if e == nil { + l.BaseConfig.PluginHint = githubBaseURL + rawFileService.GetRelativePath(pluginHintPath) + } + return downloadedConfig, nil } } diff --git a/pkg/plugin/test-keeper/configuration_gh_test.go b/pkg/plugin/test-keeper/configuration_gh_test.go index 27aa7a3..d77efce 100644 --- a/pkg/plugin/test-keeper/configuration_gh_test.go +++ b/pkg/plugin/test-keeper/configuration_gh_test.go @@ -24,6 +24,8 @@ 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") + gock.New("https://raw.githubusercontent.com"). Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yml"). Reply(200). @@ -48,6 +50,8 @@ 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") + gock.New("https://raw.githubusercontent.com"). Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yml"). Reply(200). @@ -73,7 +77,8 @@ var _ = Describe("Test keeper config loader features", func() { It("should load test-keeper configuration yaml file", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml") + NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") + NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") gock.New("https://raw.githubusercontent.com"). Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). @@ -98,9 +103,40 @@ var _ = Describe("Test keeper config loader features", func() { Expect(configuration.Combine).To(BeTrue()) }) + It("should load test-keeper configuration yaml file with default hint file if present and not mentioned in configuration", func() { + // given + NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") + + gock.New("https://raw.githubusercontent.com"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). + Reply(200). + BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n") + + gock.New("https://raw.githubusercontent.com"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + "_hint.md"). + Reply(200). + BodyString("custom hint for plugin") + + change := scm.RepositoryChange{ + Owner: "owner", + RepoName: "repo", + Hash: "46cb8fac44709e4ccaae97448c65e8f7320cfea7", + } + + // when + configuration := testkeeper.LoadConfiguration(logger, change) + + // then + Expect(configuration.PluginHint).To(Equal("https://github.com/owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/test-keeper_hint.md")) + Expect(configuration.Inclusions).To(ConsistOf("*my", "test.go", "pattern.js")) + Expect(configuration.Exclusions).To(ConsistOf("pom.xml", "regex{{*\\.adoc}}")) + Expect(configuration.Combine).To(BeTrue()) + }) + It("should not load test-keeper configuration yaml file and return empty url when config is not accessible", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml") + NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") gock.New("https://raw.githubusercontent.com"). Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). diff --git a/pkg/plugin/test-keeper/event_handler_gh_test.go b/pkg/plugin/test-keeper/event_handler_gh_test.go index 4ab41b4..96f07d9 100644 --- a/pkg/plugin/test-keeper/event_handler_gh_test.go +++ b/pkg/plugin/test-keeper/event_handler_gh_test.go @@ -76,6 +76,8 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve opened pull request when tests included based on configured pattern and defaults (implicitly combined)", func() { // given + NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") + gock.New("https://raw.githubusercontent.com"). Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). Reply(200). @@ -103,6 +105,8 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve new pull request without tests when it comes with configuration excluding all files from test presence check (implicitly combined)", func() { // given + NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") + gock.New("https://raw.githubusercontent.com"). Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). Reply(200). @@ -130,6 +134,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should reject opened pull request when no tests are matching defined pattern with no defaults implicitly combined", func() { // given + NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") gock.New("https://raw.githubusercontent.com"). From 4f6d727225678f21dc45dbed974a461e99f95dbe Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Mon, 21 May 2018 10:09:46 +0530 Subject: [PATCH 10/26] fix: update test to use single function --- pkg/plugin/test-keeper/configuration_gh_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/plugin/test-keeper/configuration_gh_test.go b/pkg/plugin/test-keeper/configuration_gh_test.go index d77efce..c160094 100644 --- a/pkg/plugin/test-keeper/configuration_gh_test.go +++ b/pkg/plugin/test-keeper/configuration_gh_test.go @@ -77,8 +77,7 @@ var _ = Describe("Test keeper config loader features", func() { It("should load test-keeper configuration yaml file", func() { // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") - NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") + NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml", ".ike-prow/test-keeper_hint.md") gock.New("https://raw.githubusercontent.com"). Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). From 5ccc521f4578acd143bf132ee50443819526be33 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Mon, 21 May 2018 10:10:13 +0530 Subject: [PATCH 11/26] chore: update glide.lock --- glide.lock | 57 ++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/glide.lock b/glide.lock index 8b3c1a6..79b29b7 100644 --- a/glide.lock +++ b/glide.lock @@ -1,13 +1,13 @@ -hash: 3e5727a2513de16dfd9a343097a2ab65d4c32ed5d3e25f586281b0ad32bf4692 -updated: 2018-04-25T15:13:01.817023112+02:00 +hash: 89baf0cd29908af47405714762c68467df13cc85df8f24a51b297c51fc6a051c +updated: 2018-05-21T10:04:02.937600861+05:30 imports: - name: github.com/bazelbuild/buildtools - version: 89c235029d7102b5af8bf0cd40e74f8e1ae4041b + version: 7a46d39511ae917d3af53e0627f4b57489dd1bff subpackages: - build - tables - name: github.com/beorn7/perks - version: 3a771d992973f24aa725d07868b467d1ddfceafb + version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: - quantile - name: github.com/certifi/gocertifi @@ -17,7 +17,7 @@ imports: - name: github.com/getsentry/raven-go version: 563b81fc02b75d664e54da31f787c2cc2186780b - name: github.com/ghodss/yaml - version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee + version: 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 - name: github.com/gogo/protobuf version: c0656edd0d9eab7c66d1eb0c568f9039345796f7 subpackages: @@ -26,9 +26,9 @@ imports: - name: github.com/golang/glog version: 44145f04b68cf362d9c4df2182967c2275eaefed - name: github.com/golang/lint - version: 470b6b0bb3005eda157f0275e2e4895055396a81 + version: c7bacac2b21ca01afa1dee0acf64df3ce047c28f - name: github.com/golang/protobuf - version: 927b65914520a8b7d44f5c9057611cfec6b2e2d0 + version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 subpackages: - proto - name: github.com/google/go-github @@ -48,7 +48,7 @@ imports: - name: github.com/gorilla/sessions version: a2f2a3de9a4a575047f73e3e36bc85ecc3546391 - name: github.com/matttproud/golang_protobuf_extensions - version: c12348ce28de40eed0136aa2b644d0ee0650e56c + version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a subpackages: - pbutil - name: github.com/onsi/ginkgo @@ -87,38 +87,34 @@ imports: - matchers/support/goraph/util - types - name: github.com/pkg/errors - version: 816c9085562cd7ee03e7f8188a1cfd942858cded + version: 645ef00459ed84a119197bfb8d8205042c6df63d - name: github.com/prometheus/client_golang - version: 82f5ff156b29e276022b1a958f7d385870fb9814 + version: c5b7fccd204277076155f10851dad72b76a49317 subpackages: - prometheus - prometheus/promhttp - name: github.com/prometheus/client_model - version: 99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c + version: fa8ad6fec33561be4280a8f0514318c79d7f6cb6 subpackages: - go - name: github.com/prometheus/common - version: d811d2e9bf898806ecfb6ef6296774b13ffc314c + version: a6ab08426bb262e2d190097751f5cfd1cfdfd17d subpackages: - expfmt - internal/bitbucket.org/ww/goautoneg - model - name: github.com/prometheus/procfs - version: 8b1c2da0d56deffdbb9e48d4414b4e674bd8083e - subpackages: - - internal/util - - nfs - - xfs + version: 454a56f35412459b5e684fd5ec0f9211b94f002a - name: github.com/satori/go.uuid version: 879c5887cd475cd7864858769793b2ceb0d44feb - name: github.com/shurcooL/githubql version: 2f1beebeca3383d6367f59e5f091dd4fe1c856de - name: github.com/shurcooL/go - version: 9e1955d9fb6e1ee2345ba1f5e71669263e719e27 + version: 47fa5b7ceee66c60ac3a281416089035bf526a3c subpackages: - ctxhttp - name: github.com/shurcooL/graphql - version: 62c9ce094e75302d560f7adcdf16c06d05aaa958 + version: 3d276b9dcc6b1e0adf19557a8de5cb8632c07697 subpackages: - ident - internal/jsonutil @@ -129,7 +125,7 @@ imports: - name: github.com/spf13/pflag version: 583c0c0531f06d5278b7d917446061adc344b5cd - name: golang.org/x/crypto - version: 034e5325b6ab92faa14d15c30e86919e911cf8e0 + version: d172538b2cfce0c13cee31e647d0367aa8cd2486 subpackages: - ssh/terminal - name: golang.org/x/net @@ -145,14 +141,13 @@ imports: - idna - lex/httplex - name: golang.org/x/oauth2 - version: cdc340f7c179dbbfa4afd43b7614e8fcadde4269 + version: 6881fee410a5daf86371371f9ad451b95e168b71 subpackages: - internal - name: golang.org/x/sys - version: 7c87d13f8e835d2fb3a70a2912c811ed0c1d241b + version: 478fcf54317e52ab69f40bb4c7a1520288d7f7ea subpackages: - unix - - windows - name: golang.org/x/text version: b19bf474d317b857955b12035d2c5acb57ce8b01 subpackages: @@ -175,13 +170,11 @@ imports: - unicode/bidi - unicode/norm - name: golang.org/x/tools - version: 48418e5732e1b1e2a10207c8007a5f959e422f20 + version: a888bfdffa4526cc6987572bca9a2c6b7758290f subpackages: - - go/ast/astutil - - go/gcexportdata - - go/internal/gcimporter + - go/gcimporter15 - name: google.golang.org/appengine - version: 962cbd1200af94a5a35ba8d512e9f91271b4d01a + version: 0a24098c0ec68416ec050f567f75df563d6b231e subpackages: - internal - internal/base @@ -197,13 +190,13 @@ imports: - name: gopkg.in/robfig/cron.v2 version: be2e0b0deed5a68ffee390b4583a13aff8321535 - name: gopkg.in/yaml.v2 - version: 5420a8b6744d3b0345ab293f6fcba19c978f1183 + version: a5b47d31c556af34a302ce5d659e6fea44d90de0 - name: k8s.io/api - version: 53d615ae3f440f957cb9989d989d597f047262d9 + version: e8df68e6b4a0eb60c21b9ba3a0b3e049bc041a31 subpackages: - core/v1 - name: k8s.io/apimachinery - version: dd7876c087d16d10b82489a4dac9e3f4427176ca + version: 501cb7399c8d23c1183ac38f1051d185188ecf12 subpackages: - pkg/api/resource - pkg/apis/meta/v1 @@ -276,4 +269,4 @@ imports: - prow/slack testImports: - name: github.com/microcosm-cc/bluemonday - version: 542fd4642604d0d0c26112396ce5b1a9d01eee0b \ No newline at end of file + version: 542fd4642604d0d0c26112396ce5b1a9d01eee0b From 1f3d490f26ee8566299ff477bed52942a395978f Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Wed, 23 May 2018 17:29:36 +0530 Subject: [PATCH 12/26] fix: add const for .ike-prow/ and removes config file eager loading --- pkg/github/service/config_loader.go | 14 +++----------- pkg/plugin/test-keeper/comment_message.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/pkg/github/service/config_loader.go b/pkg/github/service/config_loader.go index 102dc27..79037a7 100644 --- a/pkg/github/service/config_loader.go +++ b/pkg/github/service/config_loader.go @@ -9,6 +9,7 @@ import ( ) const githubBaseURL = "https://github.com/" +const ConfigHome = ".ike-prow/" // LoadableConfig holds information about the plugin name, repository change and pointer to base config type LoadableConfig struct { @@ -21,8 +22,8 @@ type LoadableConfig struct { // 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(".ike-prow/%s.yml"), - l.loadFromRawFile(".ike-prow/%s.yaml"), + l.loadFromRawFile(ConfigHome + "%s.yml"), + l.loadFromRawFile(ConfigHome + "%s.yaml"), } } @@ -45,15 +46,6 @@ func (l *LoadableConfig) loadFromRawFile(pathTemplate string) config.Source { l.BaseConfig.LocationURL = githubBaseURL + rawFileService.GetRelativePath(filePath) l.BaseConfig.PluginName = l.PluginName - pluginHintPath := fmt.Sprintf(".ike-prow/%s_hint.md", l.PluginName) - hintURL := rawFileService.GetRawFileURL(pluginHintPath) - - _, e := utils.GetFileFromURL(hintURL) - - if e == nil { - l.BaseConfig.PluginHint = githubBaseURL + rawFileService.GetRelativePath(pluginHintPath) - } - return downloadedConfig, nil } } diff --git a/pkg/plugin/test-keeper/comment_message.go b/pkg/plugin/test-keeper/comment_message.go index 545f7d1..866ae9e 100644 --- a/pkg/plugin/test-keeper/comment_message.go +++ b/pkg/plugin/test-keeper/comment_message.go @@ -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 } else { msg = sadIke + paragraph + getMsgWithConfigRef(configuration.LocationURL) } @@ -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) + ghFileService := ghservice.RawFileService{Change: change} + hintURL := ghFileService.GetRawFileURL(pluginHintPath) + + content, e := utils.GetFileFromURL(hintURL) + if e != nil { + return "" + } + return string(content) +} + func getMsgFromFile(configuration PluginConfiguration, change scm.RepositoryChange) string { _, err := url.ParseRequestURI(configuration.PluginHint) From bf096fd5e96a69061a398805ed6552ff6fc62d70 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Wed, 23 May 2018 17:45:18 +0530 Subject: [PATCH 13/26] fix: remove unnecasary code from test --- .../test-keeper/comment_message_test.go | 38 +++++++++++++++ .../test-keeper/configuration_gh_test.go | 47 +++---------------- 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/pkg/plugin/test-keeper/comment_message_test.go b/pkg/plugin/test-keeper/comment_message_test.go index c9204ef..4f82abc 100644 --- a/pkg/plugin/test-keeper/comment_message_test.go +++ b/pkg/plugin/test-keeper/comment_message_test.go @@ -44,6 +44,44 @@ var _ = Describe("Test keeper comment message creation", func() { }) }) + Context("Creation of default comment messages from default location when config plugin hint is not set", func() { + + BeforeEach(func() { + defer gock.OffAll() + }) + + It("should create message taken from a default file without setting it in configuration", func() { + // given + NonExistingRawGitHubFiles("test-keeper.yaml", "test-keeper.yml") + + gock.New("https://raw.githubusercontent.com"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/test-keeper_hint.md"). + Reply(200). + BodyString("Custom message") + + url := "http://github.com/my/repo/test-keeper.yaml" + conf := testkeeper.PluginConfiguration{ + PluginConfiguration: config.PluginConfiguration{ + LocationURL: url, + PluginName: testkeeper.ProwPluginName, + }, + } + + change := scm.RepositoryChange{ + Owner: "owner", + RepoName: "repo", + Hash: "46cb8fac44709e4ccaae97448c65e8f7320cfea7", + } + + // when + msg := testkeeper.CreateCommentMessage(conf, change) + sanitizedMsg := removeHtmlElements(msg) + + // then + Expect(sanitizedMsg).To(Equal("Custom message")) + }) + }) + Context("Creation of default comment messages that are sent to a validated PR when custom message file is set", func() { BeforeEach(func() { diff --git a/pkg/plugin/test-keeper/configuration_gh_test.go b/pkg/plugin/test-keeper/configuration_gh_test.go index c160094..1103dc9 100644 --- a/pkg/plugin/test-keeper/configuration_gh_test.go +++ b/pkg/plugin/test-keeper/configuration_gh_test.go @@ -8,6 +8,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "gopkg.in/h2non/gock.v1" + "github.com/arquillian/ike-prow-plugins/pkg/github/service" ) var _ = Describe("Test keeper config loader features", func() { @@ -21,13 +22,12 @@ var _ = Describe("Test keeper config loader features", func() { Context("Loading test-keeper configuration file from GitHub repository", func() { logger := log.NewTestLogger() + configFilePath := ghservice.ConfigHome + testkeeper.ProwPluginName It("should load test-keeper configuration yml file", func() { - // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yml"). Reply(200). BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n" + @@ -50,10 +50,8 @@ 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") - gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yml"). Reply(200). BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n" + @@ -77,10 +75,10 @@ var _ = Describe("Test keeper config loader features", func() { It("should load test-keeper configuration yaml file", func() { // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml", ".ike-prow/test-keeper_hint.md") + NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yaml"). Reply(200). BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n" + @@ -102,43 +100,12 @@ var _ = Describe("Test keeper config loader features", func() { Expect(configuration.Combine).To(BeTrue()) }) - It("should load test-keeper configuration yaml file with default hint file if present and not mentioned in configuration", func() { - // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") - - gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). - Reply(200). - BodyString("test_patterns: ['*my', 'test.go', 'pattern.js']\n" + - "skip_validation_for: ['pom.xml', 'regex{{*\\.adoc}}']\n") - - gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + "_hint.md"). - Reply(200). - BodyString("custom hint for plugin") - - change := scm.RepositoryChange{ - Owner: "owner", - RepoName: "repo", - Hash: "46cb8fac44709e4ccaae97448c65e8f7320cfea7", - } - - // when - configuration := testkeeper.LoadConfiguration(logger, change) - - // then - Expect(configuration.PluginHint).To(Equal("https://github.com/owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/test-keeper_hint.md")) - Expect(configuration.Inclusions).To(ConsistOf("*my", "test.go", "pattern.js")) - Expect(configuration.Exclusions).To(ConsistOf("pom.xml", "regex{{*\\.adoc}}")) - Expect(configuration.Combine).To(BeTrue()) - }) - It("should not load test-keeper configuration yaml file and return empty url when config is not accessible", func() { // given NonExistingRawGitHubFiles(".ike-prow/test-keeper.yml") gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/" + testkeeper.ProwPluginName + ".yaml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yaml"). Reply(404) change := scm.RepositoryChange{ From fd03a90effcf62f1710877621f2482d1893a09af Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Wed, 23 May 2018 18:03:22 +0530 Subject: [PATCH 14/26] fix: add comment for exported constant --- pkg/github/service/config_loader.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/github/service/config_loader.go b/pkg/github/service/config_loader.go index 79037a7..2de9223 100644 --- a/pkg/github/service/config_loader.go +++ b/pkg/github/service/config_loader.go @@ -9,6 +9,8 @@ import ( ) const githubBaseURL = "https://github.com/" + +// ConfigHome is a directory to keep prow configuration files const ConfigHome = ".ike-prow/" // LoadableConfig holds information about the plugin name, repository change and pointer to base config From 61fff53e8efab7060bdbfd99e8668062c38608bf Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Wed, 23 May 2018 18:04:34 +0530 Subject: [PATCH 15/26] chore: remove unnecessary mocking in test and use const variable --- pkg/plugin/test-keeper/configuration_gh_test.go | 2 +- pkg/plugin/test-keeper/event_handler_gh_test.go | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/plugin/test-keeper/configuration_gh_test.go b/pkg/plugin/test-keeper/configuration_gh_test.go index 1103dc9..195fcee 100644 --- a/pkg/plugin/test-keeper/configuration_gh_test.go +++ b/pkg/plugin/test-keeper/configuration_gh_test.go @@ -25,7 +25,7 @@ var _ = Describe("Test keeper config loader features", func() { configFilePath := ghservice.ConfigHome + testkeeper.ProwPluginName It("should load test-keeper configuration yml file", func() { - + // given gock.New("https://raw.githubusercontent.com"). Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yml"). Reply(200). diff --git a/pkg/plugin/test-keeper/event_handler_gh_test.go b/pkg/plugin/test-keeper/event_handler_gh_test.go index 2ab8393..3419ee3 100644 --- a/pkg/plugin/test-keeper/event_handler_gh_test.go +++ b/pkg/plugin/test-keeper/event_handler_gh_test.go @@ -77,14 +77,13 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve opened pull request when tests included based on configured pattern and defaults (implicitly combined)", func() { // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") gockEmptyComments(2) gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). Reply(200). BodyString("test_patterns: ['**/*_test_suite.go']\n" + - "skip_validation_for: ['README.adoc']") + "skip_validation_for: ['README.adoc']") gock.New("https://api.github.com"). Get("/repos/" + repositoryName + "/pulls/2/files"). @@ -107,11 +106,10 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve new pull request without tests when it comes with configuration excluding all files from test presence check (implicitly combined)", func() { // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md") gockEmptyComments(1) gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/prs/without_tests/test-keeper-ignore-randomfile.yml")) @@ -137,11 +135,11 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should reject opened pull request when no tests are matching defined pattern with no defaults implicitly combined", func() { // given - NonExistingRawGitHubFiles(".ike-prow/test-keeper_hint.md", ".ike-prow/test-keeper_hint.md") + NonExistingRawGitHubFiles(ghservice.ConfigHome + "test-keeper_hint.md") gockEmptyComments(2) gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/.ike-prow/test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/prs/with_tests/test-keeper.yml")) From 12a8d5e413719722cf6d149ec32a0d84e78c6ea8 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 24 May 2018 10:57:16 +0530 Subject: [PATCH 16/26] chore: use format function for all part --- pkg/plugin/test-keeper/comment_message.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/plugin/test-keeper/comment_message.go b/pkg/plugin/test-keeper/comment_message.go index 866ae9e..e678065 100644 --- a/pkg/plugin/test-keeper/comment_message.go +++ b/pkg/plugin/test-keeper/comment_message.go @@ -59,7 +59,7 @@ func getMsgFromConfigHint(configuration PluginConfiguration, change scm.Reposito } func defaultFileContent(configuration PluginConfiguration, change scm.RepositoryChange) string { - pluginHintPath := fmt.Sprintf(ghservice.ConfigHome+"%s_hint.md", configuration.PluginName) + pluginHintPath := fmt.Sprintf("%s%s_hint.md", ghservice.ConfigHome, configuration.PluginName) ghFileService := ghservice.RawFileService{Change: change} hintURL := ghFileService.GetRawFileURL(pluginHintPath) From f6e7fea78e4b248e492e678ff2e69e3967563a1d Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 24 May 2018 11:04:14 +0530 Subject: [PATCH 17/26] chore: extract configFilePath variable in test --- pkg/plugin/test-keeper/event_handler_gh_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/test-keeper/event_handler_gh_test.go b/pkg/plugin/test-keeper/event_handler_gh_test.go index 3419ee3..27310d5 100644 --- a/pkg/plugin/test-keeper/event_handler_gh_test.go +++ b/pkg/plugin/test-keeper/event_handler_gh_test.go @@ -26,6 +26,7 @@ var _ = Describe("Test Keeper Plugin features", func() { var handler *testkeeper.GitHubTestEventsHandler log := log.NewTestLogger() + configFilePath := ghservice.ConfigHome + testkeeper.ProwPluginName toBe := func(status, description, context, detailsLink string) SoftMatcher { return SoftlySatisfyAll( @@ -80,7 +81,7 @@ var _ = Describe("Test Keeper Plugin features", func() { gockEmptyComments(2) gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + configFilePath + ".yml"). Reply(200). BodyString("test_patterns: ['**/*_test_suite.go']\n" + "skip_validation_for: ['README.adoc']") @@ -109,7 +110,7 @@ var _ = Describe("Test Keeper Plugin features", func() { gockEmptyComments(1) gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + configFilePath + ".yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/prs/without_tests/test-keeper-ignore-randomfile.yml")) @@ -135,11 +136,11 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should reject opened pull request when no tests are matching defined pattern with no defaults implicitly combined", func() { // given - NonExistingRawGitHubFiles(ghservice.ConfigHome + "test-keeper_hint.md") + NonExistingRawGitHubFiles(configFilePath + "_hint.md") gockEmptyComments(2) gock.New("https://raw.githubusercontent.com"). - Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + ghservice.ConfigHome + "test-keeper.yml"). + Get(repositoryName + "/5d6e9b25da90edfc19f488e595e0645c081c1575/" + configFilePath + ".yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/prs/with_tests/test-keeper.yml")) From cca4a27a226c80be262aad7e83fc6d42dc0a1beb Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 24 May 2018 12:22:56 +0530 Subject: [PATCH 18/26] fix: add missing scenario - no config file, but hint file --- pkg/plugin/test-keeper/comment_message.go | 25 ++++++++++---- .../test-keeper/comment_message_test.go | 33 ++++++++++++++++++- .../test-keeper/event_handler_gh_test.go | 10 +++--- pkg/utils/url.go | 2 +- 4 files changed, 56 insertions(+), 14 deletions(-) diff --git a/pkg/plugin/test-keeper/comment_message.go b/pkg/plugin/test-keeper/comment_message.go index e678065..c7323d9 100644 --- a/pkg/plugin/test-keeper/comment_message.go +++ b/pkg/plugin/test-keeper/comment_message.go @@ -36,14 +36,25 @@ const ( // CreateCommentMessage creates a comment message for the test-keeper plugin. If the comment message is set in config then it takes that one, the default otherwise. func CreateCommentMessage(configuration PluginConfiguration, change scm.RepositoryChange) string { var msg string + var fileContent []byte if configuration.LocationURL == "" { - msg = sadIke + paragraph + beginning + paragraph + noConfig + fileContent = defaultFileContent(configuration, change); + if len(fileContent) > 0 { + msg = string(fileContent); + } else { + msg = sadIke + paragraph + beginning + paragraph + noConfig + } } else if configuration.PluginHint != "" { msg = getMsgFromConfigHint(configuration, change) - } else if content := defaultFileContent(configuration, change); content != "" { - msg = content } else { - msg = sadIke + paragraph + getMsgWithConfigRef(configuration.LocationURL) + if fileContent == nil { + fileContent = defaultFileContent(configuration, change); + } + if len(fileContent) > 0 { + msg = string(fileContent) + } else { + msg = sadIke + paragraph + getMsgWithConfigRef(configuration.LocationURL) + } } return msg } @@ -58,16 +69,16 @@ func getMsgFromConfigHint(configuration PluginConfiguration, change scm.Reposito return configuration.PluginHint } -func defaultFileContent(configuration PluginConfiguration, change scm.RepositoryChange) string { +func defaultFileContent(configuration PluginConfiguration, change scm.RepositoryChange) ([]byte) { pluginHintPath := fmt.Sprintf("%s%s_hint.md", ghservice.ConfigHome, configuration.PluginName) ghFileService := ghservice.RawFileService{Change: change} hintURL := ghFileService.GetRawFileURL(pluginHintPath) content, e := utils.GetFileFromURL(hintURL) if e != nil { - return "" + return make([]byte, 0) } - return string(content) + return content } func getMsgFromFile(configuration PluginConfiguration, change scm.RepositoryChange) string { diff --git a/pkg/plugin/test-keeper/comment_message_test.go b/pkg/plugin/test-keeper/comment_message_test.go index 4f82abc..23b069d 100644 --- a/pkg/plugin/test-keeper/comment_message_test.go +++ b/pkg/plugin/test-keeper/comment_message_test.go @@ -50,7 +50,38 @@ var _ = Describe("Test keeper comment message creation", func() { defer gock.OffAll() }) - It("should create message taken from a default file without setting it in configuration", func() { + It("should create message taken from a default hint file if plugin hint url is missing", func() { + // given + NonExistingRawGitHubFiles("test-keeper.yaml", "test-keeper.yml") + + gock.New("https://raw.githubusercontent.com"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/.ike-prow/test-keeper_hint.md"). + Reply(200). + BodyString("Custom message") + + url := "http://github.com/my/repo/test-keeper.yaml" + conf := testkeeper.PluginConfiguration{ + PluginConfiguration: config.PluginConfiguration{ + LocationURL: url, + PluginName: testkeeper.ProwPluginName, + }, + } + + change := scm.RepositoryChange{ + Owner: "owner", + RepoName: "repo", + Hash: "46cb8fac44709e4ccaae97448c65e8f7320cfea7", + } + + // when + msg := testkeeper.CreateCommentMessage(conf, change) + sanitizedMsg := removeHtmlElements(msg) + + // then + Expect(sanitizedMsg).To(Equal("Custom message")) + }) + + It("should create message taken from a default hint file if location url is missing", func() { // given NonExistingRawGitHubFiles("test-keeper.yaml", "test-keeper.yml") diff --git a/pkg/plugin/test-keeper/event_handler_gh_test.go b/pkg/plugin/test-keeper/event_handler_gh_test.go index 27310d5..8b6da6b 100644 --- a/pkg/plugin/test-keeper/event_handler_gh_test.go +++ b/pkg/plugin/test-keeper/event_handler_gh_test.go @@ -54,7 +54,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should approve opened pull request when tests included", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml") + NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml", "_hint.md") gockEmptyComments(2) gock.New("https://api.github.com"). @@ -170,7 +170,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should block newly created pull request when no tests are included", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml") + NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml","_hint.md") gockEmptyComments(1) gock.New("https://api.github.com"). @@ -223,7 +223,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should block newly created pull request when deletions in the tests are the only changes", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml") + NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml", "_hint.md") gockEmptyComments(1) gock.New("https://api.github.com"). @@ -252,7 +252,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should block newly created pull request when there are changes in the business logic but only deletions in the tests", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml") + NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml", "_hint.md") gockEmptyComments(1) gock.New("https://api.github.com"). @@ -323,7 +323,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should block pull request without tests and with comments containing bypass message added by user with insufficient permissions", func() { // given - NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml") + NonExistingRawGitHubFiles("test-keeper.yml", "test-keeper.yaml", "_hint.md") gock.New("https://api.github.com"). Get("/repos/" + repositoryName + "/issues/1/comments"). diff --git a/pkg/utils/url.go b/pkg/utils/url.go index b1fa85e..ed01b81 100644 --- a/pkg/utils/url.go +++ b/pkg/utils/url.go @@ -13,7 +13,7 @@ func GetFileFromURL(url string) ([]byte, error) { return nil, err } if resp.StatusCode >= 400 { - return []byte(""), errors.New("Server responded with error " + string(resp.StatusCode)) + return make([]byte, 0), errors.New("Server responded with error " + string(resp.StatusCode)) } defer func() { From 5e5bd42626e28e1f2614e5e95201b4cee18ba4ba Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 24 May 2018 12:39:09 +0530 Subject: [PATCH 19/26] doc: add doc for default loading behaviour of config hint file --- docs/plugins.adoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/plugins.adoc b/docs/plugins.adoc index 7124f62..a2d94c3 100644 --- a/docs/plugins.adoc +++ b/docs/plugins.adoc @@ -26,7 +26,10 @@ To enable customized plugin hint comment messages edit plugin's configuration fi plugin_hint: .ike-prow/test-keeper_hint.md ---- -The `plugin_hint` property can either have an inline string directly written inside of the config file or another file with case insensitive filename PLUGINNAME_HINT.md that contains the hint. The location of the file can be set by either a relative path or an absolute URL. If nothing is set then a default message is used. +The `plugin_hint` property can either have an inline string directly written inside of the config file or another file with case insensitive filename PLUGINNAME_HINT.md that contains the hint. The location of the file can be set by either a relative path or an absolute URL. + +NOTE: If you have `PLUGINNAME_HINT.md` file inside project's root `.ike-prow` directory and you are not using `plugin_hint` property in configuration file or not using any configuration file `PLUGINNAME.y(a)ml` (e.g.`test-keeper.yaml`) then plugin hint comment messages will be loaded from +default location `.ike-prow/PLUGINNAME_HINT.md` (e.g. `.ike-prow/test-keeper_hint.md`). If this is not the case then default message is used. ==== GitHub settings [[gh-settings]] From 1530326c3c209cc89af732495d6466c2053db09f Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 24 May 2018 14:16:59 +0530 Subject: [PATCH 20/26] fix: fix failing tests after merge --- pkg/plugin/work-in-progress/configuration_gh_test.go | 8 +++++--- pkg/plugin/work-in-progress/event_handler_gh_test.go | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/work-in-progress/configuration_gh_test.go b/pkg/plugin/work-in-progress/configuration_gh_test.go index 5f711d6..ef4eb04 100644 --- a/pkg/plugin/work-in-progress/configuration_gh_test.go +++ b/pkg/plugin/work-in-progress/configuration_gh_test.go @@ -3,11 +3,12 @@ package wip_test import ( . "github.com/arquillian/ike-prow-plugins/pkg/internal/test" "github.com/arquillian/ike-prow-plugins/pkg/log" - wip "github.com/arquillian/ike-prow-plugins/pkg/plugin/work-in-progress" + "github.com/arquillian/ike-prow-plugins/pkg/plugin/work-in-progress" "github.com/arquillian/ike-prow-plugins/pkg/scm" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "gopkg.in/h2non/gock.v1" + "github.com/arquillian/ike-prow-plugins/pkg/github/service" ) var _ = Describe("Work In Progress config loader features", func() { @@ -21,11 +22,12 @@ var _ = Describe("Work In Progress config loader features", func() { Context("Loading test-keeper configuration file from GitHub repository", func() { logger := log.NewTestLogger() + configFilePath := ghservice.ConfigHome + wip.ProwPluginName It("should load work-in-progress configuration yml file", func() { // given gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + wip.ProwPluginName + ".yml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yml"). Reply(200). BodyString("title_prefixes: ['[work in progress]', 'work in progress']") @@ -48,7 +50,7 @@ var _ = Describe("Work In Progress config loader features", func() { NonExistingRawGitHubFiles("work-in-progress.yml") gock.New("https://raw.githubusercontent.com"). - Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + wip.ProwPluginName + ".yaml"). + Get("owner/repo/46cb8fac44709e4ccaae97448c65e8f7320cfea7/" + configFilePath + ".yaml"). Reply(404) change := scm.RepositoryChange{ diff --git a/pkg/plugin/work-in-progress/event_handler_gh_test.go b/pkg/plugin/work-in-progress/event_handler_gh_test.go index 6928830..6c8a7f6 100644 --- a/pkg/plugin/work-in-progress/event_handler_gh_test.go +++ b/pkg/plugin/work-in-progress/event_handler_gh_test.go @@ -11,6 +11,7 @@ import ( "gopkg.in/h2non/gock.v1" "github.com/arquillian/ike-prow-plugins/pkg/github" + "github.com/arquillian/ike-prow-plugins/pkg/github/service" ) const ( @@ -26,6 +27,7 @@ var _ = Describe("Test Keeper Plugin features", func() { var handler *wip.GitHubWIPPRHandler log := log.NewTestLogger() + configFilePath := ghservice.ConfigHome + wip.ProwPluginName toHaveSuccessState := SoftlySatisfyAll( HaveState(github.StatusSuccess), @@ -87,7 +89,7 @@ var _ = Describe("Test Keeper Plugin features", func() { It("should mark opened PR as work-in-progress when title starts with configured prefix", func() { // given gock.New("https://raw.githubusercontent.com"). - Get("bartoszmajsak/wfswarm-booster-pipeline-test/8111c2d99b596877ff8e2059409688d83487da0e/work-in-progress.yml"). + Get("bartoszmajsak/wfswarm-booster-pipeline-test/8111c2d99b596877ff8e2059409688d83487da0e/" + configFilePath + ".yml"). Reply(200). Body(FromFile("test_fixtures/github_calls/work-in-progress.yml")) From 9fd8d2e2cf2b65183dab09a97f8d7137d0907045 Mon Sep 17 00:00:00 2001 From: Dipak Pawar Date: Thu, 24 May 2018 14:21:25 +0530 Subject: [PATCH 21/26] fix: modified CreateCommentMessage to not use nested else --- pkg/plugin/test-keeper/comment_message.go | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/pkg/plugin/test-keeper/comment_message.go b/pkg/plugin/test-keeper/comment_message.go index c7323d9..abc03ef 100644 --- a/pkg/plugin/test-keeper/comment_message.go +++ b/pkg/plugin/test-keeper/comment_message.go @@ -36,25 +36,14 @@ const ( // CreateCommentMessage creates a comment message for the test-keeper plugin. If the comment message is set in config then it takes that one, the default otherwise. func CreateCommentMessage(configuration PluginConfiguration, change scm.RepositoryChange) string { var msg string - var fileContent []byte - if configuration.LocationURL == "" { - fileContent = defaultFileContent(configuration, change); - if len(fileContent) > 0 { - msg = string(fileContent); - } else { - msg = sadIke + paragraph + beginning + paragraph + noConfig - } - } else if configuration.PluginHint != "" { + if configuration.PluginHint != "" { msg = getMsgFromConfigHint(configuration, change) + } else if content := defaultFileContent(configuration, change); len(content) > 0 { + msg = string(content) + } else if configuration.LocationURL == "" { + msg = sadIke + paragraph + beginning + paragraph + noConfig } else { - if fileContent == nil { - fileContent = defaultFileContent(configuration, change); - } - if len(fileContent) > 0 { - msg = string(fileContent) - } else { - msg = sadIke + paragraph + getMsgWithConfigRef(configuration.LocationURL) - } + msg = sadIke + paragraph + getMsgWithConfigRef(configuration.LocationURL) } return msg } From 317e2f8ab5c9f1e85579af765375ddfa9724180b Mon Sep 17 00:00:00 2001 From: Matous Jobanek Date: Thu, 24 May 2018 13:10:47 +0200 Subject: [PATCH 22/26] modifies documentation --- docs/plugins.adoc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/plugins.adoc b/docs/plugins.adoc index a2d94c3..4b520b8 100644 --- a/docs/plugins.adoc +++ b/docs/plugins.adoc @@ -18,19 +18,17 @@ organization. Be aware however, that adding an external plugin both to the repos Customized comment message can be configured as `plugin hint` to express suggestions regarding the plugin's intented behavior. + Eg. Configuring `plugin hint` for the `test-keeper` plugin adds comment message to the Pull Request when no test is found. -To enable customized plugin hint comment messages edit plugin's configuration file (eg. test-keeper.yaml) adding the `plugin_hint` property. +By default, the custom plugin hint message is loaded from a file `PLUGINNAME_HINT.md` located in ``.ike-prow/` directory (if present). The `PLUGINNAME` is a name of the plugin you want to set the custom hint message for, so for example `.ike-prow/test-keeper_hint.md`. +It is also possible to set other location of the hint file or directly the content of the message by editing plugin's configuration file (eg. test-keeper.yaml) and adding the `plugin_hint` property there: .test-keeper.yaml [source, yml, indent=0] ---- -plugin_hint: .ike-prow/test-keeper_hint.md +plugin_hint: plugins/test-keeper_hint.md ---- The `plugin_hint` property can either have an inline string directly written inside of the config file or another file with case insensitive filename PLUGINNAME_HINT.md that contains the hint. The location of the file can be set by either a relative path or an absolute URL. -NOTE: If you have `PLUGINNAME_HINT.md` file inside project's root `.ike-prow` directory and you are not using `plugin_hint` property in configuration file or not using any configuration file `PLUGINNAME.y(a)ml` (e.g.`test-keeper.yaml`) then plugin hint comment messages will be loaded from -default location `.ike-prow/PLUGINNAME_HINT.md` (e.g. `.ike-prow/test-keeper_hint.md`). If this is not the case then default message is used. - ==== GitHub settings [[gh-settings]] You will need two secrets to be able to integrate with GitHub. The `config/hmac.token` file should contain the token that From 264f9384f12d017c607959b7bf839b99bb0fe4e3 Mon Sep 17 00:00:00 2001 From: Matous Jobanek Date: Thu, 24 May 2018 13:18:08 +0200 Subject: [PATCH 23/26] brings back the string in defaultFileContent method to keep the comment_message.go consistent --- pkg/plugin/test-keeper/comment_message.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/plugin/test-keeper/comment_message.go b/pkg/plugin/test-keeper/comment_message.go index abc03ef..5b7277a 100644 --- a/pkg/plugin/test-keeper/comment_message.go +++ b/pkg/plugin/test-keeper/comment_message.go @@ -38,7 +38,7 @@ func CreateCommentMessage(configuration PluginConfiguration, change scm.Reposito var msg string if configuration.PluginHint != "" { msg = getMsgFromConfigHint(configuration, change) - } else if content := defaultFileContent(configuration, change); len(content) > 0 { + } else if content := defaultFileContent(configuration, change); content != "" { msg = string(content) } else if configuration.LocationURL == "" { msg = sadIke + paragraph + beginning + paragraph + noConfig @@ -58,16 +58,16 @@ func getMsgFromConfigHint(configuration PluginConfiguration, change scm.Reposito return configuration.PluginHint } -func defaultFileContent(configuration PluginConfiguration, change scm.RepositoryChange) ([]byte) { +func defaultFileContent(configuration PluginConfiguration, change scm.RepositoryChange) string { pluginHintPath := fmt.Sprintf("%s%s_hint.md", ghservice.ConfigHome, configuration.PluginName) ghFileService := ghservice.RawFileService{Change: change} hintURL := ghFileService.GetRawFileURL(pluginHintPath) content, e := utils.GetFileFromURL(hintURL) if e != nil { - return make([]byte, 0) + return "" } - return content + return string(content) } func getMsgFromFile(configuration PluginConfiguration, change scm.RepositoryChange) string { From 6b6d360aca3e9663c96e7cafe019fc5d587c2bff Mon Sep 17 00:00:00 2001 From: Matous Jobanek Date: Thu, 24 May 2018 13:24:03 +0200 Subject: [PATCH 24/26] removes location url in test case where it should be missing --- pkg/plugin/test-keeper/comment_message_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/plugin/test-keeper/comment_message_test.go b/pkg/plugin/test-keeper/comment_message_test.go index 23b069d..4e5e7b2 100644 --- a/pkg/plugin/test-keeper/comment_message_test.go +++ b/pkg/plugin/test-keeper/comment_message_test.go @@ -90,10 +90,8 @@ var _ = Describe("Test keeper comment message creation", func() { Reply(200). BodyString("Custom message") - url := "http://github.com/my/repo/test-keeper.yaml" conf := testkeeper.PluginConfiguration{ PluginConfiguration: config.PluginConfiguration{ - LocationURL: url, PluginName: testkeeper.ProwPluginName, }, } From 856bd0af1b8b37ca90ab37252e9c21123996888c Mon Sep 17 00:00:00 2001 From: Matous Jobanek Date: Thu, 24 May 2018 13:34:52 +0200 Subject: [PATCH 25/26] changes documentation so the content in plugins chapters reflects the new home --- docs/fragments/test-keeper.adoc | 2 +- docs/fragments/work-in-progress.adoc | 2 +- docs/plugins.adoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/fragments/test-keeper.adoc b/docs/fragments/test-keeper.adoc index 2ddede1..5374de6 100644 --- a/docs/fragments/test-keeper.adoc +++ b/docs/fragments/test-keeper.adoc @@ -34,7 +34,7 @@ NOTE: If we missed some important patterns feel free to open an link:https://git === Plugin Configuration [[test-keeper-config]] -To configure Test Keeper plugin place `test-keeper.yml` (or `test-keeper.yaml`) file in the root of your project and use properties described below. +To configure Test Keeper plugin place `test-keeper.yml` (or `test-keeper.yaml`) file inside of the directory `.ike-prow/` in your project and use properties described below. .test-keeper.yaml [source, yml, indent=0] diff --git a/docs/fragments/work-in-progress.adoc b/docs/fragments/work-in-progress.adoc index a833f72..b9b03e3 100644 --- a/docs/fragments/work-in-progress.adoc +++ b/docs/fragments/work-in-progress.adoc @@ -6,7 +6,7 @@ If the PR title starts with any of the default prefixes such as `WIP`, `DO NOT M === Plugin Configuration [[work-in-progress-config]] -To configure Work In Progress plugin place `work-in-progress.yml` (or `work-in-progress.yaml`) file in the root of your project and use properties described below. +To configure Work In Progress plugin place `work-in-progress.yml` (or `work-in-progress.yaml`) file inside of the directory `.ike-prow/` in your project and use properties described below. .work-in-progress.yaml [source, yml, indent=0] diff --git a/docs/plugins.adoc b/docs/plugins.adoc index 4b520b8..b61d4d3 100644 --- a/docs/plugins.adoc +++ b/docs/plugins.adoc @@ -18,7 +18,7 @@ organization. Be aware however, that adding an external plugin both to the repos Customized comment message can be configured as `plugin hint` to express suggestions regarding the plugin's intented behavior. + Eg. Configuring `plugin hint` for the `test-keeper` plugin adds comment message to the Pull Request when no test is found. -By default, the custom plugin hint message is loaded from a file `PLUGINNAME_HINT.md` located in ``.ike-prow/` directory (if present). The `PLUGINNAME` is a name of the plugin you want to set the custom hint message for, so for example `.ike-prow/test-keeper_hint.md`. +By default, the custom plugin hint message is loaded from a file `PLUGINNAME_HINT.md` located in `.ike-prow/` directory (if present). The `PLUGINNAME` is a name of the plugin you want to set the custom hint message for, so for example `.ike-prow/test-keeper_hint.md`. It is also possible to set other location of the hint file or directly the content of the message by editing plugin's configuration file (eg. test-keeper.yaml) and adding the `plugin_hint` property there: .test-keeper.yaml From 461112660040e501652820977d2f5e993601e037 Mon Sep 17 00:00:00 2001 From: Matous Jobanek Date: Thu, 24 May 2018 14:01:41 +0200 Subject: [PATCH 26/26] removed unnecessary conversion --- pkg/plugin/test-keeper/comment_message.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/plugin/test-keeper/comment_message.go b/pkg/plugin/test-keeper/comment_message.go index 5b7277a..0b09aaf 100644 --- a/pkg/plugin/test-keeper/comment_message.go +++ b/pkg/plugin/test-keeper/comment_message.go @@ -39,7 +39,7 @@ func CreateCommentMessage(configuration PluginConfiguration, change scm.Reposito if configuration.PluginHint != "" { msg = getMsgFromConfigHint(configuration, change) } else if content := defaultFileContent(configuration, change); content != "" { - msg = string(content) + msg = content } else if configuration.LocationURL == "" { msg = sadIke + paragraph + beginning + paragraph + noConfig } else {