2023-03-13 13:33:31 -04:00
|
|
|
load("@bazel_gazelle//:def.bzl", "gazelle")
|
2023-09-28 16:29:14 -04:00
|
|
|
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "command", "multirun")
|
2023-03-13 13:33:31 -04:00
|
|
|
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier", "buildifier_test")
|
2023-03-30 08:47:29 -04:00
|
|
|
load("//bazel/ci:proto_targets.bzl", "proto_targets")
|
2023-03-16 09:24:53 -04:00
|
|
|
load("//bazel/sh:def.bzl", "noop_warn", "repo_command", "sh_template")
|
2023-03-13 13:33:31 -04:00
|
|
|
|
2023-08-16 15:58:12 -04:00
|
|
|
required_tags = [
|
|
|
|
"e2e",
|
|
|
|
"integration",
|
|
|
|
]
|
2023-02-03 05:05:42 -05:00
|
|
|
|
2023-09-28 16:29:14 -04:00
|
|
|
# TODO(malt3): Remove this once we have a better solution for
|
|
|
|
# gazelle not respecting the default go env.
|
|
|
|
command(
|
|
|
|
name = "cmd_gazelle_update_repos",
|
|
|
|
command = ":gazelle_update_repos",
|
|
|
|
environment = {
|
|
|
|
"GOPROXY": "https://proxy.golang.org,direct",
|
|
|
|
"GOSUMDB": "sum.golang.org",
|
|
|
|
"GOTOOLCHAIN": "local",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2023-02-03 05:05:42 -05:00
|
|
|
gazelle(
|
|
|
|
name = "gazelle_generate",
|
|
|
|
build_tags = required_tags,
|
|
|
|
)
|
2023-03-13 13:33:31 -04:00
|
|
|
|
|
|
|
gazelle(
|
|
|
|
name = "gazelle_check",
|
2023-02-03 05:05:42 -05:00
|
|
|
build_tags = required_tags,
|
2023-03-13 13:33:31 -04:00
|
|
|
command = "fix",
|
|
|
|
mode = "diff",
|
|
|
|
)
|
|
|
|
|
|
|
|
gazelle(
|
|
|
|
name = "gazelle_update_repos",
|
|
|
|
args = [
|
|
|
|
"-from_file=go.work",
|
|
|
|
"-to_macro=bazel/toolchains/go_module_deps.bzl%go_dependencies",
|
|
|
|
"-build_file_proto_mode=disable_global",
|
|
|
|
"-build_file_generation=on",
|
|
|
|
"-prune",
|
|
|
|
],
|
|
|
|
command = "update-repos",
|
|
|
|
)
|
|
|
|
|
|
|
|
buildifier_test(
|
|
|
|
name = "buildifier_check",
|
|
|
|
timeout = "short",
|
|
|
|
lint_mode = "warn",
|
|
|
|
lint_warnings = ["all"],
|
|
|
|
mode = "diff",
|
|
|
|
no_sandbox = True,
|
2023-09-12 08:48:06 -04:00
|
|
|
tags = ["no-remote-exec"],
|
2023-03-13 13:33:31 -04:00
|
|
|
verbose = True,
|
|
|
|
workspace = "//:WORKSPACE.bazel",
|
|
|
|
)
|
|
|
|
|
|
|
|
buildifier(
|
|
|
|
name = "buildifier_fix",
|
|
|
|
lint_mode = "fix",
|
|
|
|
lint_warnings = ["all"],
|
|
|
|
mode = "fix",
|
2023-09-12 08:48:06 -04:00
|
|
|
tags = ["no-remote-exec"],
|
2023-03-13 13:33:31 -04:00
|
|
|
verbose = True,
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "go_mod_tidy",
|
2023-03-10 08:37:30 -05:00
|
|
|
data = [
|
|
|
|
"@go_sdk//:bin/go",
|
|
|
|
],
|
2023-03-13 13:33:31 -04:00
|
|
|
substitutions = {
|
2023-03-14 12:21:33 -04:00
|
|
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
2023-03-10 08:37:30 -05:00
|
|
|
},
|
2023-03-30 05:02:40 -04:00
|
|
|
template = "go_tidy.sh.in",
|
2023-03-13 13:33:31 -04:00
|
|
|
)
|
|
|
|
|
2023-03-14 12:21:50 -04:00
|
|
|
sh_template(
|
|
|
|
name = "shfmt",
|
|
|
|
data = [
|
|
|
|
"@com_github_katexochen_sh_v3//cmd/shfmt",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@SHFMT@@": "$(rootpath @com_github_katexochen_sh_v3//cmd/shfmt)",
|
|
|
|
},
|
|
|
|
template = "shfmt.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-03-16 09:24:53 -04:00
|
|
|
noop_warn(
|
|
|
|
name = "shellcheck_noop_warning",
|
|
|
|
warning = "Shellcheck should have been executed, but is currently not available for your platform.",
|
|
|
|
)
|
|
|
|
|
|
|
|
alias(
|
|
|
|
name = "com_github_koalaman_shellcheck",
|
|
|
|
actual = select({
|
2023-03-28 08:50:17 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_koalaman_shellcheck_darwin_amd64//:shellcheck",
|
2023-03-16 09:24:53 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": ":shellcheck_noop_warning",
|
2023-03-28 08:50:17 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_koalaman_shellcheck_linux_amd64//:shellcheck",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_koalaman_shellcheck_linux_arm64//:shellcheck",
|
2023-03-16 09:24:53 -04:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "shellcheck",
|
|
|
|
data = [
|
|
|
|
":com_github_koalaman_shellcheck",
|
|
|
|
"@com_github_katexochen_sh_v3//cmd/shfmt",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@SHELLCHECK@@": "$(rootpath :com_github_koalaman_shellcheck)",
|
|
|
|
"@@SHFMT@@": "$(rootpath @com_github_katexochen_sh_v3//cmd/shfmt)",
|
|
|
|
},
|
|
|
|
template = "shellcheck.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-03-17 12:14:27 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_rhysd_actionlint",
|
|
|
|
actual = select({
|
2023-03-23 12:26:48 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_rhysd_actionlint_darwin_amd64//:actionlint",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_rhysd_actionlint_darwin_arm64//:actionlint",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_rhysd_actionlint_linux_amd64//:actionlint",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_rhysd_actionlint_linux_arm64//:actionlint",
|
2023-03-17 12:14:27 -04:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2023-03-16 12:07:06 -04:00
|
|
|
sh_template(
|
|
|
|
name = "actionlint",
|
|
|
|
data = [
|
|
|
|
":com_github_koalaman_shellcheck",
|
2023-03-17 12:14:27 -04:00
|
|
|
":com_github_rhysd_actionlint",
|
2023-03-16 12:07:06 -04:00
|
|
|
],
|
|
|
|
substitutions = {
|
2023-03-17 12:14:27 -04:00
|
|
|
"@@ACTIONLINT@@": "$(rootpath :com_github_rhysd_actionlint)",
|
2023-03-16 12:07:06 -04:00
|
|
|
"@@SHELLCHECK@@": "$(rootpath :com_github_koalaman_shellcheck)",
|
|
|
|
},
|
|
|
|
template = "actionlint.sh.in",
|
|
|
|
)
|
|
|
|
|
|
|
|
repo_command(
|
|
|
|
name = "actionlint_no_shellcheck",
|
2023-03-17 12:14:27 -04:00
|
|
|
command = ":com_github_rhysd_actionlint",
|
2023-03-16 12:07:06 -04:00
|
|
|
)
|
|
|
|
|
2023-03-17 12:35:03 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_mvdan_gofumpt",
|
|
|
|
actual = select({
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_mvdan_gofumpt_darwin_amd64//file",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_mvdan_gofumpt_darwin_arm64//file",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_mvdan_gofumpt_linux_amd64//file",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_mvdan_gofumpt_linux_arm64//file",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2023-03-14 12:21:33 -04:00
|
|
|
repo_command(
|
|
|
|
name = "gofumpt",
|
|
|
|
args = [
|
|
|
|
"-l",
|
|
|
|
"-w",
|
|
|
|
".",
|
|
|
|
],
|
2023-03-17 12:35:03 -04:00
|
|
|
command = ":com_github_mvdan_gofumpt",
|
2023-03-14 12:21:33 -04:00
|
|
|
)
|
|
|
|
|
2023-03-17 12:45:41 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_aquasecurity_tfsec",
|
|
|
|
actual = select({
|
2023-03-23 12:26:48 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_aquasecurity_tfsec_darwin_amd64//:tfsec",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_aquasecurity_tfsec_darwin_arm64//:tfsec",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_aquasecurity_tfsec_linux_amd64//:tfsec",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_aquasecurity_tfsec_linux_arm64//:tfsec",
|
2023-03-17 12:45:41 -04:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2023-03-17 06:54:47 -04:00
|
|
|
sh_template(
|
|
|
|
name = "tfsec",
|
|
|
|
data = [
|
2023-03-17 12:45:41 -04:00
|
|
|
":com_github_aquasecurity_tfsec",
|
2023-03-17 06:54:47 -04:00
|
|
|
],
|
|
|
|
substitutions = {
|
2023-03-17 12:45:41 -04:00
|
|
|
"@@TFSEC@@": "$(rootpath :com_github_aquasecurity_tfsec)",
|
2023-03-17 06:54:47 -04:00
|
|
|
},
|
|
|
|
template = "tfsec.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-03-17 11:20:39 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_hashicorp_terraform",
|
|
|
|
actual = select({
|
2023-03-23 12:26:48 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_hashicorp_terraform_darwin_amd64//:terraform",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_hashicorp_terraform_darwin_arm64//:terraform",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_hashicorp_terraform_linux_amd64//:terraform",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_hashicorp_terraform_linux_arm64//:terraform",
|
2023-03-17 11:20:39 -04:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "terraform_gen",
|
|
|
|
data = [
|
|
|
|
":com_github_hashicorp_terraform",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@MODE@@": "generate",
|
|
|
|
"@@TERRAFORM@@": "$(rootpath :com_github_hashicorp_terraform)",
|
|
|
|
},
|
2023-03-30 05:02:40 -04:00
|
|
|
template = "terraform.sh.in",
|
2023-03-17 11:20:39 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "terraform_check",
|
|
|
|
data = [
|
|
|
|
":com_github_hashicorp_terraform",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@MODE@@": "check",
|
|
|
|
"@@TERRAFORM@@": "$(rootpath :com_github_hashicorp_terraform)",
|
|
|
|
},
|
2023-03-30 05:02:40 -04:00
|
|
|
template = "terraform.sh.in",
|
2023-03-17 11:20:39 -04:00
|
|
|
)
|
|
|
|
|
2023-03-22 13:14:35 -04:00
|
|
|
sh_template(
|
|
|
|
name = "terraform_fmt",
|
|
|
|
data = [
|
|
|
|
":com_github_hashicorp_terraform",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@MODE@@": "format",
|
|
|
|
"@@TERRAFORM@@": "$(rootpath :com_github_hashicorp_terraform)",
|
|
|
|
},
|
2023-03-30 05:02:40 -04:00
|
|
|
template = "terraform.sh.in",
|
2023-03-22 13:14:35 -04:00
|
|
|
)
|
|
|
|
|
2023-03-23 12:27:09 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_golangci_golangci_lint",
|
|
|
|
actual = select({
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_golangci_golangci_lint_darwin_amd64//:golangci_lint_bin",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_golangci_golangci_lint_darwin_arm64//:golangci_lint_bin",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_golangci_golangci_lint_linux_amd64//:golangci_lint_bin",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_golangci_golangci_lint_linux_arm64//:golangci_lint_bin",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "golangci_lint",
|
|
|
|
data = [
|
|
|
|
":com_github_golangci_golangci_lint",
|
|
|
|
"@go_sdk//:bin/go",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
|
|
|
"@@GOLANGCI-LINT@@": "$(rootpath :com_github_golangci_golangci_lint)",
|
|
|
|
},
|
2023-03-30 05:02:40 -04:00
|
|
|
template = "golangci_lint.sh.in",
|
2023-03-23 12:27:09 -04:00
|
|
|
)
|
|
|
|
|
2023-03-23 13:08:49 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_bufbuild_buf",
|
|
|
|
actual = select({
|
2023-03-28 08:50:17 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_bufbuild_buf_darwin_amd64//:buf",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_bufbuild_buf_darwin_arm64//:buf",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_bufbuild_buf_linux_amd64//:buf",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_bufbuild_buf_linux_arm64//:buf",
|
2023-03-23 13:08:49 -04:00
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "buf_fmt",
|
|
|
|
data = [
|
|
|
|
":com_github_bufbuild_buf",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@BUF@@": "$(rootpath :com_github_bufbuild_buf)",
|
|
|
|
},
|
|
|
|
template = "buf.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-03-27 04:42:30 -04:00
|
|
|
sh_template(
|
|
|
|
name = "golicenses_check",
|
|
|
|
data = [
|
|
|
|
"@com_github_google_go_licenses//:go-licenses",
|
|
|
|
"@go_sdk//:bin/go",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
|
|
|
"@@GO_LICENSES@@": "$(rootpath @com_github_google_go_licenses//:go-licenses)",
|
|
|
|
},
|
|
|
|
template = "golicenses.sh.in",
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "license_header_check",
|
|
|
|
data = [],
|
|
|
|
substitutions = {},
|
2023-03-30 05:02:40 -04:00
|
|
|
template = "license_header.sh.in",
|
2023-03-27 04:42:30 -04:00
|
|
|
)
|
|
|
|
|
2023-03-27 07:35:51 -04:00
|
|
|
sh_template(
|
|
|
|
name = "govulncheck",
|
|
|
|
data = [
|
|
|
|
"@go_sdk//:bin/go",
|
|
|
|
"@org_golang_x_vuln//cmd/govulncheck",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
|
|
|
"@@GOVULNCHECK@@": "$(rootpath @org_golang_x_vuln//cmd/govulncheck:govulncheck)",
|
|
|
|
},
|
|
|
|
template = "govulncheck.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-03-28 08:50:17 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_siderolabs_talos_hack_docgen",
|
|
|
|
actual = select({
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_siderolabs_talos_hack_docgen_darwin_amd64//file",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_siderolabs_talos_hack_docgen_darwin_arm64//file",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_siderolabs_talos_hack_docgen_linux_amd64//file",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_siderolabs_talos_hack_docgen_linux_arm64//file",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
2023-03-29 07:58:37 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_helm_helm",
|
|
|
|
actual = select({
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_helm_helm_darwin_amd64//:helm",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_helm_helm_darwin_arm64//:helm",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_helm_helm_linux_amd64//:helm",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_helm_helm_linux_arm64//:helm",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
sh_template(
|
|
|
|
name = "go_generate",
|
|
|
|
data = [
|
|
|
|
":com_github_helm_helm",
|
|
|
|
":com_github_siderolabs_talos_hack_docgen",
|
|
|
|
"//internal/attestation/measurements/measurement-generator",
|
|
|
|
"//internal/versions/hash-generator",
|
|
|
|
"@go_sdk//:bin/go",
|
|
|
|
"@org_golang_x_tools//cmd/stringer",
|
2023-06-28 12:09:05 -04:00
|
|
|
"@yq_toolchains//:resolved_toolchain",
|
2023-03-29 07:58:37 -04:00
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@DOCGEN@@": "$(rootpath :com_github_siderolabs_talos_hack_docgen)",
|
|
|
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
|
|
|
"@@HASH_GENERATOR@@": "$(rootpath //internal/versions/hash-generator:hash-generator)",
|
|
|
|
"@@HELM@@": "$(rootpath :com_github_helm_helm)",
|
|
|
|
"@@MEASUREMENT_GENERATOR@@": "$(rootpath //internal/attestation/measurements/measurement-generator:measurement-generator)",
|
|
|
|
"@@STRINGER@@": "$(rootpath @org_golang_x_tools//cmd/stringer:stringer)",
|
2023-08-16 08:45:27 -04:00
|
|
|
"@@YQ@@": "$(rootpath @yq_toolchains//:resolved_toolchain)",
|
2023-03-29 07:58:37 -04:00
|
|
|
},
|
|
|
|
template = "go_generate.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-04-05 11:32:51 -04:00
|
|
|
# deps_mirror_fix fixes bazel workspace rules for external dependencies.
|
|
|
|
# It normalizes the rules and rewrites WORKSPACE and bzl files.
|
|
|
|
# If files are not in the mirror, it will fail.
|
|
|
|
# Use deps_mirror_upload to upload missing files.
|
2023-03-30 03:41:56 -04:00
|
|
|
repo_command(
|
|
|
|
name = "deps_mirror_fix",
|
|
|
|
args = [
|
|
|
|
"fix",
|
|
|
|
"--unauthenticated",
|
|
|
|
],
|
|
|
|
command = "//hack/bazel-deps-mirror",
|
|
|
|
)
|
|
|
|
|
2023-04-05 11:32:51 -04:00
|
|
|
# deps_mirror_upload fixes bazel workspace rules for external dependencies.
|
|
|
|
# It uploads all dependencies to the mirror, normalizes the rules and rewrites WORKSPACE and bzl files.
|
2023-03-30 03:41:56 -04:00
|
|
|
repo_command(
|
|
|
|
name = "deps_mirror_upload",
|
|
|
|
args = [
|
|
|
|
"fix",
|
|
|
|
],
|
|
|
|
command = "//hack/bazel-deps-mirror",
|
|
|
|
)
|
|
|
|
|
2023-04-05 11:32:51 -04:00
|
|
|
# deps_mirror_upgrade upgrades bazel workspace rules for external dependencies.
|
|
|
|
# Users are supposed to replace any upstream URLs.
|
|
|
|
# It replaces the expected hash and uploads the new dep to the mirror.
|
|
|
|
repo_command(
|
|
|
|
name = "deps_mirror_upgrade",
|
|
|
|
args = [
|
|
|
|
"upgrade",
|
|
|
|
],
|
|
|
|
command = "//hack/bazel-deps-mirror",
|
|
|
|
)
|
|
|
|
|
|
|
|
# deps_mirror_check checks bazel workspace rules for external dependencies.
|
|
|
|
# It checks if all dependency rules have mirror urls and are properly formatted.
|
|
|
|
# It doesn't check if the mirror has the files.
|
|
|
|
# Use deps_mirror_check_mirror to check if the mirror has the files.
|
2023-03-30 03:41:56 -04:00
|
|
|
repo_command(
|
|
|
|
name = "deps_mirror_check",
|
|
|
|
args = [
|
|
|
|
"check",
|
|
|
|
],
|
|
|
|
command = "//hack/bazel-deps-mirror",
|
|
|
|
)
|
|
|
|
|
2023-04-05 11:32:51 -04:00
|
|
|
# deps_mirror_check_mirror checks bazel workspace rules for external dependencies.
|
|
|
|
# It checks if all dependency rules are correctly mirrored and checks that the rules are properly formatted.
|
2023-03-30 03:41:56 -04:00
|
|
|
repo_command(
|
|
|
|
name = "deps_mirror_check_mirror",
|
|
|
|
args = [
|
|
|
|
"check",
|
|
|
|
"--mirror",
|
|
|
|
],
|
|
|
|
command = "//hack/bazel-deps-mirror",
|
|
|
|
)
|
|
|
|
|
2023-03-30 08:47:29 -04:00
|
|
|
sh_template(
|
|
|
|
name = "proto_targets_check",
|
2023-09-07 04:53:42 -04:00
|
|
|
data = select({
|
|
|
|
"@rules_nixpkgs_core//constraints:support_nix": [
|
|
|
|
"@diffutils//:bin/diff",
|
|
|
|
],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
|
|
|
env = select({
|
|
|
|
"@rules_nixpkgs_core//constraints:support_nix": {
|
|
|
|
"DIFF": "$(rootpath @diffutils//:bin/diff)",
|
|
|
|
},
|
|
|
|
"//conditions:default": {},
|
|
|
|
}),
|
2023-03-30 08:47:29 -04:00
|
|
|
substitutions = {
|
|
|
|
"@@PROTO_TARGETS@@": " ".join(proto_targets()),
|
|
|
|
},
|
|
|
|
template = "proto_targets_check.sh.in",
|
|
|
|
)
|
|
|
|
|
|
|
|
multirun(
|
|
|
|
name = "proto_generate",
|
|
|
|
commands = proto_targets(),
|
|
|
|
jobs = 0, # execute concurrently
|
|
|
|
)
|
|
|
|
|
2023-03-30 05:30:03 -04:00
|
|
|
sh_template(
|
|
|
|
name = "cli_docgen",
|
|
|
|
data = [
|
|
|
|
"//hack/clidocgen",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@CLIDOCGEN@@": "$(rootpath //hack/clidocgen:clidocgen)",
|
|
|
|
},
|
|
|
|
template = "cli_docgen.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-04-12 10:06:26 -04:00
|
|
|
alias(
|
|
|
|
name = "com_github_katexochen_ghh",
|
|
|
|
actual = select({
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_amd64": "@com_github_katexochen_ghh_darwin_amd64//:ghh",
|
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": "@com_github_katexochen_ghh_darwin_arm64//:ghh",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_amd64": "@com_github_katexochen_ghh_linux_amd64//:ghh",
|
|
|
|
"@io_bazel_rules_go//go/platform:linux_arm64": "@com_github_katexochen_ghh_linux_arm64//:ghh",
|
|
|
|
}),
|
|
|
|
)
|
|
|
|
|
|
|
|
repo_command(
|
|
|
|
name = "ghh",
|
|
|
|
args = [],
|
|
|
|
command = ":com_github_katexochen_ghh",
|
|
|
|
)
|
|
|
|
|
2023-07-25 09:00:01 -04:00
|
|
|
sh_template(
|
|
|
|
name = "bazel_container",
|
|
|
|
data = [],
|
|
|
|
substitutions = {},
|
|
|
|
template = "bazel_container.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-08-03 09:04:55 -04:00
|
|
|
sh_template(
|
|
|
|
name = "unused_gh_actions",
|
|
|
|
data = [],
|
|
|
|
substitutions = {},
|
|
|
|
template = "unused_gh_actions.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-08-23 12:52:46 -04:00
|
|
|
sh_template(
|
|
|
|
name = "gocoverage_diff",
|
|
|
|
data = [
|
|
|
|
"//hack/gocoverage",
|
|
|
|
"@go_sdk//:bin/go",
|
|
|
|
],
|
|
|
|
substitutions = {
|
|
|
|
"@@GO@@": "$(rootpath @go_sdk//:bin/go)",
|
|
|
|
"@@GOCOVERAGE@@": "$(rootpath //hack/gocoverage:gocoverage)",
|
|
|
|
},
|
|
|
|
template = "gocoverage_diff.sh.in",
|
|
|
|
)
|
|
|
|
|
2023-03-13 13:33:31 -04:00
|
|
|
multirun(
|
|
|
|
name = "tidy",
|
|
|
|
commands = [
|
2023-03-14 12:21:50 -04:00
|
|
|
":shfmt",
|
2023-03-14 12:21:33 -04:00
|
|
|
":gofumpt",
|
2023-03-13 13:33:31 -04:00
|
|
|
":go_mod_tidy",
|
2023-09-28 16:29:14 -04:00
|
|
|
":cmd_gazelle_update_repos",
|
2023-03-13 13:33:31 -04:00
|
|
|
":gazelle_generate",
|
|
|
|
":buildifier_fix",
|
2023-03-22 13:14:35 -04:00
|
|
|
":terraform_fmt",
|
2023-03-23 13:08:49 -04:00
|
|
|
":buf_fmt",
|
2023-03-30 03:41:56 -04:00
|
|
|
":deps_mirror_fix",
|
2023-07-25 09:00:01 -04:00
|
|
|
":bazel_container",
|
2023-03-13 13:33:31 -04:00
|
|
|
],
|
2023-03-16 12:07:06 -04:00
|
|
|
jobs = 1, # execute sequentially
|
2023-03-13 13:33:31 -04:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
multirun(
|
|
|
|
name = "check",
|
|
|
|
testonly = True,
|
|
|
|
commands = [
|
|
|
|
":gazelle_check",
|
|
|
|
":buildifier_check",
|
2023-03-23 12:27:09 -04:00
|
|
|
":golangci_lint",
|
2023-03-17 11:20:39 -04:00
|
|
|
":terraform_check",
|
2023-03-27 04:42:30 -04:00
|
|
|
":golicenses_check",
|
|
|
|
":license_header_check",
|
2023-03-27 07:35:51 -04:00
|
|
|
":govulncheck",
|
2023-03-30 03:41:56 -04:00
|
|
|
":deps_mirror_check",
|
2023-03-30 08:47:29 -04:00
|
|
|
":proto_targets_check",
|
2023-08-03 09:04:55 -04:00
|
|
|
":unused_gh_actions",
|
2023-03-16 09:24:53 -04:00
|
|
|
] + select({
|
2023-03-16 12:07:06 -04:00
|
|
|
"@io_bazel_rules_go//go/platform:darwin_arm64": [
|
|
|
|
":shellcheck_noop_warning",
|
|
|
|
":actionlint_no_shellcheck",
|
|
|
|
],
|
|
|
|
"//conditions:default": [
|
|
|
|
":shellcheck",
|
|
|
|
":actionlint",
|
|
|
|
],
|
2023-03-16 09:24:53 -04:00
|
|
|
}),
|
2023-04-04 04:39:57 -04:00
|
|
|
jobs = 0, # execute concurrently
|
2023-05-16 08:38:44 -04:00
|
|
|
stop_on_error = False,
|
2023-03-13 13:33:31 -04:00
|
|
|
visibility = ["//visibility:public"],
|
2023-03-10 08:37:30 -05:00
|
|
|
)
|
2023-03-17 11:20:39 -04:00
|
|
|
|
|
|
|
multirun(
|
|
|
|
name = "generate",
|
|
|
|
commands = [
|
|
|
|
":terraform_gen",
|
2023-03-29 06:30:06 -04:00
|
|
|
"//3rdparty/bazel/com_github_medik8s_node_maintainance_operator:pull_files",
|
2023-03-29 07:58:37 -04:00
|
|
|
":go_generate",
|
2023-03-30 08:47:29 -04:00
|
|
|
":proto_generate",
|
2023-03-30 05:30:03 -04:00
|
|
|
":cli_docgen",
|
2023-03-17 11:20:39 -04:00
|
|
|
],
|
2023-04-04 04:39:57 -04:00
|
|
|
jobs = 0, # execute concurrently
|
2023-03-17 11:20:39 -04:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|