Skip to content

Commit

Permalink
boskos: move main packages into cmd/
Browse files Browse the repository at this point in the history
  • Loading branch information
ixdy committed Feb 6, 2020
1 parent 93acd94 commit 61838e1
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 75 deletions.
73 changes: 13 additions & 60 deletions boskos/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,73 +1,23 @@
package(default_visibility = ["//visibility:public"])

load("//def:image.bzl", "tags")
load("//prow:def.bzl", "prow_image", "prow_push")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")

go_binary(
name = "boskos",
embed = [":go_default_library"],
pure = "on",
)

prow_image(
name = "image",
visibility = ["//visibility:public"],
)
load("//prow:def.bzl", "prow_push")

prow_push(
name = "push",
images = tags(targets = {
"{STABLE_PROW_REPO}/boskos/aws-janitor": "//boskos/aws-janitor:image",
"{STABLE_PROW_REPO}/boskos/aws-janitor-boskos": "//boskos/aws-janitor/cmd/aws-janitor-boskos:image",
"{STABLE_PROW_REPO}/boskos/boskos": "//boskos:image",
"{STABLE_PROW_REPO}/boskos/fake-mason": "//boskos/mason/fake-mason:image",
"{STABLE_PROW_REPO}/boskos/cleaner": "//boskos/cleaner/cmd:image",
"{STABLE_PROW_REPO}/boskos/janitor": "//boskos/janitor:image",
"{STABLE_PROW_REPO}/boskos/metrics": "//boskos/metrics:image",
"{STABLE_PROW_REPO}/boskos/reaper": "//boskos/reaper:image",
"{STABLE_PROW_REPO}/boskos/boskos": "//boskos/cmd/boskos:image",
"{STABLE_PROW_REPO}/boskos/fake-mason": "//boskos/cmd/fake-mason:image",
"{STABLE_PROW_REPO}/boskos/cleaner": "//boskos/cmd/cleaner:image",
"{STABLE_PROW_REPO}/boskos/janitor": "//boskos/cmd/janitor:image",
"{STABLE_PROW_REPO}/boskos/metrics": "//boskos/cmd/metrics:image",
"{STABLE_PROW_REPO}/boskos/reaper": "//boskos/cmd/reaper:image",
"{STABLE_PROW_REPO}/boskos/cli": "//boskos/cmd/cli:image",
}),
)

go_test(
name = "go_default_test",
srcs = [
"boskos_test.go",
"server_client_test.go",
"storage_test.go",
],
embed = [":go_default_library"],
deps = [
"//boskos/client:go_default_library",
"//boskos/common:go_default_library",
"//boskos/crds:go_default_library",
"//boskos/ranch:go_default_library",
"//boskos/storage:go_default_library",
],
)

