Skip to content

Commit c667db9

Browse files
authored
feat: remove single repo settings (#4)
* Revert "feat: allow enable needs-retitle like a non external plugin (#3)" This reverts commit e5619c5. * fix: updated npm dependencies
1 parent e5619c5 commit c667db9

File tree

9 files changed

+269
-1151
lines changed

9 files changed

+269
-1151
lines changed

README.md

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
- [Overview](#overview)
44
- [Configuration](#configuration)
5-
- [Enable only in some repositories of an organization](#enable-only-in-some-repositories-of-an-organization)
65
- [Build](#build)
76
- [Deploy](#deploy)
87

@@ -78,74 +77,6 @@ You'll need to add new things to your prow `plugins.yaml` file:
7877
- needs-retitle
7978
```
8079
81-
### Enable only in some repositories of an organization
82-
83-
To enable the plugin only in some repositories of the same organization you have two options:
84-
85-
* You can add to the `external_plugins` options all the repositories you want like:
86-
87-
```
88-
external_plugins:
89-
org-foo/repo-bar:
90-
- name: needs-retitle
91-
events:
92-
- pull_request
93-
org-foo/repo-bar-2:
94-
- name: needs-retitle
95-
events:
96-
- pull_request
97-
org-foo/repo-bar-3:
98-
- name: needs-retitle
99-
events:
100-
- pull_request
101-
...
102-
```
103-
104-
* You can use `require_enable_as_not_external`, this way you can enable the plugin for the whole organization at the `external_plugins` config level, and then just add the plugin to each repo like any other plugin, example:
105-
106-
* First we enable the `require_enable_as_not_external` setting for the plugin:
107-
108-
```
109-
needs_retitle:
110-
regexp: "^(fix:|feat:|major:).*$"
111-
require_enable_as_not_external: true
112-
error_message: |
113-
Invalid title for the PR, the title needs to be like:
114-
115-
fix: this is a fix commit
116-
feat: this is a feature commit
117-
major: this is a major commit
118-
```
119-
120-
* Then we enable the plugin for the whole organization in `external_plugins`:
121-
122-
```
123-
external_plugins:
124-
org-foo:
125-
- name: needs-retitle
126-
events:
127-
- pull_request
128-
```
129-
130-
* And now we enable it like any other plugin for the repositories:
131-
132-
```
133-
plugins:
134-
org-foo/test-infra:
135-
- approve
136-
- assign
137-
- config-updater
138-
- needs-retitle
139-
org-foo/my-repo:
140-
- approve
141-
- assign
142-
- lgtm
143-
- needs-retitle
144-
org-foo/another-repo:
145-
- trigger
146-
- needs-retitle
147-
```
148-
14980
## Build
15081
15182
* To make just the binary run: `make build`

cmd/needs-retitle/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ func main() {
9999
log.WithError(err).Fatalf("Error loading plugin config from %q.", o.pluginConfig)
100100
}
101101

102-
p := plugin.NewPlugin(pa)
103-
104-
pca := config.NewPluginConfigAgent(p)
102+
pca := config.NewPluginConfigAgent()
105103
if err := pca.Start(o.pluginConfig); err != nil {
106104
log.WithError(err).Fatalf("Error loading %s config from %q.", plugin.PluginName, o.pluginConfig)
107105
}
@@ -118,7 +116,7 @@ func main() {
118116

119117
interrupts.TickLiteral(func() {
120118
start := time.Now()
121-
if err := pca.GetPlugin().HandleAll(log, githubClient); err != nil {
119+
if err := pca.GetPlugin().HandleAll(log, githubClient, pa.Config()); err != nil {
122120
log.WithError(err).Error("Error during periodic update of all PRs.")
123121
}
124122
log.WithField("duration", fmt.Sprintf("%v", time.Since(start))).Info("Periodic update complete.")

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ require (
2020
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect
2121
gopkg.in/yaml.v2 v2.3.0 // indirect
2222
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
23-
gotest.tools v2.2.0+incompatible
2423
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
2524
k8s.io/test-infra v0.0.0-20200702033203-1e71b3526aef
2625
sigs.k8s.io/yaml v1.2.0

0 commit comments

Comments
 (0)