Skip to content

Commit

Permalink
URL can now be variable
Browse files Browse the repository at this point in the history
  • Loading branch information
xansec committed Jun 30, 2023
1 parent bc1e253 commit b18b056
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 31 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<blah.mayhem.security> ...`.

```
bazel run //mayhem:push_fuzz_calculator_image
Expand Down
55 changes: 26 additions & 29 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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")
2 changes: 1 addition & 1 deletion mayhem/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
Expand Down

0 comments on commit b18b056

Please sign in to comment.