Skip to content
Draft
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.
2 changes: 1 addition & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
examples
examples/
41 changes: 38 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
build --nolegacy_external_runfiles
build --verbose_failures
test --test_output=errors
########################
# Import bazelrc presets
import %workspace%/tools/preset.bazelrc

# Don’t want to push a rules author to update their deps if not needed.
# https://bazel.build/reference/command-line-reference#flag--check_direct_dependencies
# https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0
common --config=ruleset

# Bazel settings that apply to this repository.
# Take care to document any settings that you expect users to apply.
# Settings that apply only to CI are in .github/workflows/ci.bazelrc

# Required until this is the default; expected in Bazel 7
common --enable_bzlmod

# Ensure that the MODULE.bazel.lock file is complete and committed.
# This is an important security measure: it ensures that developers on the
# same rule set download dependencies at the same versions with the same bits.
# This setting does not affect modules that depend on this module.
#
# When updating dependencies, use --lockfile_mode=refresh, for example:
# bazel mod tidy --lockfile_mode=refresh
#
# When testing different versions of Bazel, use --lockfile_mode=update or
# --lockfile_mode=off. The lock file format changes over time, and different
# versions of Bazel may expect different syntax. Bazel also implicitly requires
# some modules, and different versions have different dependencies, which
# also affects the contents of the lock file.
common --lockfile_mode=off

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
# This needs to be last statement in this
# config, as the user configuration should be able to overwrite flags from this file.
# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc
# (Note that we use .bazelrc.user so the file appears next to .bazelrc in directory listing,
# rather than user.bazelrc as suggested in the Bazel docs)
try-import %workspace%/.bazelrc.user
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
7.6.0
40 changes: 0 additions & 40 deletions .fasterci/config.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#################################
# Configuration for 'git archive'
# See https://git-scm.com/docs/git-archive#ATTRIBUTES

# Don't include examples in the distribution artifact, to reduce size.
# You may want to add additional exclusions for folders or files that users don't need.
examples export-ignore
8 changes: 8 additions & 0 deletions .github/workflows/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

buildifier(
name = "buildifier.check",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
)
17 changes: 17 additions & 0 deletions .github/workflows/buildifier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Buildifier
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: buildifier
run: bazel run //.github/workflows:buildifier.check
11 changes: 11 additions & 0 deletions .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file contains Bazel settings to apply on CI only.
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml

common --config=ci
# This directory is configured in GitHub actions to be persisted between runs.
# We do not enable the repository cache to cache downloaded external artifacts
# as these are generally faster to download again than to fetch them from the
# GitHub actions cache.
common --disk_cache=~/.cache/bazel
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
test --test_env=XDG_CACHE_HOME
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.DS_Store
Thumbs.db
bazel-*
.bazelrc.user
64 changes: 0 additions & 64 deletions BUILD

This file was deleted.

54 changes: 54 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2026 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
# OF ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.

# gazelle:exclude examples
# gazelle:map_kind bzl_library bzl_library @bazel_lib//:bzl_library.bzl

load("@gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
load("@package_metadata//licenses/rules:license.bzl", "license")
load("@package_metadata//purl:purl.bzl", "purl")
load("@package_metadata//rules:package_metadata.bzl", "package_metadata")
load("//kubectl:defs.bzl", "kubectl_binary")
load("//kustomize:defs.bzl", "kustomize_binary")

package_metadata(
name = "package_metadata",
purl = purl.bazel(
module_name(),
module_version(),
),
visibility = ["//visibility:public"],
)

license(
name = "license",
kind = "@package_metadata//licenses/spdx:Apache-2.0",
text = "LICENSE",
)

gazelle_binary(
name = "gazelle_bin",
languages = DEFAULT_LANGUAGES + [
"@bazel_skylib_gazelle_plugin//bzl",
],
)

gazelle(
name = "gazelle",
gazelle = "gazelle_bin",
)

kustomize_binary(
name = "kustomize",
)

kubectl_binary(
name = "kubectl",
)
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
© Copyright 2015-2020 Adobe. All rights reserved.
© Copyright 2015-2026 Adobe. All rights reserved.

Adobe holds the copyright for all the files found in this repository.

Expand Down
39 changes: 39 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module(
name = "rules_gitops",
compatibility_level = 0,
)

bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "package_metadata", version = "0.0.6")
bazel_dep(name = "rules_go", version = "0.52.0")

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

