Skip to content

upgrade deps and modernize naming conventions #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
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
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
common --enable_bzlmod
common --incompatible_enable_proto_toolchain_resolution
#common --host_platform=//:no_cgo_host_platform
build --nolegacy_external_runfiles
build --remote_download_all
build --verbose_failures
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.2
7.2.1
4 changes: 2 additions & 2 deletions .fasterci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ workflows:
- --test_size_filters=-large,-enormous

- <<: *build_workflow
name: Faster CI / build (6.5.0)
name: Faster CI / build (7.1.2)
env:
USE_BAZEL_VERSION: "6.5.0"
USE_BAZEL_VERSION: "7.1.2"
22 changes: 15 additions & 7 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.

# gazelle:build_tags darwin,linux
# gazelle:exclude examples e2e
# gazelle:resolve go github.com/fasterci/rules_gitops/gitops/blaze_query @rules_gitops//gitops/blaze_query
# gazelle:resolve go github.com/fasterci/rules_gitops/gitops/analysis @rules_gitops//gitops/analysis

# gazelle:exclude e2e
# gazelle:proto disable_global

load("@bazel_gazelle//:def.bzl", "gazelle")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
# load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS")

licenses(["notice"]) # Apache 2.0

exports_files(["WORKSPACE"])

# gazelle:go_naming_convention import
# gazelle:prefix github.com/fasterci/rules_gitops
gazelle(
name = "gazelle",
build_tags = [
"integration",
"debug",
],
command = "fix",
extra_args = [
"-build_file_name",
"BUILD,BUILD.bazel",
"BUILD.bazel,BUILD",
],
)

Expand All @@ -49,3 +49,11 @@ buildifier(
name = "buildifier-fix",
lint_mode = "fix",
)

# TODO: come up with a way compatible at least with bazel 7.1
# platform(
# name = "no_cgo_host_platform",
# constraint_values = HOST_CONSTRAINTS + [
# "@io_bazel_rules_go//go/toolchain:cgo_off",
# ],
# )
36 changes: 18 additions & 18 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ module(

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 = "platforms", version = "0.0.10")
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 = "rules_proto", version = "6.0.2")
bazel_dep(name = "toolchains_protoc", version = "0.3.1")

# Optional: choose a version of protoc rather than the latest.
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")

register_toolchains("@toolchains_protoc_hub//:all")

bazel_dep(name = "rules_go", version = "0.48.0", repo_name = "io_bazel_rules_go")

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

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

go_deps = use_extension("@bazel_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_github_v32",
"com_github_xanzy_go_gitlab",
"io_k8s_api",
"io_k8s_apimachinery",
"io_k8s_client_go",
"org_golang_x_oauth2",
)

toolchains = use_extension(
"@rules_gitops//gitops:extensions.bzl",
"toolchains",
Expand Down
43 changes: 43 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,46 @@ kubeconfig(
cluster = "mycluster",
use_host_config = True,
)

http_archive(
name = "platforms",
sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
],
)

http_archive(
name = "toolchains_protoc",
sha256 = "3898f8e621ca5b3c7b94300c5ae19075d5bb28349d6e6f407490a466ba1e2544",
strip_prefix = "toolchains_protoc-0.3.1",
url = "https://github.com/aspect-build/toolchains_protoc/releases/download/v0.3.1/toolchains_protoc-v0.3.1.tar.gz",
)

load("@toolchains_protoc//protoc:repositories.bzl", "rules_protoc_dependencies")

rules_protoc_dependencies()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

rules_proto_dependencies()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@toolchains_protoc//protoc:toolchain.bzl", "protoc_toolchains")

protoc_toolchains(
name = "protoc_toolchains",
version = "v27.1",
)

load("@rules_proto//proto:setup.bzl", "rules_proto_setup")

rules_proto_setup()

load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")

rules_proto_toolchains()
2 changes: 1 addition & 1 deletion client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
exports_files(["noop.setup"])

go_library(
name = "go_default_library",
name = "client",
srcs = ["sidecar_client.go"],
data = [
":noop.setup",
Expand Down
4 changes: 2 additions & 2 deletions client/test_callback/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "go_default_test",
name = "test_callback_test",
srcs = ["sidecar_client_test.go"],
args = [
"-setup",
Expand All @@ -11,5 +11,5 @@ go_test(
"//client:noop.setup",
],
rundir = ".",
deps = ["//client:go_default_library"],
deps = ["//client"],
)
4 changes: 2 additions & 2 deletions client/test_no_callback/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
name = "test_no_callback",
srcs = ["sidecar_client_test_no_callback.go"],
importpath = "github.com/fasterci/rules_gitops/client/test_no_callback",
visibility = ["//visibility:public"],
deps = ["//client:go_default_library"],
deps = ["//client"],
)
1 change: 1 addition & 0 deletions e2e/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
bazel_dep(name = "rules_go", version = "0.46.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_oci", version = "1.7.2")

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "go_image_static",
Expand Down
2 changes: 1 addition & 1 deletion e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module github.com/fasterci/rules_gitops/e2e

go 1.20

require github.com/fasterci/client v0.31.8
require github.com/fasterci/rules_gitops/client v0.32.9

replace github.com/fasterci/rules_gitops/client => ../client
2 changes: 1 addition & 1 deletion e2e/helloworld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ go_test(
],
data = [":hello_server_it.setup"],
rundir = ".",
deps = ["@rules_gitops//client:go_default_library"],
deps = ["//vendor/github.com/fasterci/rules_gitops/client"],
)
13 changes: 13 additions & 0 deletions e2e/vendor/github.com/fasterci/rules_gitops/client/BUILD

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions e2e/vendor/github.com/fasterci/rules_gitops/client/noop.setup

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading