From b18b0562ffcc1fa2600d939df3c55ac0d5349e31 Mon Sep 17 00:00:00 2001 From: Alexander Brewer Date: Thu, 29 Jun 2023 22:14:34 -0400 Subject: [PATCH] URL can now be variable --- .bazelrc | 1 + README.md | 2 +- WORKSPACE | 55 +++++++++++++++++++++++++--------------------------- mayhem/BUILD | 2 +- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/.bazelrc b/.bazelrc index 6bf5a8a..15411b2 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,6 +1,7 @@ # Force the use of Clang for C++ builds. build --action_env=CC=clang build --action_env=CXX=clang++ +build --define=MAYHEM_URL=app.mayhem.security # Define the --config=asan-libfuzzer configuration. build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer diff --git a/README.md b/README.md index 047655b..28d2052 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ bazel build //mayhem:fuzz_calculator_image ## To push docker image -Currently Mayhem repository is set to `demo.forallsecure.com`. You may want to change this to your own instance of Mayhem. +Currently Mayhem repository is set to `app.mayhem.security`. You can change this to your own instance of Mayhem with `bazel build --define=MAYHEM_URL= ...`. ``` bazel run //mayhem:push_fuzz_calculator_image diff --git a/WORKSPACE b/WORKSPACE index 03ab873..2dc4016 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -6,12 +6,31 @@ http_archive( strip_prefix = "rules_fuzzing-0.3.2", urls = ["https://github.com/bazelbuild/rules_fuzzing/archive/v0.3.2.zip"], ) +load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies") +rules_fuzzing_dependencies() +load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init") +rules_fuzzing_init() +load("@fuzzing_py_deps//:requirements.bzl", "install_deps") +install_deps() http_archive( name = "io_bazel_rules_docker", sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf", urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"], ) +load( + "@io_bazel_rules_docker//repositories:repositories.bzl", + container_repositories = "repositories", +) +container_repositories() + +load( + "@io_bazel_rules_docker//repositories:go_repositories.bzl", + container_go_deps = "go_deps", +) +container_go_deps() +load("@io_bazel_rules_docker//container:pull.bzl", "container_pull") +load("@io_bazel_rules_docker//container:push.bzl", "container_push") http_archive( name = "rules_pkg", @@ -22,32 +41,17 @@ http_archive( sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8", ) +load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") +rules_pkg_dependencies() + http_archive( name = "rules_mayhem", - strip_prefix = "rules_mayhem-rules_mayhem-0.3", - urls = ["https://github.com/xansec/rules_mayhem/archive/rules_mayhem-0.3.tar.gz"], - sha256 = "d10335582851f295ed22d8def539eb9cc09d4c8c065a2865c0e065205ad92587", + strip_prefix = "rules_mayhem-rules_mayhem-0.4", + urls = ["https://github.com/xansec/rules_mayhem/archive/rules_mayhem-0.4.tar.gz"], + sha256 = "5b643bb3a8628982d13f24abb011c56d26f3b8c170d6ebaef0633889dc9d5931", ) -load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies") -rules_fuzzing_dependencies() -load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init") -rules_fuzzing_init() - -load( - "@io_bazel_rules_docker//repositories:repositories.bzl", - container_repositories = "repositories", -) - -container_repositories() - -load( - "@io_bazel_rules_docker//repositories:go_repositories.bzl", - container_go_deps = "go_deps", -) -container_go_deps() - -load("@io_bazel_rules_docker//container:pull.bzl", "container_pull") +load("@rules_mayhem//mayhem:mayhem.bzl", "mayhem") container_pull( name = "ubuntu2004", @@ -66,10 +70,3 @@ container_pull( # tag field is ignored since digest is set tag = "latest", ) - -load("@io_bazel_rules_docker//container:push.bzl", "container_push") - -load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") -rules_pkg_dependencies() - -load("@rules_mayhem//mayhem:mayhem.bzl", "mayhem") diff --git a/mayhem/BUILD b/mayhem/BUILD index e40139a..ce41655 100644 --- a/mayhem/BUILD +++ b/mayhem/BUILD @@ -67,7 +67,7 @@ container_push( format = "Docker", testonly = True, image = ":fuzz_calculator_image.tar", - registry = "demo.forallsecure.com:5000", + registry = "$(MAYHEM_URL)", repository = "mayhem-bazel-example/calculator", tag = "latest", )