go_library(
name = "go_default_library",
srcs = ["boskos.go"],
importpath = "k8s.io/test-infra/boskos",
deps = [
"//boskos/common:go_default_library",
"//boskos/crds:go_default_library",
"//boskos/ranch:go_default_library",
"//prow/config:go_default_library",
"//prow/interrupts:go_default_library",
"//prow/logrusutil:go_default_library",
"//prow/metrics:go_default_library",
"//prow/pjutil:go_default_library",
"//prow/simplifypath:go_default_library",
"@com_github_fsnotify_fsnotify//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_spf13_viper//:go_default_library",
],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
Expand All @@ -82,14 +32,17 @@ filegroup(
"//boskos/aws-janitor:all-srcs",
"//boskos/cleaner:all-srcs",
"//boskos/client:all-srcs",
"//boskos/cmd/boskos:all-srcs",
"//boskos/cmd/cleaner:all-srcs",
"//boskos/cmd/cli:all-srcs",
"//boskos/cmd/fake-mason:all-srcs",
"//boskos/cmd/janitor:all-srcs",
"//boskos/cmd/metrics:all-srcs",
"//boskos/cmd/reaper:all-srcs",
"//boskos/common:all-srcs",
"//boskos/crds:all-srcs",
"//boskos/janitor:all-srcs",
"//boskos/mason:all-srcs",
"//boskos/metrics:all-srcs",
"//boskos/ranch:all-srcs",
"//boskos/reaper:all-srcs",
"//boskos/storage:all-srcs",
],
tags = ["automanaged"],
Expand Down
5 changes: 1 addition & 4 deletions boskos/cleaner/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ filegroup(

filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//boskos/cleaner/cmd:all-srcs",
],
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
Expand Down
67 changes: 67 additions & 0 deletions boskos/cmd/boskos/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("//prow:def.bzl", "prow_image")

go_binary(
name = "boskos",
embed = [":go_default_library"],
pure = "on",
visibility = ["//visibility:public"],
)

prow_image(
name = "image",
visibility = ["//visibility:public"],
)

go_library(
name = "go_default_library",
srcs = ["boskos.go"],
importpath = "k8s.io/test-infra/boskos/cmd/boskos",
visibility = ["//visibility:private"],
deps = [
"//boskos/common:go_default_library",
"//boskos/crds:go_default_library",
"//boskos/ranch:go_default_library",
"//prow/config:go_default_library",
"//prow/interrupts:go_default_library",
"//prow/logrusutil:go_default_library",
"//prow/metrics:go_default_library",
"//prow/pjutil:go_default_library",
"//prow/simplifypath:go_default_library",
"@com_github_fsnotify_fsnotify//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_spf13_viper//:go_default_library",
],
)

go_test(
name = "go_default_test",
srcs = [
"boskos_test.go",
"server_client_test.go",
"storage_test.go",
],
embed = [":go_default_library"],
deps = [
"//boskos/client:go_default_library",
"//boskos/common:go_default_library",
"//boskos/crds:go_default_library",
"//boskos/ranch:go_default_library",
"//boskos/storage:go_default_library",
],
)

filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)

filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ load("//prow:def.bzl", "prow_image")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "k8s.io/test-infra/boskos/cleaner/cmd",
importpath = "k8s.io/test-infra/boskos/cmd/cleaner",
visibility = ["//visibility:private"],
deps = [
"//boskos/cleaner:go_default_library",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ load("//prow:def.bzl", "prow_image")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "k8s.io/test-infra/boskos/mason/fake-mason",
importpath = "k8s.io/test-infra/boskos/cmd/fake-mason",
visibility = ["//visibility:private"],
deps = [
"//boskos/client:go_default_library",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ go_binary(
go_library(
name = "go_default_library",
srcs = ["janitor.go"],
importpath = "k8s.io/test-infra/boskos/janitor",
importpath = "k8s.io/test-infra/boskos/cmd/janitor",
deps = [
"//boskos/client:go_default_library",
"//boskos/common:go_default_library",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ go_binary(
go_library(
name = "go_default_library",
srcs = ["metrics.go"],
importpath = "k8s.io/test-infra/boskos/metrics",
importpath = "k8s.io/test-infra/boskos/cmd/metrics",
deps = [
"//boskos/client:go_default_library",
"//boskos/common:go_default_library",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go_binary(
go_library(
name = "go_default_library",
srcs = ["reaper.go"],
importpath = "k8s.io/test-infra/boskos/reaper",
importpath = "k8s.io/test-infra/boskos/cmd/reaper",
deps = [
"//boskos/client:go_default_library",
"//boskos/common:go_default_library",
Expand Down
File renamed without changes.
5 changes: 1 addition & 4 deletions boskos/mason/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ filegroup(

filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//boskos/mason/fake-mason:all-srcs",
],
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion config/jobs/kubernetes/test-infra/janitors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ periodics:
- experiment/ci-janitor/main.go
- --config-path=config/prow/config.yaml
- --job-config-path=config/jobs
- --janitor-path=boskos/janitor/gcp_janitor.py
- --janitor-path=boskos/cmd/janitor/gcp_janitor.py
image: gcr.io/k8s-testimages/kubekins-e2e:v20200205-602500d-master
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion scenarios/kubernetes_janitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def clean_project(project, hours=24, dryrun=False, ratelimit=None, filt=None):
return
CHECKED.add(project)

cmd = ['python', test_infra('boskos/janitor/gcp_janitor.py'), '--project=%s' % project]
cmd = ['python', test_infra('boskos/cmd/janitor/gcp_janitor.py'), '--project=%s' % project]
cmd.append('--hour=%d' % hours)
if dryrun:
cmd.append('--dryrun')
Expand Down

0 comments on commit 61838e1

Please sign in to comment.