Skip to content

Commit

Permalink
Revert "Merge pull request kubernetes#15403 from stevekuznetsov/skuzn…
Browse files Browse the repository at this point in the history
…ets/revert-naming"

This reverts commit c7a1250, reversing
changes made to 65030d6.

Signed-off-by: Steve Kuznetsov <[email protected]>
  • Loading branch information
stevekuznetsov committed Mar 13, 2020
1 parent a5764e9 commit 2e907ac
Show file tree
Hide file tree
Showing 39 changed files with 94 additions and 44 deletions.
3 changes: 2 additions & 1 deletion boskos/cmd/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func init() {
}

func main() {
logrusutil.ComponentInit("boskos-metrics")
logrusutil.ComponentInit()

flag.Parse()
boskos, err := client.NewClient("Metrics", boskosURL, username, passwordFile)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion experiment/resultstore/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func parseOptions() options {
}

func main() {
logrusutil.ComponentInit("storeship")
logrusutil.ComponentInit()

opt := parseOptions()
for {
Expand Down
2 changes: 1 addition & 1 deletion experiment/tracer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func gatherOptions() options {
}

func main() {
logrusutil.ComponentInit("tracer")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion ghproxy/ghproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func flagOptions() *options {
}

func main() {
logrusutil.ComponentInit("ghproxy")
logrusutil.ComponentInit()

o := flagOptions()
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion greenhouse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var diskCheckInterval = flag.Duration("disk-check-interval", time.Second*10,
var promMetrics *prometheusMetrics

func init() {
logrusutil.ComponentInit("greenhouse")
logrusutil.ComponentInit()

logrus.SetOutput(os.Stdout)
promMetrics = initMetrics()
Expand Down
2 changes: 1 addition & 1 deletion label_sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ func newClient(tokenPath string, tokens, tokenBurst int, dryRun bool, graphqlEnd
// It took about 10 minutes to process all my 8 repos with all wanted "kubernetes" labels (70+)
// Next run takes about 22 seconds to check if all labels are correct on all repos
func main() {
logrusutil.ComponentInit("label_sync")
logrusutil.ComponentInit()

flag.Parse()
if *debug {
Expand Down
2 changes: 1 addition & 1 deletion maintenance/migratestatus/migratestatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (o *options) Validate() error {
}

func main() {
logrusutil.ComponentInit("migratestatus")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions prow/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ filegroup(
"//prow/statusreconciler:all-srcs",
"//prow/test:all-srcs",
"//prow/tide:all-srcs",
"//prow/version:all-srcs",
],
tags = ["automanaged"],
)
2 changes: 1 addition & 1 deletion prow/cmd/admission/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (o *options) parse(flags *flag.FlagSet, args []string) error {
}

func main() {
logrusutil.ComponentInit("admission")
logrusutil.ComponentInit()

o := parseOptions()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/branchprotector/protect.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (e *Errors) add(err error) {
}

func main() {
logrusutil.ComponentInit("branchprotector")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/checkconfig/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (o *options) gatherOptions(flag *flag.FlagSet, args []string) error {
}

func main() {
logrusutil.ComponentInit("checkconfig")
logrusutil.ComponentInit()

o, err := parseOptions()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/clonerefs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

func main() {
logrusutil.ComponentInit("clonerefs")
logrusutil.ComponentInit()

o := &clonerefs.Options{}
if err := options.Load(o); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/config-bootstrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func run(sourcePaths []string, defaultNamespace string, configUpdater plugins.Co
}

func main() {
logrusutil.ComponentInit("config-bootstrapper")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/crier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func parseOptions() options {
}

func main() {
logrusutil.ComponentInit("crier")
logrusutil.ComponentInit()

o := parseOptions()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/deck/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func v(fragment string, children ...simplifypath.Node) simplifypath.Node {
}

func main() {
logrusutil.ComponentInit("deck")
logrusutil.ComponentInit()

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/entrypoint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

func main() {
logrusutil.ComponentInit("entrypoint")
logrusutil.ComponentInit()

o := entrypoint.NewOptions()
if err := options.Load(o); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func mustRegister(component string, lister lister) *prometheus.Registry {
}

func main() {
logrusutil.ComponentInit("exporter")
logrusutil.ComponentInit()
o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
if err := o.Validate(); err != nil {
logrus.WithError(err).Fatal("Invalid options")
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/gcsupload/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

func main() {
logrusutil.ComponentInit("gcsupload")
logrusutil.ComponentInit()

o := gcsupload.NewOptions()
if err := options.Load(o); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/gerrit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (st *syncTime) Update(newState client.LastSyncState) error {
}

func main() {
logrusutil.ComponentInit("gerrit")
logrusutil.ComponentInit()

defer interrupts.WaitForGracefulShutdown()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/hook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func gatherOptions(fs *flag.FlagSet, args ...string) options {
}

func main() {
logrusutil.ComponentInit("hook")
logrusutil.ComponentInit()

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/horologium/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (o *options) Validate() error {
}

func main() {
logrusutil.ComponentInit("horologium")
logrusutil.ComponentInit()

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/initupload/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

func main() {
logrusutil.ComponentInit("initupload")
logrusutil.ComponentInit()

o := initupload.NewOptions()
if err := options.Load(o); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/jenkins-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func gatherOptions() options {
}

func main() {
logrusutil.ComponentInit("jenkins-operator")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/peribolos/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (o *options) parseArgs(flags *flag.FlagSet, args []string) error {
}

func main() {
logrusutil.ComponentInit("peribolos")
logrusutil.ComponentInit()

o := parseOptions()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/pipeline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func newPipelineConfig(cfg rest.Config, stop <-chan struct{}) (*pipelineConfig,
}

func main() {
logrusutil.ComponentInit("pipeline")
logrusutil.ComponentInit()

o := parseOptions()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/plank/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (o *options) Validate() error {
}

func main() {
logrusutil.ComponentInit("plank")
logrusutil.ComponentInit()

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/sidecar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func main() {
logrusutil.ComponentInit("sidecar")
logrusutil.ComponentInit()

o := sidecar.NewOptions()
if err := options.Load(o); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/sinker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (o *options) Validate() error {
}

func main() {
logrusutil.ComponentInit("sinker")
logrusutil.ComponentInit()

o := gatherOptions(flag.NewFlagSet(os.Args[0], flag.ExitOnError), os.Args[1:]...)
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/status-reconciler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (o *options) Validate() error {
}

func main() {
logrusutil.ComponentInit("status-reconciler")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/sub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func init() {
}

func main() {
logrusutil.ComponentInit("pubsub-subscriber")
logrusutil.ComponentInit()

configAgent := &config.Agent{}
if err := configAgent.Start(flagOptions.configPath, flagOptions.jobConfigPath); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/tide/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func gatherOptions(fs *flag.FlagSet, args ...string) options {
}

func main() {
logrusutil.ComponentInit("tide")
logrusutil.ComponentInit()

defer interrupts.WaitForGracefulShutdown()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/tot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (f fallbackHandler) getURL(jobName string) string {
}

func main() {
logrusutil.ComponentInit("tot")
logrusutil.ComponentInit()

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions prow/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def prow_image(
goarch = "amd64",
goos = "linux",
pure = "on",
x_defs = {"k8s.io/test-infra/prow/version.Name": name},
)

container_image(
Expand Down
1 change: 1 addition & 0 deletions prow/github/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ go_library(
deps = [
"//ghproxy/ghcache:go_default_library",
"//prow/errorutil:go_default_library",
"//prow/version:go_default_library",
"@com_github_shurcool_githubv4//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_k8s_sigs_yaml//:go_default_library",
Expand Down
28 changes: 18 additions & 10 deletions prow/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ import (
githubql "github.com/shurcooL/githubv4"
"github.com/sirupsen/logrus"
"golang.org/x/oauth2"

"k8s.io/test-infra/ghproxy/ghcache"
"k8s.io/test-infra/prow/errorutil"
"k8s.io/test-infra/prow/version"
)

type timeClient interface {
Expand Down Expand Up @@ -247,14 +249,15 @@ type delegate struct {
maxSleepTime time.Duration
initialDelay time.Duration

gqlc gqlClient
client httpClient
bases []string
dry bool
fake bool
throttle throttler
getToken func() []byte
censor func([]byte) []byte
userAgent string
gqlc gqlClient
client httpClient
bases []string
dry bool
fake bool
throttle throttler
getToken func() []byte
censor func([]byte) []byte

mut sync.Mutex // protects botName and email
userData *User
Expand Down Expand Up @@ -434,7 +437,8 @@ func NewClientWithFields(fields logrus.Fields, getToken func() []byte, censor fu
return &client{
logger: logrus.WithFields(fields).WithField("client", "github"),
delegate: &delegate{
time: &standardTime{},
time: &standardTime{},
userAgent: version.UserAgent(),
gqlc: githubql.NewEnterpriseClient(
graphqlEndpoint,
&http.Client{
Expand Down Expand Up @@ -471,7 +475,8 @@ func NewDryRunClientWithFields(fields logrus.Fields, getToken func() []byte, cen
return &client{
logger: logrus.WithFields(fields).WithField("client", "github"),
delegate: &delegate{
time: &standardTime{},
time: &standardTime{},
userAgent: version.UserAgent(),
gqlc: githubql.NewEnterpriseClient(
graphqlEndpoint,
&http.Client{
Expand Down Expand Up @@ -751,6 +756,9 @@ func (c *client) doRequest(method, path, accept string, body interface{}) (*http
} else {
req.Header.Add("Accept", accept)
}
if c.userAgent != "" {
req.Header.Add("User-Agent", c.userAgent)
}
// Disable keep-alive so that we don't get flakes when GitHub closes the
// connection prematurely.
// https://go-review.googlesource.com/#/c/3210/ fixed it for GET, but not
Expand Down
1 change: 1 addition & 0 deletions prow/logrusutil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
importpath = "k8s.io/test-infra/prow/logrusutil",
visibility = ["//visibility:public"],
deps = [
"//prow/version:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_k8s_apimachinery//pkg/util/sets:go_default_library",
],
Expand Down
Loading

0 comments on commit 2e907ac

Please sign in to comment.