Skip to content

Commit

Permalink
Refactor testgrid file locations
Browse files Browse the repository at this point in the history
  • Loading branch information
fejta committed Feb 2, 2018
1 parent c2c8fdf commit 86cd7c2
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 73 deletions.
3 changes: 1 addition & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ filegroup(
"//robots/commenter:all-srcs",
"//robots/issue-creator:all-srcs",
"//scenarios:all-srcs",
"//testgrid/config:all-srcs",
"//testgrid/updater:all-srcs",
"//testgrid:all-srcs",
"//triage:all-srcs",
"//velodrome:all-srcs",
"//vendor:all-srcs",
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the different services interact.
## Viewing test results

* The [Kubernetes TestGrid](https://k8s-testgrid.appspot.com/) shows historical test results
- Configure your own testgrid dashboard at [testgrid/config/config.yaml](testgrid/config/config.yaml)
- Configure your own testgrid dashboard at [testgrid/config.yaml](testgrid/config.yaml)
- [Gubernator](https://k8s-gubernator.appspot.com/) formats the output of each run
* [PR Dashboard](https://k8s-gubernator.appspot.com/pr) finds PRs that need your attention
* [Prow](https://prow.k8s.io) schedules testing and updates issues
Expand Down Expand Up @@ -58,7 +58,7 @@ you'll need to do the following:
- If this is a kubetest job create the corresponding `jobs/env/FOO.env` file
- It will pick a free project from [boskos](/boskos) pool by default, or
- You can also set --gcp-project=foo in [`jobs/config.json`] for a dedicated project, make sure the project has the right [IAM grants](jenkins/check_projects.py)
* Add the job name to the `test_groups` list in [`testgrid/config/config.yaml`](testgrid/config/config.yaml)
* Add the job name to the `test_groups` list in [`testgrid/config.yaml`](testgrid/config.yaml)
- Also the group to at least one `dashboard_tab`
* Add the job to the appropriate section in [`prow/config.yaml`](prow/config.yaml)
- Presubmit jobs run on unmerged code in PRs
Expand Down Expand Up @@ -121,12 +121,12 @@ the kubetest jobs this typically means editing the `jobs/FOO.env` files it uses.
Update when a job runs by changing its definition in [`prow/config.yaml`].
The [test-infra oncall] must push prow changes (`make -C prow update-config`).

Update where the job appears on testgrid by changing [`testgrid/config/config.yaml`].
Update where the job appears on testgrid by changing [`testgrid/config.yaml`].

### Delete a job

The reverse of creating a new job: delete the appropriate entries in
[`jobs/config.json`], [`prow/config.yaml`] and [`testgrid/config/config.yaml`].
[`jobs/config.json`], [`prow/config.yaml`] and [`testgrid/config.yaml`].

Merge your PR and @k8s-ci-robot will deploy your change automatically.

Expand All @@ -150,5 +150,5 @@ how to contribute test results, see [Contributing Test Results](docs/contributin

[`jobs/config.json`]: /jobs/config.json
[`prow/config.yaml`]: /prow/config.yaml
[`testgrid/config/config.yaml`]: /testgrid/config/config.yaml
[`testgrid/config.yaml`]: /testgrid/config.yaml
[test-infra oncall]: https://go.k8s.io/oncall
2 changes: 1 addition & 1 deletion docs/contributing-test-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The process is as follows:
rewriting it to better support external usage.
- Add the GCS bucket info to [buckets.yaml](/buckets.yaml) via a PR (use the
previously designated github handle for the `contact` field)
- Add jobs and dashboards to [testgrid's config](/testgrid/config/config.yaml) via
- Add jobs and dashboards to the [testgrid config](/testgrid/config.yaml) via
a PR (use the previously designated point of contact info in a comment next to
added `test_group`s, or even better in the `description` field for added
`dashboard_tab`s)
Expand Down
2 changes: 1 addition & 1 deletion experiment/create_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def main(args):
PARSER.add_argument(
'--testgrid',
help='Path to testgrid config',
default='testgrid/config/config.yaml')
default='testgrid/config.yaml')
PARSER.add_argument(
'--testgrid-dashboard',
help='which dashboard to add in testgrid config')
Expand Down
2 changes: 1 addition & 1 deletion experiment/jenkins_to_prow.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def main(job, jenkins_path, suffix, prow_path, config_path, delete):
for old_name in job_names:
if '.' in old_name:
new_name = old_name.replace('.', '-')
files = ['jobs/config.json', 'testgrid/config/config.yaml', 'prow/config.yaml']
files = ['jobs/config.json', 'testgrid/config.yaml', 'prow/config.yaml']
for fname in files:
with open(fname) as fp:
content = fp.read()
Expand Down
62 changes: 62 additions & 0 deletions testgrid/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "state_proto",
srcs = ["state.proto"],
)

proto_library(
name = "config_proto",
srcs = ["config.proto"],
)

go_proto_library(
name = "state",
importpath = "k8s.io/test-infra/testgrid/state",
proto = ":state_proto",
visibility = ["//visibility:public"],
)

go_proto_library(
name = "config",
importpath = "k8s.io/test-infra/testgrid/config",
proto = ":config_proto",
visibility = ["//visibility:public"],
)

genrule(
name = "gen-config",
srcs = [
"config.yaml",
],
outs = ["testgrid-config"],
cmd = "$(location //testgrid/cmd/config) --yaml=$< --output=$@",
tools = [
"//testgrid/cmd/config",
],
)

filegroup(
name = "config-yaml",
srcs = ["config.yaml"],
visibility = ["//visibility:public"],
)

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

filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//testgrid/cmd/config:all-srcs",
"//testgrid/cmd/updater:all-srcs",
"//testgrid/yaml2proto:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
43 changes: 8 additions & 35 deletions testgrid/config/BUILD → testgrid/cmd/config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,37 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "config_proto",
srcs = ["config.proto"],
)

go_proto_library(
name = "config_pb",
importpath = "k8s.io/test-infra/testgrid/config/config_pb",
proto = ":config_proto",
)

genrule(
name = "gen-config",
srcs = [
"config.yaml",
],
outs = ["testgrid-config"],
cmd = "$(location //testgrid/config) --yaml=$< --output=$@",
tools = [
"//testgrid/config",
],
)

go_binary(
name = "config",
embed = [":go_default_library"],
importpath = "k8s.io/test-infra/testgrid/config",
importpath = "k8s.io/test-infra/testgrid/cmd/config",
)

go_test(
name = "go_default_test",
srcs = ["config_test.go"],
data = [
"config.yaml",
"//jenkins/job-configs:all-srcs",
"//mungegithub:submit-queue/deployment/kubernetes/configmap.yaml",
"//prow:config.yaml",
"//testgrid:config-yaml",
],
embed = [":go_default_library"],
importpath = "k8s.io/test-infra/testgrid/config",
importpath = "k8s.io/test-infra/testgrid/cmd/config",
deps = [
":config_pb",
"//prow/config:go_default_library",
"//testgrid/config/yaml2proto:go_default_library",
"//testgrid:config",
"//testgrid/yaml2proto:go_default_library",
"//vendor/github.com/ghodss/yaml:go_default_library",
],
)

go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "k8s.io/test-infra/testgrid/config",
deps = ["//testgrid/config/yaml2proto:go_default_library"],
importpath = "k8s.io/test-infra/testgrid/cmd/config",
deps = ["//testgrid/yaml2proto:go_default_library"],
)

filegroup(
Expand All @@ -73,9 +49,6 @@ filegroup(

filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//testgrid/config/yaml2proto:all-srcs",
],
srcs = [":package-srcs"],
tags = ["automanaged"],
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (

"github.com/ghodss/yaml"
prow_config "k8s.io/test-infra/prow/config"
"k8s.io/test-infra/testgrid/config/config_pb"
"k8s.io/test-infra/testgrid/config/yaml2proto"
config_pb "k8s.io/test-infra/testgrid/config"
"k8s.io/test-infra/testgrid/yaml2proto"
"path/filepath"
)

Expand Down Expand Up @@ -58,7 +58,7 @@ var config *config_pb.Configuration

func TestMain(m *testing.M) {
//make sure we can parse config.yaml
yamlData, err := ioutil.ReadFile("config.yaml")
yamlData, err := ioutil.ReadFile("../../config.yaml")
if err != nil {
fmt.Printf("IO Error : Cannot Open File config.yaml")
os.Exit(1)
Expand Down Expand Up @@ -305,7 +305,7 @@ func TestConfig(t *testing.T) {
}
}

sqConfigPath := "../../mungegithub/submit-queue/deployment/kubernetes/configmap.yaml"
sqConfigPath := "../../../mungegithub/submit-queue/deployment/kubernetes/configmap.yaml"
configData, err := ioutil.ReadFile(sqConfigPath)
if err != nil {
t.Errorf("Read Buffer Error for SQ Data : %v", err)
Expand Down Expand Up @@ -341,8 +341,8 @@ func TestConfig(t *testing.T) {
}

func TestJobsTestgridEntryMatch(t *testing.T) {
jenkinsPath := "../../jenkins/job-configs"
prowPath := "../../prow/config.yaml"
jenkinsPath := "../../../jenkins/job-configs"
prowPath := "../../../prow/config.yaml"

jobs := make(map[string]bool)
// TODO(krzyzacy): delete all the Jenkins stuff here after kill Jenkins
Expand Down
2 changes: 1 addition & 1 deletion testgrid/config/main.go → testgrid/cmd/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"strings"

"k8s.io/test-infra/testgrid/config/yaml2proto"
"k8s.io/test-infra/testgrid/yaml2proto"
)

var (
Expand Down
15 changes: 2 additions & 13 deletions testgrid/updater/BUILD → testgrid/cmd/updater/BUILD
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "state_proto",
srcs = ["state.proto"],
)

go_proto_library(
name = "state",
proto = ":state_proto",
)

go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "k8s.io/test-infra/testgrid/updater",
importpath = "k8s.io/test-infra/testgrid/cmd/updater",
visibility = ["//visibility:private"],
deps = [
":state",
"//testgrid:state",
"//vendor/cloud.google.com/go/storage:go_default_library",
],
)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion testgrid/updater/main.go → testgrid/cmd/updater/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"
"log"

"k8s.io/test-infra/testgrid/updater/state"
"k8s.io/test-infra/testgrid/state"

"cloud.google.com/go/storage"
)
Expand Down
6 changes: 3 additions & 3 deletions testgrid/config-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ set -o pipefail
set -o xtrace

bazel clean --expunge
bazel build //testgrid/config:testgrid-config
gsutil cp bazel-genfiles/testgrid/config/testgrid-config gs://k8s-testgrid/config
gsutil cp bazel-genfiles/testgrid/config/testgrid-config gs://k8s-testgrid-canary/config
bazel build //testgrid:testgrid-config
gsutil cp bazel-genfiles/testgrid/testgrid-config gs://k8s-testgrid/config
gsutil cp bazel-genfiles/testgrid/testgrid-config gs://k8s-testgrid-canary/config
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ go_test(
name = "go_default_test",
srcs = ["yaml2proto_test.go"],
embed = [":go_default_library"],
importpath = "k8s.io/test-infra/testgrid/config/yaml2proto",
importpath = "k8s.io/test-infra/testgrid/yaml2proto",
)

go_library(
name = "go_default_library",
srcs = ["yaml2proto.go"],
importpath = "k8s.io/test-infra/testgrid/config/yaml2proto",
importpath = "k8s.io/test-infra/testgrid/yaml2proto",
deps = [
"//testgrid/config:config_pb",
"//testgrid:config",
"//vendor/github.com/ghodss/yaml:go_default_library",
"//vendor/github.com/golang/protobuf/proto:go_default_library",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/ghodss/yaml"
"github.com/golang/protobuf/proto"
config "k8s.io/test-infra/testgrid/config/config_pb"
"k8s.io/test-infra/testgrid/config"
)

type Config struct {
Expand Down
File renamed without changes.

0 comments on commit 86cd7c2

Please sign in to comment.