diff --git a/.bazelignore b/.bazelignore
index 1e107f52..5eaaac1d 100644
--- a/.bazelignore
+++ b/.bazelignore
@@ -1 +1,2 @@
-examples
+examples/
+.git/
diff --git a/.bazelrc b/.bazelrc
index 0d5d6565..8faa1265 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -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
\ No newline at end of file
diff --git a/.bazelversion b/.bazelversion
index f22d756d..93c8ddab 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-6.5.0
+7.6.0
diff --git a/.fasterci/config.yaml b/.fasterci/config.yaml
deleted file mode 100644
index bbf4ddbe..00000000
--- a/.fasterci/config.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-# configure vscode yaml support https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
-# yaml-language-server: $schema=https://fasterci.com/config.schema.json
-workflows:
-
- - &build_workflow
- name: Faster CI / build (6.5.0)
- env:
- USE_BAZEL_VERSION: "6.5.0"
- image: us.gcr.io/fasterci/bazelbuilder:5e59f651dbb5
- on:
- push:
- branches:
- - main
- pull_request:
- branches:
- - "**"
- from-branches-ignore:
- # will ignore PRs from renovate bot, since the bot is not a repository collaborator
- - "renovate/**"
- steps:
- - name: Build & test
- bazel:
- build_targets:
- - //...
- test_targets:
- - //...
- - name: Build & test examples
- working-directory: examples
- bazel:
- build_targets:
- - //...
- test_targets:
- - //...
- - name: Check
- run: bazel run //:buildifier-check
-
- - <<: *build_workflow
- name: Faster CI / build (5.4.1)
- env:
- USE_BAZEL_VERSION: "5.4.1"
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000..b38e6a24
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+#################################
+# 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
+tests export-ignore
\ No newline at end of file
diff --git a/.github/workflows/ci.bazelrc b/.github/workflows/ci.bazelrc
new file mode 100644
index 00000000..e76cf04b
--- /dev/null
+++ b/.github/workflows/ci.bazelrc
@@ -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
\ No newline at end of file
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 877d30d8..09f6361b 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -14,8 +14,7 @@ jobs:
strategy:
matrix:
bazel-version:
- - 6.5.0
- - 5.4.1
+ - 7.6.0
env:
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
steps:
@@ -35,49 +34,15 @@ jobs:
mkdir -p "${TOOLS_DIR}/bin/"
curl -Ls -o "${TOOLS_DIR}/bin/bazel" "https://github.com/bazelbuild/bazelisk/releases/download/v1.14.0/bazelisk-linux-amd64"
chmod +x "${TOOLS_DIR}/bin/bazel"
- curl -Ls -o "${TOOLS_DIR}/bin/buildifier" "https://github.com/bazelbuild/buildtools/releases/download/0.29.0/buildifier"
- chmod +x "${TOOLS_DIR}/bin/buildifier"
- curl -Ls -o "${TOOLS_DIR}/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/v0.29.0/kind-linux-amd64"
- chmod +x "${TOOLS_DIR}/bin/kind"
echo "${TOOLS_DIR}/bin" >> $GITHUB_PATH
- - name: Setup kind cluster
- run: |
- ./create_kind_cluster.sh
- - name: Build
- run: |
- bazel build //...
- - name: Check
- # run downloaded version of buildifier to reduce uncached build times
- # see: bazel run //:buildifier-check
- run: |
- find . -type f \(\
- -name '*.bzl' \
- -o -name '*.sky' \
- -o -name BUILD \
- -o -name BUILD.bazel \
- -o -name WORKSPACE \
- -o -name WORKSPACE.bazel \
- \) | xargs buildifier \
- -mode=check \
- -lint=warn \
- --warnings=-module-docstring,-function-docstring,-function-docstring-header,-function-docstring-args,-function-docstring-return,-print \
- || {
- buildifier_exit_code=$?
- echo "Error: failed buildifier checks. Please run \"bazel run //:buildifier-fix\" and commit the changes."
- exit $buildifier_exit_code
- }
- name: Test
run: |
bazel test //...
- name: Build examples
run: |
- cd examples
+ cd examples/helloworld
bazel build //...
- name: Test examples
run: |
- cd examples
- bazel test //...
- - name: E2E
- run: |
- cd examples
- ./e2e-test.sh
+ cd ../legacy_docker
+ bazel build //...
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4a632e12..1abd42bb 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,52 +30,18 @@ jobs:
mkdir -p "${TOOLS_DIR}/bin/"
curl -Ls -o "${TOOLS_DIR}/bin/bazel" "https://github.com/bazelbuild/bazelisk/releases/download/v1.14.0/bazelisk-linux-amd64"
chmod +x "${TOOLS_DIR}/bin/bazel"
- curl -Ls -o "${TOOLS_DIR}/bin/buildifier" "https://github.com/bazelbuild/buildtools/releases/download/0.29.0/buildifier"
- chmod +x "${TOOLS_DIR}/bin/buildifier"
- curl -Ls -o "${TOOLS_DIR}/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/v0.29.0/kind-linux-amd64"
- chmod +x "${TOOLS_DIR}/bin/kind"
echo "${TOOLS_DIR}/bin" >> $GITHUB_PATH
- - name: Setup kind cluster
- run: |
- ./create_kind_cluster.sh
- - name: Build
- run: |
- bazel build //...
- - name: Check
- # run downloaded version of buildifier to reduce uncached build times
- # see: bazel run //:buildifier-check
- run: |
- find . -type f \(\
- -name '*.bzl' \
- -o -name '*.sky' \
- -o -name BUILD \
- -o -name BUILD.bazel \
- -o -name WORKSPACE \
- -o -name WORKSPACE.bazel \
- \) | xargs buildifier \
- -mode=check \
- -lint=warn \
- --warnings=-module-docstring,-function-docstring,-function-docstring-header,-function-docstring-args,-function-docstring-return,-print \
- || {
- buildifier_exit_code=$?
- echo "Error: failed buildifier checks. Please run \"bazel run //:buildifier-fix\" and commit the changes."
- exit $buildifier_exit_code
- }
- name: Test
run: |
bazel test //...
- - name: Build examples
+ - name: Build helloworld
run: |
- cd examples
+ cd examples/helloworld
bazel build //...
- - name: Test examples
+ - name: Build legacy_docker
run: |
- cd examples
- bazel test //...
- - name: E2E
- run: |
- cd examples
- ./e2e-test.sh
+ cd ../legacy_docker
+ bazel build //...
- name: Prepare workspace snippet
run: .github/workflows/workspace_snippet.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt
- name: Release
diff --git a/.github/workflows/workspace_snippet.sh b/.github/workflows/workspace_snippet.sh
index d1d3a235..b0ed0dc7 100755
--- a/.github/workflows/workspace_snippet.sh
+++ b/.github/workflows/workspace_snippet.sh
@@ -8,18 +8,14 @@ SHA=$(git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip | shasum -a 256
cat << EOF
-WORKSPACE snippet:
+MODULE.bazel snippet:
\`\`\`starlark
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+bazel_dep(name = "rules_gitops", version = "${TAG}", dev_dependency = True)
+
+\`\`\`
-http_archive(
- name = "com_adobe_rules_gitops",
- sha256 = "${SHA}",
- strip_prefix = "${PREFIX}",
- urls = ["https://github.com/adobe/rules_gitops/archive/refs/tags/${TAG}.tar.gz"],
-)
EOF
awk '/---SNIP---/{f=1;next}/---END_SNIP---/{f=0}f' examples/WORKSPACE
diff --git a/.gitignore b/.gitignore
index 1833df43..b4eccf98 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
.DS_Store
Thumbs.db
bazel-*
+.bazelrc.user
diff --git a/BUILD b/BUILD
deleted file mode 100644
index d4718a48..00000000
--- a/BUILD
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 2020 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:build_tags darwin,linux
-# gazelle:exclude examples
-# gazelle:proto disable_global
-
-load("@bazel_gazelle//:def.bzl", "gazelle")
-load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
-
-licenses(["notice"]) # Apache 2.0
-
-exports_files(["WORKSPACE"])
-
-# gazelle:prefix github.com/adobe/rules_gitops
-gazelle(
- name = "gazelle",
- build_tags = [
- "integration",
- "debug",
- ],
- command = "fix",
- extra_args = [
- "-build_file_name",
- "BUILD,BUILD.bazel",
- ],
-)
-
-buildifier(
- name = "buildifier",
- lint_mode = "warn",
- lint_warnings = [
- "-module-docstring",
- "-function-docstring",
- "-function-docstring-header",
- "-function-docstring-args",
- "-function-docstring-return",
- ],
-)
-
-buildifier(
- name = "buildifier-fix",
- lint_mode = "fix",
-)
-
-buildifier(
- name = "buildifier-check",
- lint_mode = "warn",
- lint_warnings = [
- "-module-docstring",
- "-function-docstring",
- "-function-docstring-header",
- "-function-docstring-args",
- "-function-docstring-return",
- ],
- mode = "check",
-)
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 00000000..949625d5
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,66 @@
+# 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("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
+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("//kustomize:defs.bzl", "kustomize_binary")
+
+buildifier(
+ name = "buildifier.fix",
+ exclude_patterns = ["./.git/*"],
+ lint_mode = "fix",
+ mode = "fix",
+)
+
+buildifier_test(
+ name = "buildifier_test",
+ exclude_patterns = ["./.git/*"],
+ lint_mode = "warn",
+ mode = "check",
+ no_sandbox = True,
+ workspace = ":WORKSPACE.bazel",
+)
+
+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_bin",
+)
diff --git a/COPYRIGHT b/COPYRIGHT
index 7aeab94c..a05a31ad 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -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.
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 00000000..81a39322
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,53 @@
+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.59.0")
+bazel_dep(name = "rules_shell", version = "0.6.1")
+
+go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
+go_sdk.download(version = "1.24.12")
+
+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", "io_k8s_sigs_kind", "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)
+
+pull = use_repo_rule("@rules_img//img:pull.bzl", "pull")
+
+pull(
+ name = "alpine",
+ dev_dependency = True,
+ digest = "sha256:51183f2cfa6320055da30872f211093f9ff1d3cf06f39a0bdb212314c5dc7375",
+ layer_handling = "lazy",
+ registries = [
+ "mirror.gcr.io",
+ "index.docker.io",
+ ],
+ repository = "library/alpine",
+ tag = "3.23",
+)
diff --git a/README.md b/README.md
index a2bd2b0b..3953816a 100644
--- a/README.md
+++ b/README.md
@@ -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
```
@@ -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 \
@@ -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 \
@@ -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",
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 00000000..7fe34083
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,2 @@
+- [ ] e2e testing
+- [ ] docs
\ No newline at end of file
diff --git a/WORKSPACE b/WORKSPACE
deleted file mode 100644
index 9d4d086c..00000000
--- a/WORKSPACE
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2020 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.
-
-workspace(name = "com_adobe_rules_gitops")
-
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-http_archive(
- name = "io_bazel_rules_go",
- sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d",
- urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
- "https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
- ],
-)
-
-http_archive(
- name = "com_github_bazelbuild_buildtools",
- sha256 = "05c3c3602d25aeda1e9dbc91d3b66e624c1f9fdadf273e5480b489e744ca7269",
- strip_prefix = "buildtools-6.4.0",
- urls = [
- "https://github.com/bazelbuild/buildtools/archive/refs/tags/v6.4.0.tar.gz",
- ],
-)
-
-load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
-
-go_rules_dependencies()
-
-go_register_toolchains(version = "1.19.2")
-
-#
-# Self dependencies
-#
-load("@com_adobe_rules_gitops//gitops:deps.bzl", "rules_gitops_dependencies")
-
-rules_gitops_dependencies()
-
-load("@com_adobe_rules_gitops//gitops:repositories.bzl", "rules_gitops_repositories")
-
-rules_gitops_repositories()
-
-#
-# Development dependencies
-#
-
-http_archive(
- name = "com_google_protobuf",
- sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
- strip_prefix = "protobuf-3.14.0",
- urls = [
- "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
- "https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
- ],
-)
-
-load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
-
-protobuf_deps()
-
-load(
- "@io_bazel_rules_docker//go:image.bzl",
- go_image_repositories = "repositories",
-)
-
-go_image_repositories()
-
-load("@bazel_skylib//lib:unittest.bzl", "register_unittest_toolchains")
-
-register_unittest_toolchains()
-
-load("@com_github_bazelbuild_buildtools//buildifier:deps.bzl", "buildifier_dependencies")
-
-buildifier_dependencies()
-
-load("//skylib:k8s.bzl", "kubeconfig")
-
-kubeconfig(
- name = "k8s_test",
- cluster = "mycluster",
- use_host_config = True,
-)
diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel
new file mode 100644
index 00000000..53b52af6
--- /dev/null
+++ b/WORKSPACE.bazel
@@ -0,0 +1 @@
+# Marker that this is the root of a Bazel workspace.
diff --git a/adapters/BUILD.bazel b/adapters/BUILD.bazel
new file mode 100644
index 00000000..f752ef7d
--- /dev/null
+++ b/adapters/BUILD.bazel
@@ -0,0 +1,24 @@
+load("@bazel_lib//:bzl_library.bzl", "bzl_library")
+
+bzl_library(
+ name = "providers",
+ srcs = ["providers.bzl"],
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "rules_img",
+ srcs = ["rules_img.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":providers",
+ "@rules_img//img:providers",
+ ],
+)
+
+bzl_library(
+ name = "external_image",
+ srcs = ["external_image.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [":providers"],
+)
diff --git a/skylib/external_image.bzl b/adapters/external_image.bzl
similarity index 97%
rename from skylib/external_image.bzl
rename to adapters/external_image.bzl
index aae57c7e..ebb2d578 100644
--- a/skylib/external_image.bzl
+++ b/adapters/external_image.bzl
@@ -2,7 +2,7 @@
Implementation of external image information provider suitable for injection into manifests
"""
-load(":push.bzl", "K8sPushInfo")
+load(":providers.bzl", "K8sPushInfo")
def _external_image_impl(ctx):
sv = ctx.attr.image.split("@", 1)
diff --git a/adapters/providers.bzl b/adapters/providers.bzl
new file mode 100644
index 00000000..38715e21
--- /dev/null
+++ b/adapters/providers.bzl
@@ -0,0 +1,14 @@
+"""Provider definitions for container image adapters."""
+
+K8sPushInfo = provider(
+ doc = "Information required to inject image into a manifest and optionally push it",
+ fields = {
+ "image_label": "bazel target label of the image",
+ "legacy_image_name": "Optional: short name",
+ "registry": "registry where the image resides",
+ "repository": "repository where the image resides",
+ "digestfile": "a file containing the digest of the image",
+ "pusher": "Optional: an executable target used to push the image to a remote registry",
+ "run_environment": "Optional: a run environment info provider used for pushing the image",
+ },
+)
diff --git a/adapters/rules_img.bzl b/adapters/rules_img.bzl
new file mode 100644
index 00000000..ce5c9cd8
--- /dev/null
+++ b/adapters/rules_img.bzl
@@ -0,0 +1,29 @@
+"""Adapter for rules_img container images."""
+
+load("@rules_img//img:providers.bzl", "DeployInfo", "ImageManifestInfo")
+load("//adapters:providers.bzl", "K8sPushInfo")
+
+def _image_descriptor_impl(ctx):
+ digestfile = ctx.attr.image[OutputGroupInfo].digest.to_list()[0]
+
+ return [
+ DefaultInfo(),
+ K8sPushInfo(
+ image_label = ctx.attr.image.label,
+ registry = ctx.attr.registry,
+ repository = ctx.attr.repository,
+ digestfile = digestfile,
+ pusher = ctx.attr.push[DefaultInfo],
+ run_environment = ctx.attr.push[RunEnvironmentInfo],
+ ),
+ ]
+
+image_descriptor = rule(
+ implementation = _image_descriptor_impl,
+ attrs = {
+ "image": attr.label(mandatory = True, providers = [ImageManifestInfo]),
+ "push": attr.label(mandatory = True, cfg = "target", providers = [DeployInfo]),
+ "registry": attr.string(mandatory = True),
+ "repository": attr.string(mandatory = True),
+ },
+)
diff --git a/create_kind_cluster.sh b/create_kind_cluster.sh
deleted file mode 100755
index 64411c66..00000000
--- a/create_kind_cluster.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2020 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.
-
-set -o errexit
-# desired cluster name; default is "kind"
-KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-kind}"
-
-# kind executable
-go install sigs.k8s.io/kind@v0.29.0
-kind="$(go env GOPATH)/bin/kind"
-which "${kind}"
-
-# create registry container unless it already exists
-reg_name='kind-registry'
-reg_port='15000'
-running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
-if [ "${running}" != 'true' ]; then
- docker container rm "${reg_name}" 2>/dev/null || true
- docker run \
- -d --restart=always -e "REGISTRY_HTTP_ADDR=0.0.0.0:${reg_port}" -p "${reg_port}:${reg_port}" --name "${reg_name}" \
- registry:3
-fi
-
-# create a cluster with the local registry enabled in containerd
-cat <Hello World!