Skip to content
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

Ap/bzlmod #16

Merged
merged 35 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
638d60c
bzlmod
apesternikov Dec 26, 2023
feff1fb
tests fixes
apesternikov Dec 26, 2023
6a59b50
kustomize toolchain
apesternikov Dec 27, 2023
13a045e
cleanup
apesternikov Dec 27, 2023
7fa847b
wip
apesternikov Dec 30, 2023
2ea77b5
buildifier
apesternikov Dec 30, 2023
fae4eeb
add default bazel configured in .bazelversion to CI
apesternikov Dec 30, 2023
1c7aaf1
fix broken files list
apesternikov Dec 30, 2023
e3bddbf
compat: register toolchain in rules_gitops_repositories()
apesternikov Jan 3, 2024
350e6f7
commit bazel lock
apesternikov Jan 3, 2024
80bc572
e2e using bzlmod
apesternikov Jan 3, 2024
0690e61
add bzlmod e2e
apesternikov Jan 3, 2024
b274a01
cleanup
apesternikov Jan 3, 2024
7473e00
wip
apesternikov Jan 3, 2024
2c6f4ff
update lock
apesternikov Jan 3, 2024
63e8120
wip
apesternikov Jan 13, 2024
d15b3b4
Merge remote-tracking branch 'origin/main' into ap/bzlmod
apesternikov Feb 6, 2024
bd15ed4
update bzllock
apesternikov Feb 6, 2024
9d2c51d
update bzl lock in e2e
apesternikov Feb 6, 2024
59e57c5
update aspect bazel lib
apesternikov Feb 8, 2024
ee86305
up rules_go, gazelle, prebuilt buildifier
apesternikov Feb 9, 2024
cff946f
up bazel_skylib
apesternikov Feb 9, 2024
bc4e954
Merge remote-tracking branch 'origin/main' into ap/bzlmod
apesternikov Feb 20, 2024
18a0ba1
update rules, keep compatible
apesternikov Feb 20, 2024
1946e1e
wip
apesternikov Feb 21, 2024
9a2d61c
Merge remote-tracking branch 'origin/ap/update_aspect_libs' into ap/b…
apesternikov Feb 21, 2024
79c7a45
use latest versions of bazel 6 and 7
apesternikov Feb 21, 2024
449c73c
update tests
apesternikov Feb 21, 2024
3a38106
cleanup
apesternikov Feb 21, 2024
fb3f032
remove direct reference to @k8s_test since it is not visible in bzlmod
apesternikov Feb 21, 2024
e6505dd
add missing params
apesternikov Feb 21, 2024
2bf8924
make kubeconfig, kubectl, clustrer mandatory
apesternikov Feb 21, 2024
33d16f5
bazel 6 compatibility for e2e
apesternikov Feb 21, 2024
b801c28
it requires bazel_skylib in e2e
apesternikov Feb 21, 2024
35938ec
cleanup
apesternikov Feb 21, 2024
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
build --nolegacy_external_runfiles
build --verbose_failures
build --@io_bazel_rules_go//go/config:pure
test --test_output=errors

2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.3.2
7.0.2
20 changes: 15 additions & 5 deletions .fasterci/config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
workflows:

- &build_workflow
name: Faster CI / build (6.1.0)
env:
USE_BAZEL_VERSION: "6.1.0"
name: Faster CI / build (default bazel ver)
on:
push:
branches:
Expand All @@ -27,8 +25,20 @@ workflows:
- //...
test_flags:
- --test_size_filters=-large,-enormous
- name: Build & test e2e with bzlmod
working-directory: e2e
bazel:
build_targets:
- //...
build_flags:
- --config=bzlmod
test_targets:
- //...
test_flags:
- --config=bzlmod
- --test_size_filters=-large,-enormous

- <<: *build_workflow
name: Faster CI / build (6.3.2)
name: Faster CI / build (6.5.0)
env:
USE_BAZEL_VERSION: "6.3.2"
USE_BAZEL_VERSION: "6.5.0"
16 changes: 2 additions & 14 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
# gazelle:proto disable_global

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

licenses(["notice"]) # Apache 2.0

exports_files(["WORKSPACE"])

# gazelle:prefix github.com/adobe/rules_gitops
# gazelle:prefix github.com/fasterci/rules_gitops
gazelle(
name = "gazelle",
build_tags = [
Expand Down Expand Up @@ -49,15 +49,3 @@ buildifier(
name = "buildifier-fix",
lint_mode = "fix",
)

buildifier_test(
name = "buildifier_check",
lint_mode = "warn",
lint_warnings = [
"-module-docstring",
"-function-docstring",
"-function-docstring-header",
"-function-docstring-args",
"-function-docstring-return",
],
)
51 changes: 51 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module(
name = "rules_gitops",
version = "0.50.0",
)

bazel_dep(name = "aspect_bazel_lib", version = "2.4.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.46.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")

Choose a reason for hiding this comment

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

The go_sdk.download function is called with a specific version of the Go SDK (1.21.5). This version of the Go SDK does not exist as Go versions follow a MAJOR.MINOR.PATCH format and as of my knowledge cutoff in early 2023, the Go language has not reached a 1.21.x version. Using a non-existent or incorrect version could lead to build failures or unexpected behavior. It is important to specify a valid Go SDK version that is compatible with the project's requirements.

Recommended solution: Verify the intended Go SDK version and update the version argument to go_sdk.download with a valid Go version. If the version was a typo, correct it to the intended version, such as 1.21.5 to 1.20.5 if that was the intended release.

apesternikov marked this conversation as resolved.
Show resolved Hide resolved

Choose a reason for hiding this comment

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

The version of the Go SDK specified for download is "1.21.5", which does not correspond to any official Go release version. Using a non-existent or incorrect version of the Go SDK could lead to build failures or unexpected behavior. It is important to specify a valid Go version that matches the official release versions. The recommended solution is to verify the intended Go version and update the version string to match an official Go release, such as "1.15.5" or "1.16.3".

Choose a reason for hiding this comment

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

The Go SDK version specified for download, "1.21.5", does not exist as Go versions follow a different semantic versioning pattern. The latest Go versions as of the last update are in the format of "1.x" where x is a sequential number, and there hasn't been a version "1.21.5". This could lead to build failures or unexpected behavior due to the incorrect version specification. It's recommended to verify and use a valid Go version that matches the project's requirements and is compatible with the rest of the dependencies.

Choose a reason for hiding this comment

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

The Go SDK version specified for download, "1.21.5", does not exist. The Go project follows a versioning scheme of 1.x.y, where x and y are integers. As of my last update, the Go project had not released a version "1.21.5". Using a non-existent version will likely cause the build to fail when attempting to download or use the Go SDK. It's important to verify the version number against the official Go releases and use a valid version.


bazel_dep(name = "gazelle", version = "0.35.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",
)
toolchains.kustomize()
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(
# name = "k8s_test",
# cluster = "mycluster",
# use_host_config = True,
# )

bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
Loading