Commit Graph

67 Commits

Author SHA1 Message Date
Rin Kuryloski 714f31af1f Use rules_elixir to build the cli without mix
Certain elixir-native deps are still build with mix, but this can be
corrected later

(cherry picked from commit 5debebfaf3)

# Conflicts:
#	deps/rabbit/BUILD.bazel
(cherry picked from commit 7f585d4102)

# Conflicts:
#	deps/rabbitmq_cli/BUILD.bazel
#	deps/rabbitmq_ct_helpers/BUILD.bazel
2024-06-20 11:48:40 +00:00
Michael Davis 7e470a8ddd
Remove rules_docker in favor of rules_oci (backport #10869) (#10906)
* Remove rules_docker in favor of rules_oci (#10869)

Local builds of images are extremely slow, but buildbuddy runners
don't have the emulator available

(cherry picked from commit c9ab302)
2024-05-01 14:30:04 -04:00
Michal Kuratczyk 2c2013004e Revert "Remove Elixir json dep in a few more places #9926"
This reverts commit 50e1fed344.

(cherry picked from commit 9373661a33)
2023-11-20 11:46:16 +00:00
Michael Klishin d419b0a431
Remove Elixir json dep in a few more places #9926 2023-11-16 10:23:41 -05:00
Michael Klishin 7992b20657 Resolve a conflict (#9476) 2023-09-19 18:44:06 -04:00
Michael Klishin 746337c981 BUILD.bazel: fix a few typos
(cherry picked from commit 439bc35916)

# Conflicts:
#	BUILD.bazel
2023-09-19 22:42:29 +00:00
Michael Klishin 6f21578167 Resolve a conflict (#9469) 2023-09-19 16:21:17 -04:00
Simon Unge 8af8cb4a7d Expose the "stop-broker" CMD
(cherry picked from commit 588f932e33)

# Conflicts:
#	BUILD.bazel
2023-09-19 20:08:26 +00:00
Rin Kuryloski 2381e978d7 Gazelle: ignore test deps fetched by make
Accidentally running gazelle before `git clean -xffd deps` should
produce less of a confusing diff

(cherry picked from commit c0bbb78033)
2023-08-29 07:36:07 +00:00
Rin Kuryloski 8fd907fa75 Add `bazel run rabbitmq-upgrade`
(cherry picked from commit 2c2b11689e)
2023-06-01 10:22:57 +00:00
Rin Kuryloski 16747070b3 Place looking_glass in the broker plugins file if `-c dbg` is set
in bazel

(cherry picked from commit 55d3d22bca)
2023-05-30 14:16:31 +00:00
Rin Kuryloski 2c5d152ce0 Add a workflow to compare the bazel/erlang.mk output
To catch any drift between the builds

(cherry picked from commit eb94a58bc9)
2023-05-15 15:27:03 +00:00
Rin Kuryloski 2a79464ae3 Also exclude the .erlang.mk directory in gazelle
(cherry picked from commit 4c9f31473a)
2023-05-15 11:33:57 +00:00
Rin Kuryloski 2ed1a79b67 Exclude nested deps fetched by make from gazelle
(cherry picked from commit 11b79f37a8)
2023-05-15 10:36:12 +00:00
Rin Kuryloski 9a747c972e Update rules_pkg to 0.9.1
(cherry picked from commit dad871e86c)
2023-05-12 13:41:07 +00:00
Rin Kuryloski d1e1084711 Replace globs in bazel with explicit lists of files
As this is preferred in rules_erlang 3.9.14

(cherry picked from commit a944439fba)
2023-04-25 18:03:08 +02:00
Rin Kuryloski 2aaf2176d4 Use gazelle generated bazel files
Bazel build files are now maintained primarily with `bazel run
gazelle`. This will analyze and merge changes into the build files as
necessitated by certain code changes (e.g. the introduction of new
modules).

In some cases there hints to gazelle in the build files, such as `#
gazelle:erlang...` or `# keep` comments. xref checks on plugins that
depend on the cli are a good example.

(cherry picked from commit 8de8f59d47)

# Conflicts:
#	deps/rabbit/BUILD.bazel
2023-04-19 05:34:15 +00:00
Rin Kuryloski a28e386c21 Use rules_erlang 3.9.12 which has the new plt attrs
(cherry picked from commit 42268d8c75)
2023-04-14 11:28:15 +00:00
Rin Kuryloski 8261d1fd0c Fix dialyzer errors for rabbitmq_shovel on OTP 26
`-Wunknown` is on by default in OTP 26, so for some plugins we must
now set `-Wno_unknown`

(cherry picked from commit c8db137ada)
2023-04-14 11:28:15 +00:00
Rin Kuryloski 07d01c5f43 Use pkg_files rules to avoid extra tars
in package-generic-unix and source_archive macros

(cherry picked from commit 6209180f80)
2023-03-15 10:18:39 +00:00
mergify[bot] ce4ca48337
Mark test deps as such (backport #7463) (#7471)
* Mark test deps as dev_dependency in MODULE.bazel

This keeps other modules depending on rabbitmq-server from inheriting
these deps

(cherry picked from commit faaf78bbed)

* Further annotate test deps with new rules_erlang 3.9.9 features

(cherry picked from commit 778ee998a6)

* Mark rabbitmq_ct_helpers/rabbitmq_ct_client_helpers as testonly

(cherry picked from commit 5cefbef029)

* Mark additional rules as testonly

(cherry picked from commit ced6520dee)

---------

Co-authored-by: Rin Kuryloski <kuryloskip@vmware.com>
2023-03-01 09:49:55 +01:00
Rin Kuryloski 2c7b37d7af
Use gazelle for external erlang deps (#6935)
* Add gazelle for use with update-repos command

* Use explicit BUILD.app_name files for erlang app deps

This allows us to remove the duplicate definitions in
workspace_helpers.bzl

These files are generated with gazelle. For instance:
BUILD.ra is generated with `bazel run gazelle -- update-repos
--verbose --build_files_dir=bazel hex.pm/ra@2.4.6`

Running gazelle this way will modify the WORKSPACE file, as gazelle
does not yet support MODULE.bazel files. Such changes to the WORKSPACE
can be dropped, and should not be committed. It may also update the
`moduleindex.yaml` file. Changes to `moduleindex.yaml` should be
committed.

However
* skip the explicit bazel/BUILD.osiris file, as osiris already contains the file in its repo
* skip the explict BUILD.inet_tcp_proxy_dist file, since the repo already contains a bazel BUILD.bazel file
  gazelle command: `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
inet_tcp_proxy_dist=github.com/rabbitmq/inet_tcp_proxy@master`
* jose is imported with `bazel run gazelle -- update-repos --verbose --build_files_dir=bazel
jose=github.com/michaelklishin/erlang-jose@d63c1c5c8f9c1a4f1438e234b886de8607a0034e`

* Move the bats dep directly to WORKSPACE, drop workspace_helpers.bzl

* Use bzlmod in windows tests
2023-01-25 09:41:56 +01:00
Rin Kuryloski 06a330f553 format with buildifier 2023-01-05 12:39:25 +01:00
Michael Klishin dc14942a2f
Merge pull request #6704 from SimonUnge/bazel-minor-updates
Bazel minor updates
2022-12-20 23:23:48 +04:00
Simon Unge 5a7c4d6556 See #6703. Add rabbit-queues target 2022-12-20 15:26:13 +01:00
Rin Kuryloski 3db02f7f9f Update `//:test-logs` and `//:test-node-data`
to handle the new ct_logdir flag
2022-12-19 13:49:07 +01:00
Simon Unge 20b23526e7 See #6645. Improving error output 2022-12-12 11:42:05 -08:00
Rin Kuryloski ce69ff1c58 Allow `bazel run rabbitmq-streams` 2022-12-08 13:03:17 +01:00
Michal Kuratczyk d35ccd60c7
Fix string quotes
Double quotes prevented `*` from being expanded, which made test-logs
from working on sharded test:
```
/Users/mkuratczyk/data/_bazel_mkuratczyk/a92ec86c7fe51656e9891e9f586b0a9c/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/open-test-logs.sh:
line 15: cd: bazel-testlogs/deps/rabbit/rabbit_stream_queue_SUITE/shard_1_of_*/test.outputs: No such file or directory
```

This folder does exist, but the `*` should be expanded with `12` in my
case.
2022-11-21 12:35:44 +01:00
Rin Kuryloski 535ac31542 Rework package_generic_unix & source_archive bazel macros
So that they are usable in other bazel modules depending on
rabbitmq-server (such as plugins)
2022-10-27 13:13:25 +02:00
Rin Kuryloski 102e6cf964 Use @rules_erlang//:debug_build instead of //:debug_build
This avoids the need for modules depening on rabbitmq-server to
declare their own copy of it
2022-10-27 09:27:20 +02:00
Rin Kuryloski 4cf410b268 Add a --test_build flag for building the broker for mixed versions 2022-10-19 13:51:49 +02:00
Rin Kuryloski 8537d0428b Use rules_erlang 3.6.3
Use the new @erlang_config repo from rules_erlang 3.6+ for simplified
config and the elimiation of the need for --config=local
2022-09-19 16:43:10 +02:00
Rin Kuryloski 27cad09e01 Fixup the source_archive macro in dist.bzl 2022-07-14 16:15:11 +02:00
Philip Kuryloski e2ca5d4190 Use keyword args in bazel macros as per buildifier linter 2022-07-11 18:16:25 +02:00
Philip Kuryloski 3f3df481de Adjust macros in dist.bzl to be used more generally
and not just at the root of this repo
2022-07-11 17:52:34 +02:00
David Ansari 107b8a4de1 Add `bazel run test-logs` fallback for non-desktop session
My workflow is developing RabbitMQ on an Ubuntu server.
Since it doesn't have a desktop or browser, let's fallback
for `bazel run test-logs` command to start an HTTP server instead.

From now on, I can run conveniently:
```
david@nuc:~/workspace/rabbitmq-server$ bazel run test-logs //deps/rabbitmq_auth_backend_oauth2:unit_SUITE --config=local
INFO: Analyzed target //:test-logs (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:test-logs up-to-date:
  bazel-bin/open-test-logs.sh
INFO: Elapsed time: 0.047s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Archive:  outputs.zip
Couldn't find a suitable web browser!

Set the BROWSER environment variable to your desired browser.

Warning: program returned non-zero exit code #256
/usr/bin/open: 882: www-browser: not found
/usr/bin/open: 882: links2: not found
/usr/bin/open: 882: elinks: not found
/usr/bin/open: 882: links: not found
/usr/bin/open: 882: lynx: not found
/usr/bin/open: 882: w3m: not found
xdg-open: no method available for opening 'index.html'
Open your browser at http://nuc:8000/index.html
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
```

and then open http://nuc:8000/index.html in my browser on MacOS.
2022-07-05 10:10:58 +00:00
David Ansari b08ef4583e Add Bazel targets start-cluster and stop-cluster
to have the equivalent of `make start-cluster` and `make stop-cluster`.

To create a 3-node RabbitMQ cluster:
```
bazel run --config=local start-cluster
```
To define number of nodes or a custom directory:
```
bazel run --config=local start-cluster NODES=5 TEST_TMPDIR="$HOME/scratch/myrabbit"
```

To stop the cluster:
```
bazel run --config=local stop-cluster
```
or, if started by the 2nd command:
```
bazel run --config=local stop-cluster NODES=5 TEST_TMPDIR="$HOME/scratch/myrabbit"
```
2022-07-04 13:54:26 +00:00
Philip Kuryloski 8facde8f8d Allow `bazel run test-logs` to work when logs are compressed
As happens if the spawn_strategy is not set to local

Also makes the implementaion of related commands more consistent
2022-06-20 18:18:22 +02:00
Philip Kuryloski 34db1a3c38 Add a rule for building a source archive
that includes the external dependencies
2022-06-14 10:44:09 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
Philip Kuryloski 5f61a11224 rename test-node-logs -> test-node-data 2022-05-09 11:01:54 +02:00
Philip Kuryloski 28f1455542 Add test-node-logs and remote-test-node-logs rules for bazel
For convenience when opening up the directory containing the rabbitmq
node logs produced by integration tests
2022-05-09 10:51:44 +02:00
Philip Kuryloski 7c0d26c150 Add helpers for quickly opening test logs from bazel
e.g. :
bazel run test-logs //deps/rabbitmq_auth_backend_oauth2:unit_SUITE
bazel run remote-test-logs //deps/rabbitmq_auth_backend_oauth2:unit_SUITE
2022-04-26 11:55:26 +02:00
Philip Kuryloski efcd881658 Use rules_erlang v2
bazel-erlang has been renamed rules_erlang. v2 is a substantial
refactor that brings Windows support. While this alone isn't enough to
run all rabbitmq-server suites on windows, one can at least now start
the broker (bazel run broker) and run the tests that do not start a
background broker process
2022-01-18 13:43:46 +01:00
Philip Kuryloski 70ef6b6984 Disable +deterministic in compilation_mode dbg under bazel
This allows compiling and reloading code from the erlang shell when
running the broker with `bazel run -c dbg broker`
2022-01-03 12:38:06 +01:00
Philip Kuryloski c8bc41f465 Cleanup BUILD.bazel 2021-12-17 17:08:16 +01:00
Philip Kuryloski da53d4018a Remove incorrect comment 2021-11-18 21:36:48 +01:00
Philip Kuryloski 11fd866247 Add the bazel target :package-generic-unix
Which can be used to build the artifact with bazel
2021-11-18 14:38:41 +01:00
Philip Kuryloski df0fa0ce60 Use externailzed rbe config in bazel 2021-11-15 09:12:23 +01:00