Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 8 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
common --enable_bzlmod
common --enable_bzlmod --noincompatible_sandbox_hermetic_tmp
build --nolegacy_external_runfiles
build --remote_download_all
build --verbose_failures
build --@io_bazel_rules_go//go/config:pure
build --@rules_go//go/config:pure
test --test_output=errors

common --incompatible_enable_proto_toolchain_resolution
# Ensure that we don't accidentally build protobuf or gRPC
common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
8.2.1
16 changes: 0 additions & 16 deletions .fasterci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,19 @@ workflows:
steps:
- name: Build & test
bazel:
build_flags:
- --enable_bzlmod=false
build_targets:
- //...
test_targets:
- //...
- name: Build & test e2e
working-directory: e2e
bazel:
build_flags:
- --enable_bzlmod=false
build_targets:
- //...
test_targets:
- //...
test_flags:
- --test_size_filters=-large,-enormous
- name: Build & test e2e with bzlmod
working-directory: e2e
bazel:
build_targets:
- //...
build_flags:
- --enable_bzlmod
test_targets:
- //...
test_flags:
- --enable_bzlmod
- --test_size_filters=-large,-enormous

- <<: *build_workflow
name: Faster CI / build (7.4.1)
Expand Down
28 changes: 1 addition & 27 deletions .github/workflows/workspace_snippet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,6 @@ use_repo(kustomize, "kustomize_bin")

## Using WORKSPACE:

\`\`\`starlark

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_gitops",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
urls = ["https://github.com/fasterci/rules_gitops/releases/download/${TAG}/${ARCHIVE}"],
)

load("@rules_gitops//gitops:deps.bzl", "rules_gitops_dependencies")

rules_gitops_dependencies()

load("@rules_gitops//gitops:repositories.bzl", "rules_gitops_repositories")

rules_gitops_repositories()

load("@rules_gitops//skylib:k8s.bzl", "kubeconfig")

kubeconfig(
name = "k8s_dev_test",
cluster = "it_kubernetes_cluster_name",
use_host_config = True,
)
\`\`\`
`WORKSPACE` file is not supported in this version. The latest version with `WORKSPACE` support is [v0.32.13](https://github.com/fasterci/rules_gitops/releases/tag/v0.32.13)
EOF
Comment on lines +41 to 42
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script embeds user-facing documentation about Bazel usage and version support directly within operational code. This mixing of concerns can lead to maintenance challenges as changes in functionality might require updates to embedded documentation, which could be overlooked.

Recommendation: Consider separating operational code from user-facing documentation. Documentation could be moved to a separate markdown file or a dedicated documentation section within the repository. This separation would enhance clarity and maintainability.


10 changes: 5 additions & 5 deletions BUILD → BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# gazelle:build_tags darwin,linux
# gazelle:exclude examples e2e
# gazelle:proto disable_global
# gazelle:go_naming_convention import_alias

load("@bazel_gazelle//:def.bzl", "gazelle")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

licenses(["notice"]) # Apache 2.0
# gazelle:resolve go github.com/fasterci/rules_gitops/gitops/blaze_query //gitops/blaze_query:blaze_query
# gazelle:resolve go github.com/fasterci/rules_gitops/gitops/analysis //gitops/analysis:analysis

exports_files(["WORKSPACE"])
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/fasterci/rules_gitops
gazelle(
Expand Down
63 changes: 44 additions & 19 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@ module(
version = "0.50.0",
)

bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_oci", version = "1.7.2")
bazel_dep(name = "rules_pkg", version = "0.9.1")
bazel_dep(name = "rules_go", version = "0.44.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "aspect_bazel_lib", version = "2.15.3")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_oci", version = "2.2.6")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_go", version = "0.54.0")

go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.21.5")
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.23.9")

bazel_dep(name = "gazelle", version = "0.37.0", repo_name = "bazel_gazelle")
bazel_dep(name = "gazelle", version = "0.43.0")

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_ghodss_yaml",
"com_github_golang_protobuf",
"com_github_google_go_cmp",
"com_github_google_go_containerregistry",
"com_github_google_go_github_v32",
"com_github_xanzy_go_gitlab",
"io_k8s_api",
"io_k8s_apimachinery",
"io_k8s_client_go",
"org_golang_google_protobuf",
"org_golang_x_oauth2",
"org_golang_x_sync",
)

toolchains = use_extension(
Expand All @@ -39,13 +41,36 @@ use_repo(toolchains, "kustomize_bin", "kustomize_toolchains")

register_toolchains("@kustomize_toolchains//:all")

# Uncomment this part when bazel 6 is deprecated. Supported in bazel 7
# kubeconfig = use_repo_rule("@rules_gitops//skylib:k8s.bzl", "kubeconfig")
kubeconfig = use_repo_rule("@rules_gitops//skylib:k8s.bzl", "kubeconfig")

# kubeconfig(
# name = "k8s_test",
# cluster = "mycluster",
# use_host_config = True,
# )
kubeconfig(
name = "k8s_test",
cluster = "mycluster",
use_host_config = True,
)

bazel_dep(name = "buildifier_prebuilt", version = "8.0.3", dev_dependency = True)

bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "toolchains_protoc", version = "0.4.1")

bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
protoc.toolchain(
# Creates a repository to satisfy well-known-types dependencies such as
# deps=["@com_google_protobuf//:any_proto"]
google_protobuf = "com_google_protobuf",
# Pin to any version of protoc
version = "v27.1",
)
use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub")

register_toolchains("@toolchains_protoc_hub//:all")

# protoc = use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
# protoc.toolchain(
# # Creates a repository to satisfy well-known-types dependencies such as
# # deps=["@com_google_protobuf//:any_proto"]
# google_protobuf = "com_google_protobuf",
# version = "v27.1",
# )
# use_repo(protoc, "com_google_protobuf", "toolchains_protoc_hub")
Loading