Skip to content

Commit

Permalink
Revert "Merge pull request kubernetes#15320 from stevekuznetsov/skuzn…
Browse files Browse the repository at this point in the history
…ets/github-user-agent"

This reverts commit 55b023d, reversing
changes made to 9c4352d.

Signed-off-by: Steve Kuznetsov <[email protected]>
  • Loading branch information
stevekuznetsov committed Nov 26, 2019
1 parent 65030d6 commit d65fde4
Show file tree
Hide file tree
Showing 40 changed files with 45 additions and 94 deletions.
2 changes: 1 addition & 1 deletion boskos/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func init() {
}

func main() {
logrusutil.ComponentInit()
logrusutil.ComponentInit("boskos-metrics")
boskos := client.NewClient("Metrics", "http://boskos")
logrus.Infof("Initialzied boskos client!")

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

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

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()
logrusutil.ComponentInit("tracer")

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()
logrusutil.ComponentInit("ghproxy")

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()
logrusutil.ComponentInit("greenhouse")

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()
logrusutil.ComponentInit("label_sync")

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 @@ -107,7 +107,7 @@ func (o *options) Validate() error {
}

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

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
1 change: 0 additions & 1 deletion prow/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ 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()
logrusutil.ComponentInit("admission")

o := parseOptions()

Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/artifact-uploader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (o *Options) Run() error {
}

func main() {
logrusutil.ComponentInit()
logrusutil.ComponentInit("artifact-uploader")

o := newOptions()
if err := options.Load(o); err != nil {
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 @@ -90,7 +90,7 @@ func (e *Errors) add(err error) {
}

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

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 @@ -171,7 +171,7 @@ func (o *options) gatherOptions(flag *flag.FlagSet, args []string) error {
}

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

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()
logrusutil.ComponentInit("clonerefs")

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 @@ -76,7 +76,7 @@ func (o *options) Validate() error {

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

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 @@ -156,7 +156,7 @@ func parseOptions() options {
}

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

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 @@ -304,7 +304,7 @@ func v(fragment string, children ...simplifypath.Node) simplifypath.Node {
}

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

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()
logrusutil.ComponentInit("entrypoint")

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()
logrusutil.ComponentInit("exporter")
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()
logrusutil.ComponentInit("gcsupload")

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 @@ -213,7 +213,7 @@ func (st *syncTime) Update(newState client.LastSyncState) error {
}

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

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 @@ -91,7 +91,7 @@ func gatherOptions(fs *flag.FlagSet, args ...string) options {
}

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

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()
logrusutil.ComponentInit("horologium")

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()
logrusutil.ComponentInit("initupload")

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 @@ -122,7 +122,7 @@ func gatherOptions() options {
}

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

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()
logrusutil.ComponentInit("peribolos")

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 @@ -108,7 +108,7 @@ func newPipelineConfig(cfg rest.Config, stop <-chan struct{}) (*pipelineConfig,
}

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

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 @@ -84,7 +84,7 @@ func (o *options) Validate() error {
}

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

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()
logrusutil.ComponentInit("sidecar")

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 @@ -88,7 +88,7 @@ func (o *options) Validate() error {
}

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

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 @@ -87,7 +87,7 @@ func (o *options) Validate() error {
}

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

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()
logrusutil.ComponentInit("pubsub-subscriber")

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 @@ -105,7 +105,7 @@ func gatherOptions(fs *flag.FlagSet, args ...string) options {
}

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

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()
logrusutil.ComponentInit("tot")

o := gatherOptions()
if err := o.Validate(); err != nil {
Expand Down
1 change: 0 additions & 1 deletion prow/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ 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: 0 additions & 1 deletion prow/github/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ 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",
"@org_golang_x_oauth2//:go_default_library",
Expand Down
28 changes: 10 additions & 18 deletions prow/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ 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 @@ -249,15 +247,14 @@ type delegate struct {
maxSleepTime time.Duration
initialDelay time.Duration

userAgent string
gqlc gqlClient
client httpClient
bases []string
dry bool
fake bool
throttle throttler
getToken func() []byte
censor func([]byte) []byte
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 @@ -437,8 +434,7 @@ func NewClientWithFields(fields logrus.Fields, getToken func() []byte, censor fu
return &client{
logger: logrus.WithFields(fields).WithField("client", "github"),
delegate: &delegate{
time: &standardTime{},
userAgent: version.UserAgent(),
time: &standardTime{},
gqlc: githubql.NewEnterpriseClient(
graphqlEndpoint,
&http.Client{
Expand Down Expand Up @@ -475,8 +471,7 @@ func NewDryRunClientWithFields(fields logrus.Fields, getToken func() []byte, cen
return &client{
logger: logrus.WithFields(fields).WithField("client", "github"),
delegate: &delegate{
time: &standardTime{},
userAgent: version.UserAgent(),
time: &standardTime{},
gqlc: githubql.NewEnterpriseClient(
graphqlEndpoint,
&http.Client{
Expand Down Expand Up @@ -742,9 +737,6 @@ 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: 0 additions & 1 deletion prow/logrusutil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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 d65fde4

Please sign in to comment.