bazel_dep(name = "gazelle", version = "0.47.0")

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_github_v32", "com_github_xanzy_go_gitlab", "io_k8s_api", "io_k8s_apimachinery", "io_k8s_client_go", "org_golang_x_oauth2")

bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "bazel_lib", version = "3.0.0")


bazel_dep(name = "bazelrc-preset.bzl", version = "1.6.0")

kustomize = use_extension("//kustomize:defs.bzl", "kustomize")
use_repo(kustomize, "kustomize")

register_toolchains("@kustomize//toolchains:all")

kubectl = use_extension("//kubectl:defs.bzl", "kubectl")
use_repo(kubectl, "kubectl")

register_toolchains("@kubectl//toolchains:all")

bazel_dep(name = "rules_img", version = "0.3.3")

# Dev Dependencies
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.8.2", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1", dev_dependency = True)
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ The *Create GitOps PRs* step usually is the last step of a CI pipeline. `rules_g

For the full list of `create_gitops_prs` command line options, run:
```bash
bazel run @com_adobe_rules_gitops//gitops/prer:create_gitops_prs
bazel run //gitops/prer:create_gitops_prs
```

<a name="gitops-and-deployment-supported-git-servers"></a>
Expand Down Expand Up @@ -406,7 +406,7 @@ GIT_ROOT_DIR=$(git rev-parse --show-toplevel)
GIT_COMMIT_ID=$(git rev-parse HEAD)
GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if [ "${GIT_BRANCH_NAME}" == "master"]; then
bazel run @com_adobe_rules_gitops//gitops/prer:create_gitops_prs -- \
bazel run //gitops/prer:create_gitops_prs -- \
--workspace $GIT_ROOT_DIR \
--git_repo https://github.com/example/repo.git \
--git_mirror $GIT_ROOT_DIR/.git \
Expand Down Expand Up @@ -493,7 +493,7 @@ GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) # => release/team-20
RELEASE_BRANCH_SUFFIX=${GIT_BRANCH_NAME#"release/team"} # => -20200101
RELEASE_BRANCH=${GIT_BRANCH_NAME%${RELEASE_BRANCH_SUFFIX}} # => release/team
if [ "${RELEASE_BRANCH}" == "release/team"]; then
bazel run @com_adobe_rules_gitops//gitops/prer:create_gitops_prs -- \
bazel run //gitops/prer:create_gitops_prs -- \
--workspace $GIT_ROOT_DIR \
--git_repo https://github.com/example/repo.git \
--git_mirror $GIT_ROOT_DIR/.git \
Expand Down Expand Up @@ -586,7 +586,7 @@ The test code launches the script to perform the test setup. The test code shoul
The `@k8s_test//:kubeconfig` target referenced from `k8s_test_setup` rule serves the purpose of making Kubernetes configuration available in the test sandbox. The `kubeconfig` repository rule in the `WORKSPACE` file will need, at minimum, provide the cluster name.

```starlark
load("@com_adobe_rules_gitops//gitops:defs.bzl", "kubeconfig")
load("//gitops:defs.bzl", "kubeconfig")

kubeconfig(
name = "k8s_test",
Expand Down
5 changes: 5 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [ ] Extract any push logic from k8s_deploy/kustomize
- [ ] Download kubectl binary
- [ ] Create rules_docker adapter
- [ ] e2e testing
- [ ] docs
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adobe. All rights reserved.
# Copyright 2026 Adobe. All rights reserved.
# This file is licensed to you under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down Expand Up @@ -30,7 +30,7 @@ http_archive(
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

Expand All @@ -39,11 +39,11 @@ go_register_toolchains(version = "1.19.2")
#
# Self dependencies
#
load("@com_adobe_rules_gitops//gitops:deps.bzl", "rules_gitops_dependencies")
load("//gitops:deps.bzl", "rules_gitops_dependencies")

rules_gitops_dependencies()

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

rules_gitops_repositories()

Expand Down
1 change: 1 addition & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Marker that this is the root of a Bazel workspace.
Loading
Loading