Skip to content

Commit

Permalink
Moving from tep-notifier to bots/tep-automation and adding tracking i…
Browse files Browse the repository at this point in the history
…ssue creation

Second part of implementing tektoncd/community#594

Signed-off-by: Andrew Bayer <[email protected]>
  • Loading branch information
abayer committed Jan 13, 2022
1 parent 0f71f5f commit 85a9d4b
Show file tree
Hide file tree
Showing 49 changed files with 4,270 additions and 1,809 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tep-notifier/Makefile → bots/tep-automation/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BINARY_NAME = tep-notifier
BINARY_NAME = tep-automation

GO = go
BIN = $(CURDIR)/.bin
Expand Down Expand Up @@ -56,7 +56,7 @@ test: test-unit ## run all tests
.PHONY: test-unit
test-unit: ## run unit tests
@echo "Running unit tests..."
@$(GO) test -failfast -v -cover ./...
@$(GO) test -short -cover ./...

.PHONY: clean
clean: ## clean build artifacts
Expand Down Expand Up @@ -84,7 +84,7 @@ $(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/goimports
.PHONY: goimports
goimports: $(GOIMPORTS)
@echo "Running goimports..."
@$(GOIMPORTS) -l -e -w pkg
@$(GOIMPORTS) -l -e -w pkg cmd

.PHONY: fmt
fmt: goimports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package main

import (
"flag"
"github.com/tektoncd/plumbing/tep-notifier/pkg/reconciler"
"log"

"github.com/tektoncd/plumbing/bots/tep-automation/pkg/performers"
"github.com/tektoncd/plumbing/bots/tep-automation/pkg/reconciler"
"knative.dev/pkg/injection/sharedmain"
"knative.dev/pkg/signals"
"log"
)

var (
Expand All @@ -18,5 +20,11 @@ func main() {
if ghToken == nil {
log.Fatal("no github-token specified")
}
sharedmain.MainWithContext(signals.NewContext(), reconciler.ControllerName, reconciler.NewController(*ghToken))

sharedmain.MainWithContext(signals.NewContext(), reconciler.ControllerName,
reconciler.NewController(
*ghToken,
performers.NewPRNotifierAsPerformer,
performers.NewIssueCreatorAsPerformer,
))
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tekton-tep-notifier-controller-cluster-access
name: tekton-tep-automation-controller-cluster-access
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
rules:
# Controller needs cluster access to all of the CRDs that it is responsible for managing.
- apiGroups: ["tekton.dev"]
Expand All @@ -33,11 +33,11 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
# This is the access that the controller needs on a per-namespace basis.
name: tekton-tep-notifier-controller-tenant-access
name: tekton-tep-automation-controller-tenant-access
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
rules:
- apiGroups: [""]
resources: ["events"]
Expand All @@ -46,10 +46,10 @@ rules:
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tekton-tep-notifier-leader-election
name: tekton-tep-automation-leader-election
labels:
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
rules:
# We uses leases for leaderelection
- apiGroups: ["coordination.k8s.io"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
rules:
- apiGroups: [""]
resources: ["configmaps"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
subjects:
- kind: ServiceAccount
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
roleRef:
kind: Role
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,54 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tekton-tep-notifier-controller-cluster-access
name: tekton-tep-automation-controller-cluster-access
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
subjects:
- kind: ServiceAccount
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
roleRef:
kind: ClusterRole
name: tekton-tep-notifier-controller-cluster-access
name: tekton-tep-automation-controller-cluster-access
apiGroup: rbac.authorization.k8s.io
---
# If this ClusterRoleBinding is replaced with a RoleBinding
# then the ClusterRole would be namespaced. The access described by
# the tekton-tep-notifier-controller-tenant-access ClusterRole would
# the tekton-tep-automation-controller-tenant-access ClusterRole would
# be scoped to individual tenant namespaces.
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tekton-tep-notifier-controller-tenant-access
name: tekton-tep-automation-controller-tenant-access
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
subjects:
- kind: ServiceAccount
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
roleRef:
kind: ClusterRole
name: tekton-tep-notifier-controller-tenant-access
name: tekton-tep-automation-controller-tenant-access
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: tekton-tep-notifier-controller-leaderelection
name: tekton-tep-automation-controller-leaderelection
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
subjects:
- kind: ServiceAccount
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
roleRef:
kind: ClusterRole
name: tekton-tep-notifier-leader-election
name: tekton-tep-automation-leader-election
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-tep-notifier-controller
name: tekton-tep-automation-controller
namespace: tekton-pipelines
labels:
app.kubernetes.io/name: controller
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/version: "devel"
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
# tekton.dev/release value replaced with inputs.params.versionTag in pipeline/tekton/publish.yaml
pipeline.tekton.dev/release: "devel"
# labels below are related to istio and should not be used for resource lookup
Expand All @@ -34,7 +34,7 @@ spec:
app.kubernetes.io/name: controller
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
template:
metadata:
annotations:
Expand All @@ -44,17 +44,17 @@ spec:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: default
app.kubernetes.io/version: "devel"
app.kubernetes.io/part-of: tekton-plumbing-tep-notifier
app.kubernetes.io/part-of: tekton-plumbing-tep-automation
# tekton.dev/release value replaced with inputs.params.versionTag in pipeline/tekton/publish.yaml
pipeline.tekton.dev/release: "devel"
# labels below are related to istio and should not be used for resource lookup
app: tekton-tep-notifier-controller
app: tekton-tep-automation-controller
version: "devel"
spec:
serviceAccountName: tekton-tep-notifier-controller
serviceAccountName: tekton-tep-automation-controller
containers:
- name: tekton-tep-notifier-controller
image: ko://github.com/tektoncd/plumbing/tep-notifier/cmd/controller
- name: tekton-tep-automation-controller
image: ko://github.com/tektoncd/plumbing/tep-automation/cmd/controller
env:
- name: SYSTEM_NAMESPACE
valueFrom:
Expand All @@ -67,7 +67,7 @@ spec:
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
- name: METRICS_DOMAIN
value: plumbing.tekton.dev/tep-notifier
value: plumbing.tekton.dev/tep-automation
securityContext:
allowPrivilegeEscalation: false
runAsUser: 1001
10 changes: 6 additions & 4 deletions tep-notifier/go.mod → bots/tep-automation/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
module github.com/tektoncd/plumbing/tep-notifier
module github.com/tektoncd/plumbing/bots/tep-automation

go 1.17

require (
github.com/google/go-cmp v0.5.6
github.com/google/go-github/v41 v41.0.0
github.com/hashicorp/go-multierror v1.1.1
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0
github.com/tektoncd/pipeline v0.31.0
github.com/yuin/goldmark v1.4.4
github.com/yuin/goldmark-meta v1.0.0
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
k8s.io/api v0.21.4
k8s.io/apimachinery v0.21.4
k8s.io/client-go v0.21.4
knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc
)
Expand Down Expand Up @@ -44,7 +49,6 @@ require (
github.com/googleapis/gnostic v0.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down Expand Up @@ -82,9 +86,7 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.21.4 // indirect
k8s.io/apiextensions-apiserver v0.21.4 // indirect
k8s.io/apimachinery v0.21.4 // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/klog/v2 v2.8.0 // indirect
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
Expand Down
4 changes: 4 additions & 0 deletions tep-notifier/go.sum → bots/tep-automation/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,10 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.4 h1:zNWRjYUW32G9KirMXYHQHVNFkXvMI7LpgNW2AgYAoIs=
github.com/yuin/goldmark v1.4.4/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg=
github.com/yuin/goldmark-meta v1.0.0 h1:ScsatUIT2gFS6azqzLGUjgOnELsBOxMXerM3ogdJhAM=
github.com/yuin/goldmark-meta v1.0.0/go.mod h1:zsNNOrZ4nLuyHAJeLQEZcQat8dm70SmB2kHbls092Gc=
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
Expand Down
Loading

0 comments on commit 85a9d4b

Please sign in to comment.