diff --git a/MODULE.bazel b/MODULE.bazel index 34a5f3ec..55108306 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -19,3 +19,26 @@ go_sdk.download(version = "1.22.2") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//onyx:go.mod") use_repo(go_deps, "com_github_azure_azure_sdk_for_go_sdk_azcore", "com_github_azure_azure_sdk_for_go_sdk_azidentity", "com_github_azure_azure_sdk_for_go_sdk_storage_azblob", "com_github_chigopher_pathlib", "com_github_invopop_jsonschema", "com_github_invopop_yaml", "com_github_netflix_go_iomux", "com_github_pkg_errors", "com_github_spf13_afero", "com_github_spf13_cobra", "com_github_spf13_viper", "com_github_stretchr_testify", "com_github_xeipuuv_gojsonschema", "in_gopkg_natefinch_lumberjack_v2", "in_gopkg_yaml_v3", "org_uber_go_zap") + +### +# core image +### + +bazel_dep(name = "aspect_bazel_lib", version = "2.8.0") +bazel_dep(name = "rules_oci", version = "1.7.2") +bazel_dep(name = "rules_pkg", version = "0.7.0") +bazel_dep(name = "container_structure_test", version = "1.15.0") + +oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") + +oci.pull( + name = "distroless_base", + digest = "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86", + image = "gcr.io/distroless/base", + platforms = [ + "linux/amd64", + "linux/arm64", + ], +) + +use_repo(oci, "distroless_base") \ No newline at end of file diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index f78c8637..f2c19cd8 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -7,8 +7,10 @@ "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/source.json": "7e3a9adf473e9af076ae485ed649d5641ad50ec5c11718103f34de03170d94ad", "https://bcr.bazel.build/modules/apple_support/1.5.0/MODULE.bazel": "50341a62efbc483e8a2a6aec30994a58749bd7b885e18dd96aa8c33031e558ef", "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", + "https://bcr.bazel.build/modules/aspect_bazel_lib/1.28.0/MODULE.bazel": "d793416e81c34d137d75ef84fe622df6c550826772a7f06e3b98a0d1c347fe1c", "https://bcr.bazel.build/modules/aspect_bazel_lib/1.36.0/MODULE.bazel": "710d3560d8891d209f7985f3e4223011c3fefed0cd4d23d3e7b77b0f8287ef64", - "https://bcr.bazel.build/modules/aspect_bazel_lib/1.36.0/source.json": "4c1212a4ae2474660abfa4f4ea1adf086a95e298d880d9bf5f08a06f60a7a5b5", + "https://bcr.bazel.build/modules/aspect_bazel_lib/2.8.0/MODULE.bazel": "d1170d33a4f6117ecd61aa7574d3d1f3f1a33ac0e2c1573b6bffa5a51c3753fc", + "https://bcr.bazel.build/modules/aspect_bazel_lib/2.8.0/source.json": "1562c277dfa738c29f6bc254228cc5689104a8b76b7c670ad4846066243322a1", "https://bcr.bazel.build/modules/bazel_features/1.1.0/MODULE.bazel": "cfd42ff3b815a5f39554d97182657f8c4b9719568eb7fded2b9135f084bf760b", "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", @@ -26,6 +28,8 @@ "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/source.json": "082ed5f9837901fada8c68c2f3ddc958bb22b6d654f71dd73f3df30d45d4b749", "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/container_structure_test/1.15.0/MODULE.bazel": "09a6df1ec08c3f9334ae9efabc97f58e4b6903a0c281d2369c8fb204e147a50e", + "https://bcr.bazel.build/modules/container_structure_test/1.15.0/source.json": "bf1b761d5ec4bd986adc9c3a5922777e76ae28a669834d7f256b2147443c0cd6", "https://bcr.bazel.build/modules/gazelle/0.32.0/MODULE.bazel": "b499f58a5d0d3537f3cf5b76d8ada18242f64ec474d8391247438bf04f58c7b8", "https://bcr.bazel.build/modules/gazelle/0.33.0/MODULE.bazel": "a13a0f279b462b784fb8dd52a4074526c4a2afe70e114c7d09066097a46b3350", "https://bcr.bazel.build/modules/gazelle/0.34.0/MODULE.bazel": "abdd8ce4d70978933209db92e436deb3a8b737859e9354fb5fd11fb5c2004c8a", @@ -38,6 +42,7 @@ "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", "https://bcr.bazel.build/modules/platforms/0.0.9/source.json": "cd74d854bf16a9e002fb2ca7b1a421f4403cda29f824a765acd3a8c56f8d43e6", "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", @@ -81,6 +86,7 @@ "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/stardoc/0.5.0/MODULE.bazel": "f9f1f46ba8d9c3362648eea571c6f9100680efc44913618811b58cc9c02cd678", "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", "https://bcr.bazel.build/modules/stardoc/0.5.4/MODULE.bazel": "6569966df04610b8520957cb8e97cf2e9faac2c0309657c537ab51c16c18a2a4", @@ -123,10 +129,10 @@ ] } }, - "@@aspect_bazel_lib~//lib:extensions.bzl%ext": { + "@@aspect_bazel_lib~//lib:extensions.bzl%toolchains": { "general": { - "bzlTransitiveDigest": "2YJfqVS0NTquRgksRcvqZgrBOtkTpaUyOk3HMCMEXUY=", - "usagesDigest": "NvJO9NbpkYabHmKriudcM2NGTL5OMl4tqJXzj3rmCXI=", + "bzlTransitiveDigest": "4z68+Zupkgvbh3DNKdL/JJXt9QfpOOmPhuzIsf/tfbI=", + "usagesDigest": "ZZWSyKdFVzqbWePJdyIcziRxbc4a52D46OnoHzB4KQc=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -145,24 +151,12 @@ "platform": "windows_amd64" } }, - "jq": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", - "ruleClassName": "jq_host_alias_repo", - "attributes": {} - }, "jq_darwin_amd64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", "ruleClassName": "jq_platform_repo", "attributes": { "platform": "darwin_amd64", - "version": "1.6" - } - }, - "expand_template_darwin_arm64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", - "ruleClassName": "expand_template_platform_repo", - "attributes": { - "platform": "darwin_arm64" + "version": "1.7" } }, "copy_to_directory_freebsd_amd64": { @@ -179,11 +173,12 @@ "platform": "linux_amd64" } }, - "copy_to_directory_linux_amd64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", - "ruleClassName": "copy_to_directory_platform_repo", + "jq_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", "attributes": { - "platform": "linux_amd64" + "platform": "linux_arm64", + "version": "1.7" } }, "coreutils_darwin_arm64": { @@ -191,22 +186,7 @@ "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "darwin_arm64", - "version": "0.0.16" - } - }, - "coreutils_linux_amd64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", - "ruleClassName": "coreutils_platform_repo", - "attributes": { - "platform": "linux_amd64", - "version": "0.0.16" - } - }, - "copy_directory_toolchains": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", - "ruleClassName": "copy_directory_toolchains_repo", - "attributes": { - "user_repository_name": "copy_directory" + "version": "0.0.26" } }, "copy_to_directory_linux_arm64": { @@ -216,19 +196,11 @@ "platform": "linux_arm64" } }, - "yq_linux_amd64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", - "ruleClassName": "yq_platform_repo", + "bsd_tar_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:tar_toolchain.bzl", + "ruleClassName": "bsdtar_binary_repo", "attributes": { - "platform": "linux_amd64", - "version": "4.25.2" - } - }, - "copy_to_directory_darwin_arm64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", - "ruleClassName": "copy_to_directory_platform_repo", - "attributes": { - "platform": "darwin_arm64" + "platform": "linux_arm64" } }, "copy_directory_darwin_amd64": { @@ -243,7 +215,7 @@ "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "darwin_amd64", - "version": "0.0.16" + "version": "0.0.26" } }, "coreutils_linux_arm64": { @@ -251,21 +223,14 @@ "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "linux_arm64", - "version": "0.0.16" + "version": "0.0.26" } }, - "coreutils_toolchains": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", - "ruleClassName": "coreutils_toolchains_repo", + "zstd_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:zstd_toolchain.bzl", + "ruleClassName": "zstd_binary_repo", "attributes": { - "user_repository_name": "coreutils" - } - }, - "copy_directory_freebsd_amd64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", - "ruleClassName": "copy_directory_platform_repo", - "attributes": { - "platform": "freebsd_amd64" + "platform": "linux_arm64" } }, "yq_linux_s390x": { @@ -300,7 +265,7 @@ "ruleClassName": "jq_platform_repo", "attributes": { "platform": "darwin_arm64", - "version": "1.6" + "version": "1.7" } }, "yq_darwin_amd64": { @@ -318,6 +283,175 @@ "platform": "linux_arm64" } }, + "expand_template_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_toolchains_repo", + "attributes": { + "user_repository_name": "expand_template" + } + }, + "bats_assert": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "98ca3b685f8b8993e48ec057565e6e2abcc541034ed5b0e81f191505682037fd", + "urls": [ + "https://github.com/bats-core/bats-assert/archive/v2.1.0.tar.gz" + ], + "strip_prefix": "bats-assert-2.1.0", + "build_file_content": "load(\"@aspect_bazel_lib//lib:copy_to_directory.bzl\", \"copy_to_directory\")\n\ncopy_to_directory(\n name = \"assert\",\n hardlink = \"on\",\n srcs = glob([\n \"src/**\",\n \"load.bash\",\n ]),\n out = \"bats-assert\",\n visibility = [\"//visibility:public\"]\n)\n" + } + }, + "copy_to_directory_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "darwin_amd64" + } + }, + "zstd_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:zstd_toolchain.bzl", + "ruleClassName": "zstd_binary_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "bsd_tar_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:tar_toolchain.bzl", + "ruleClassName": "bsdtar_binary_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "yq_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_toolchains_repo", + "attributes": { + "user_repository_name": "yq" + } + }, + "zstd_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:zstd_toolchain.bzl", + "ruleClassName": "zstd_binary_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "bats_support": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7815237aafeb42ddcc1b8c698fc5808026d33317d8701d5ec2396e9634e2918f", + "urls": [ + "https://github.com/bats-core/bats-support/archive/v0.3.0.tar.gz" + ], + "strip_prefix": "bats-support-0.3.0", + "build_file_content": "load(\"@aspect_bazel_lib//lib:copy_to_directory.bzl\", \"copy_to_directory\")\n\ncopy_to_directory(\n name = \"support\",\n hardlink = \"on\",\n srcs = glob([\n \"src/**\",\n \"load.bash\",\n ]),\n out = \"bats-support\",\n visibility = [\"//visibility:public\"]\n)\n" + } + }, + "bsd_tar_windows_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:tar_toolchain.bzl", + "ruleClassName": "bsdtar_binary_repo", + "attributes": { + "platform": "windows_amd64" + } + }, + "jq": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_host_alias_repo", + "attributes": {} + }, + "expand_template_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", + "ruleClassName": "expand_template_platform_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "bsd_tar_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:tar_toolchain.bzl", + "ruleClassName": "bsdtar_binary_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "copy_to_directory_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "linux_amd64" + } + }, + "coreutils_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "0.0.26" + } + }, + "copy_directory_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_toolchains_repo", + "attributes": { + "user_repository_name": "copy_directory" + } + }, + "yq_linux_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", + "ruleClassName": "yq_platform_repo", + "attributes": { + "platform": "linux_amd64", + "version": "4.25.2" + } + }, + "copy_to_directory_darwin_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", + "ruleClassName": "copy_to_directory_platform_repo", + "attributes": { + "platform": "darwin_arm64" + } + }, + "coreutils_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", + "ruleClassName": "coreutils_toolchains_repo", + "attributes": { + "user_repository_name": "coreutils" + } + }, + "copy_directory_freebsd_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_directory_toolchain.bzl", + "ruleClassName": "copy_directory_platform_repo", + "attributes": { + "platform": "freebsd_amd64" + } + }, + "zstd_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:zstd_toolchain.bzl", + "ruleClassName": "zstd_binary_repo", + "attributes": { + "platform": "darwin_amd64" + } + }, + "zstd_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:zstd_toolchain.bzl", + "ruleClassName": "zstd_toolchains_repo", + "attributes": { + "user_repository_name": "zstd" + } + }, + "bats_file": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9b69043241f3af1c2d251f89b4fcafa5df3f05e97b89db18d7c9bdf5731bb27a", + "urls": [ + "https://github.com/bats-core/bats-file/archive/v0.4.0.tar.gz" + ], + "strip_prefix": "bats-file-0.4.0", + "build_file_content": "load(\"@aspect_bazel_lib//lib:copy_to_directory.bzl\", \"copy_to_directory\")\n\ncopy_to_directory(\n name = \"file\",\n hardlink = \"on\",\n srcs = glob([\n \"src/**\",\n \"load.bash\",\n ]),\n out = \"bats-file\",\n visibility = [\"//visibility:public\"]\n)\n" + } + }, "expand_template_linux_arm64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", "ruleClassName": "expand_template_platform_repo", @@ -330,14 +464,33 @@ "ruleClassName": "jq_platform_repo", "attributes": { "platform": "linux_amd64", - "version": "1.6" + "version": "1.7" } }, - "expand_template_toolchains": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:expand_template_toolchain.bzl", - "ruleClassName": "expand_template_toolchains_repo", + "bsd_tar_darwin_amd64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:tar_toolchain.bzl", + "ruleClassName": "bsdtar_binary_repo", "attributes": { - "user_repository_name": "expand_template" + "platform": "darwin_amd64" + } + }, + "bsd_tar_toolchains": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:tar_toolchain.bzl", + "ruleClassName": "tar_toolchains_repo", + "attributes": { + "user_repository_name": "bsd_tar" + } + }, + "bats_toolchains": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a1a9f7875aa4b6a9480ca384d5865f1ccf1b0b1faead6b47aa47d79709a5c5fd", + "urls": [ + "https://github.com/bats-core/bats-core/archive/v1.10.0.tar.gz" + ], + "strip_prefix": "bats-core-1.10.0", + "build_file_content": "load(\"@local_config_platform//:constraints.bzl\", \"HOST_CONSTRAINTS\")\nload(\"@aspect_bazel_lib//lib/private:bats_toolchain.bzl\", \"bats_toolchain\")\nload(\"@aspect_bazel_lib//lib:copy_to_directory.bzl\", \"copy_to_directory\")\n\ncopy_to_directory(\n name = \"core\",\n hardlink = \"on\",\n srcs = glob([\n \"lib/**\",\n \"libexec/**\"\n ]) + [\"bin/bats\"],\n out = \"bats-core\",\n)\n\nbats_toolchain(\n name = \"toolchain\",\n core = \":core\",\n libraries = [\"@bats_support//:support\", \"@bats_assert//:assert\", \"@bats_file//:file\"]\n)\n\ntoolchain(\n name = \"bats_toolchain\",\n exec_compatible_with = HOST_CONSTRAINTS,\n toolchain = \":toolchain\",\n toolchain_type = \"@aspect_bazel_lib//lib:bats_toolchain_type\",\n)\n" } }, "yq_windows_amd64": { @@ -348,19 +501,12 @@ "version": "4.25.2" } }, - "copy_to_directory_darwin_amd64": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:copy_to_directory_toolchain.bzl", - "ruleClassName": "copy_to_directory_platform_repo", - "attributes": { - "platform": "darwin_amd64" - } - }, "jq_windows_amd64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", "ruleClassName": "jq_platform_repo", "attributes": { "platform": "windows_amd64", - "version": "1.6" + "version": "1.7" } }, "expand_template_freebsd_amd64": { @@ -414,19 +560,12 @@ "version": "4.25.2" } }, - "yq_toolchains": { - "bzlFile": "@@aspect_bazel_lib~//lib/private:yq_toolchain.bzl", - "ruleClassName": "yq_toolchains_repo", - "attributes": { - "user_repository_name": "yq" - } - }, "coreutils_windows_amd64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "windows_amd64", - "version": "0.0.16" + "version": "0.0.26" } }, "yq_linux_arm64": { @@ -457,6 +596,75 @@ ] } }, + "@@container_structure_test~//:repositories.bzl%extension": { + "general": { + "bzlTransitiveDigest": "j+c9VX4TzkT+qb1ANFPlUmnZ/Qw1RmpR/B42ljRDArs=", + "usagesDigest": "N58gbuWvYD87x+D3A4qbtoxMX7w+M6itVKjS5SYFzg0=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "structure_test_st_linux_i386": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "linux_i386" + } + }, + "structure_test_st_linux_s390x": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "linux_s390x" + } + }, + "structure_test_st_linux_amd64": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "linux_amd64" + } + }, + "structure_test_st_darwin_arm64": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "darwin_arm64" + } + }, + "structure_test_st_windows_amd64": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "windows_amd64" + } + }, + "structure_test_st_darwin_amd64": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "darwin_amd64" + } + }, + "structure_test_toolchains": { + "bzlFile": "@@container_structure_test~//bazel:toolchains_repo.bzl", + "ruleClassName": "toolchains_repo", + "attributes": { + "toolchain_type": "@container_structure_test//bazel:structure_test_toolchain_type", + "toolchain": "@structure_test_st_{platform}//:structure_test_toolchain" + } + }, + "structure_test_st_linux_arm64": { + "bzlFile": "@@container_structure_test~//:repositories.bzl", + "ruleClassName": "structure_test_repositories", + "attributes": { + "platform": "linux_arm64" + } + } + }, + "recordedRepoMappingEntries": [] + } + }, "@@platforms//host:extension.bzl%host_platform": { "general": { "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", @@ -476,7 +684,7 @@ }, "@@rules_helm~//helm:extensions.bzl%helm": { "general": { - "bzlTransitiveDigest": "iiX0hGGmEYnw5/955EvLgcGbjGKxoSIPygNxOPQ8v8Q=", + "bzlTransitiveDigest": "RqLSHkFQ+YS0QA+evdU6nj54hxU6k2kylvUJVwuv9pY=", "usagesDigest": "hhJCTUaQPsKHdaRPvfPepXWj75R6RYioBUK5hHOGvaE=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -751,8 +959,8 @@ }, "@@rules_oci~//oci:extensions.bzl%oci": { "general": { - "bzlTransitiveDigest": "HlGyITm5DL/vJwV3IGcFMd3EW//CqNIzuF0b0C7MXzw=", - "usagesDigest": "EM859SKRj1o9zGX2wLIRwlUs4SJTpaPo14GJHzbPXA0=", + "bzlTransitiveDigest": "vfqaAa0+maDwKLbpAqUMCGJu9rRk12PEvLcV1WFuRc4=", + "usagesDigest": "lz/h6zypjM2o/OwiYTZlV3DbjtbJnK49uz0mUKFIKG4=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -790,7 +998,24 @@ "ruleClassName": "jq_platform_repo", "attributes": { "platform": "darwin_amd64", - "version": "1.6" + "version": "1.7" + } + }, + "distroless_base": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_alias", + "attributes": { + "target_name": "distroless_base", + "scheme": "https", + "registry": "gcr.io", + "repository": "distroless/base", + "identifier": "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86", + "platforms": { + "@@platforms//cpu:x86_64": "@distroless_base_linux_amd64", + "@@platforms//cpu:arm64": "@distroless_base_linux_arm64" + }, + "bzlmod_repository": "distroless_base", + "reproducible": true } }, "copy_to_directory_freebsd_amd64": { @@ -815,12 +1040,20 @@ "crane_version": "v0.18.0" } }, + "jq_linux_arm64": { + "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", + "ruleClassName": "jq_platform_repo", + "attributes": { + "platform": "linux_arm64", + "version": "1.7" + } + }, "coreutils_darwin_arm64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "darwin_arm64", - "version": "0.0.16" + "version": "0.0.26" } }, "coreutils_linux_amd64": { @@ -828,7 +1061,7 @@ "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "linux_amd64", - "version": "0.0.16" + "version": "0.0.26" } }, "yq_linux_amd64": { @@ -874,7 +1107,7 @@ "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "darwin_amd64", - "version": "0.0.16" + "version": "0.0.26" } }, "coreutils_linux_arm64": { @@ -882,7 +1115,7 @@ "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "linux_arm64", - "version": "0.0.16" + "version": "0.0.26" } }, "coreutils_toolchains": { @@ -913,12 +1146,24 @@ "crane_version": "v0.18.0" } }, + "distroless_base_linux_amd64": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "gcr.io", + "repository": "distroless/base", + "identifier": "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86", + "platform": "linux/amd64", + "target_name": "distroless_base_linux_amd64" + } + }, "jq_darwin_arm64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:jq_toolchain.bzl", "ruleClassName": "jq_platform_repo", "attributes": { "platform": "darwin_arm64", - "version": "1.6" + "version": "1.7" } }, "yq_darwin_amd64": { @@ -942,7 +1187,7 @@ "ruleClassName": "jq_platform_repo", "attributes": { "platform": "linux_amd64", - "version": "1.6" + "version": "1.7" } }, "yq_windows_amd64": { @@ -974,7 +1219,7 @@ "ruleClassName": "jq_platform_repo", "attributes": { "platform": "windows_amd64", - "version": "1.6" + "version": "1.7" } }, "copy_to_directory_darwin_amd64": { @@ -1037,12 +1282,24 @@ "crane_version": "v0.18.0" } }, + "distroless_base_linux_arm64": { + "bzlFile": "@@rules_oci~//oci/private:pull.bzl", + "ruleClassName": "oci_pull", + "attributes": { + "scheme": "https", + "registry": "gcr.io", + "repository": "distroless/base", + "identifier": "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86", + "platform": "linux/arm64", + "target_name": "distroless_base_linux_arm64" + } + }, "coreutils_windows_amd64": { "bzlFile": "@@aspect_bazel_lib~//lib/private:coreutils_toolchain.bzl", "ruleClassName": "coreutils_platform_repo", "attributes": { "platform": "windows_amd64", - "version": "0.0.16" + "version": "0.0.26" } }, "yq_linux_arm64": { diff --git a/core-image/BUILD b/core-image/BUILD new file mode 100644 index 00000000..ab126365 --- /dev/null +++ b/core-image/BUILD @@ -0,0 +1,59 @@ +load("@aspect_bazel_lib//lib:testing.bzl", "assert_archive_contains") +load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") +load("@container_structure_test//:defs.bzl", "container_structure_test") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball") +load("@rules_pkg//:pkg.bzl", "pkg_tar") + +# Put app go_binary into a tar layer. +pkg_tar( + name = "app_layer", + srcs = ["//onyx/cmd/cli:onyx"], + # If the binary depends on RUNFILES, uncomment the attribute below. + # include_runfiles = True +) + +# Prove that the application is at the path we expect in that tar. +assert_archive_contains( + name = "test_app_layer", + archive = "app_layer.tar", + expected = ["onyx"], +) + +oci_image( + name = "image", + base = "@distroless_base", + entrypoint = ["/onyx"], + tars = [":app_layer"], +) + +# This is the target that should be released to the target platform +platform_transition_filegroup( + name = "transitioned_image", + srcs = [":image"], + target_platform = select({ + "@platforms//cpu:arm64": "@rules_go//go/toolchain:linux_arm64", + "@platforms//cpu:x86_64": "@rules_go//go/toolchain:linux_amd64", + }), +) + +# $ bazel build //core-image:tarball +# $ docker load --input $(bazel cquery --output=files //core-image:tarball) +# $ docker run --rm gcr.io/example:latest +# string( +# - "Hello World", +# + "Hello Go", +# ) +oci_tarball( + name = "tarball", + # Use the image built for the exec platform rather than the target platform + image = ":image", + repo_tags = ["gcr.io/example:latest"], +) + +container_structure_test( + name = "test", + configs = ["test.yaml"], + # Use the image built for the exec platform rather than the target platform + image = ":image", + tags = ["requires-docker"], +) \ No newline at end of file diff --git a/core-image/test.yaml b/core-image/test.yaml new file mode 100644 index 00000000..5dbcf50a --- /dev/null +++ b/core-image/test.yaml @@ -0,0 +1,5 @@ +schemaVersion: 2.0.0 +commandTests: + - name: 'test' + command: '/onyx' + expectedOutput: ['"Hello World"'] \ No newline at end of file diff --git a/onyx/cmd/cli/BUILD.bazel b/onyx/cmd/cli/BUILD.bazel index 17543616..ac5f90a4 100644 --- a/onyx/cmd/cli/BUILD.bazel +++ b/onyx/cmd/cli/BUILD.bazel @@ -18,7 +18,7 @@ go_library( ) go_binary( - name = "cli", + name = "onyx", embed = [":cli_lib"], visibility = ["//visibility:public"], )