2023-02-21 08:47:33 +00:00
|
|
|
# Import Aspect bazelrc presets
|
2022-12-02 11:57:14 +00:00
|
|
|
|
2024-03-06 13:07:24 +00:00
|
|
|
import %workspace%/.aspect/bazelrc/bazel7.bazelrc
|
2023-02-21 08:47:33 +00:00
|
|
|
import %workspace%/.aspect/bazelrc/convenience.bazelrc
|
|
|
|
|
import %workspace%/.aspect/bazelrc/correctness.bazelrc
|
|
|
|
|
import %workspace%/.aspect/bazelrc/debug.bazelrc
|
2022-12-02 11:57:14 +00:00
|
|
|
import %workspace%/.aspect/bazelrc/javascript.bazelrc
|
2023-02-21 08:47:33 +00:00
|
|
|
import %workspace%/.aspect/bazelrc/performance.bazelrc
|
2023-09-13 15:48:33 +00:00
|
|
|
import %workspace%/.aspect/bazelrc/rules_ts.bazelrc
|
2022-12-02 11:57:14 +00:00
|
|
|
|
2024-04-12 15:18:43 +00:00
|
|
|
try-import %workspace%/.apko/.bazelrc
|
|
|
|
|
|
2022-12-02 11:57:14 +00:00
|
|
|
### YOUR PROJECT SPECIFIC SETTINGS GO HERE ###
|
|
|
|
|
|
|
|
|
|
# Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`.
|
|
|
|
|
# This file should appear in `.gitignore` so that settings are not shared with team members. This
|
|
|
|
|
# should be last statement in this config so the user configuration is able to overwrite flags from
|
|
|
|
|
# this file. See https://bazel.build/configure/best-practices#bazelrc-file.
|
|
|
|
|
try-import %workspace%/.aspect/bazelrc/user.bazelrc
|
|
|
|
|
|
2023-03-06 08:43:23 +00:00
|
|
|
# Enable bazel hack for autogold; apply to both build & test to avoid busting analysis cache
|
|
|
|
|
build --test_env=ENABLE_BAZEL_PACKAGES_LOAD_HACK=true
|
2023-04-28 08:41:13 +00:00
|
|
|
|
2023-04-13 11:01:37 +00:00
|
|
|
# Except in CI run E2E tests in headless mode
|
|
|
|
|
try-import %workspace%/user.bazelrc
|
2023-04-28 20:06:33 +00:00
|
|
|
|
|
|
|
|
# Some special sauce for the special NixOS users in your life :) set by dev-shell shell-hook
|
|
|
|
|
try-import %workspace%/.bazelrc-nix
|
Switch to OCI/Wolfi based image (#52693)
This PR ships our freshly rewritten container images built with
rules_oci and Wolfi, which for now will only be used on S2.
*What is this about*
This work is the conjunction of [hardening container
images](https://github.com/orgs/sourcegraph/projects/302?pane=issue&itemId=25019223)
and fully building our container images with Bazel.
* All base images are now distroless, based on Wolfi, meaning we fully
control every little package version and we won't be subject anymore to
Alpine maintainers dropping a postgres version for example.
* Container images are now built with `rules_oci`, meaning we don't have
Dockerfile anymore, but instead created through [Bazel
rules](https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@bzl/oci_wolfi/-/blob/enterprise/cmd/gitserver/BUILD.bazel).
Don't be scared, while this will look a bit strange to you at first,
it's much saner and simpler to do than our Dockerfiles and their muddy
shell scripts calling themselves in cascade.
:spiral_note_pad: *Plan*:
*1/ (NOW) We merge our branch on `main` today, here is what it does
change for you :point_down::skin-tone-3::*
* On `main`:
* It will introduce a new job on `main` _Bazel Push_, which will push
those new images on our registries with all tags prefixed by `bazel-`.
* These new images will be picked up by S2 and S2 only.
* The existing jobs building docker images and pushing them will stay in
place until we have QA'ed them enough and are confident to roll them out
on Dotcom.
* Because we'll be building both images, there will be more jobs running
on `main`, but this should not affect the wall clock time.
* On all branches (so your PRs and `main`)
* The _Bazel Test_ job will now run: Backend Integration Tests, E2E
Tests and CodeIntel QA
* This will increase the duration of your test jobs in PRs, but as we
haven't removed yet the `sg lint` step, it should not affect too much
the wall clock time of your PRs.
* But it will also increase your confidence toward your changes, as the
coverage will vastly increased compared to before.
* If you have ongoing branches which are affecting the docker images
(like adding a new binary, like the recent `scip-tags`, reach us out on
#job-fair-bazel so we can help you to port your changes. It's much much
simpler than before, but it's going to be unfamiliar to you).
* If something goes awfully wrong, we'll rollback and update this
thread.
*2/ (EOW / Early next week) Once we're confident enough with what we saw
on S2, we'll roll the new images on Dotcom.*
* After the first successful deploy and a few sanity checks, we will
drop the old images building jobs.
* At this point, we'll reach out to all TLs asking for their help to
exercise all features of our product to ensure we catch any potential
breakage.
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
* We tested our new images on `scale-testing` and it worked.
* The new container building rules comes with _container tests_ which
ensures that produced images are containing and configured with what
should be in there:
[example](https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@bzl/oci_wolfi/-/blob/enterprise/cmd/gitserver/image_test.yaml)
.
---------
Co-authored-by: Dave Try <davetry@gmail.com>
Co-authored-by: Will Dollman <will.dollman@sourcegraph.com>
2023-06-02 10:12:52 +00:00
|
|
|
|
|
|
|
|
# Used to locally cross compile, when targeting docker images
|
2024-02-20 13:57:56 +00:00
|
|
|
common --enable_platform_specific_config
|
|
|
|
|
common:macos --extra_toolchains @zig_sdk//toolchain:linux_amd64_gnu.2.34
|
|
|
|
|
common:macos --sandbox_add_mount_pair=/tmp
|
2024-06-06 18:45:05 +00:00
|
|
|
common:macos --experimental_inprocess_symlink_creation
|
2023-06-14 19:00:13 +00:00
|
|
|
|
|
|
|
|
# Helper to run only fast go unit tests
|
|
|
|
|
test:go-short --test_tag_filters=go --test_timeout_filters=short
|
2023-10-09 13:11:15 +00:00
|
|
|
|
|
|
|
|
# Helper to run go tests verbosely, useful for debugging test timeouts
|
|
|
|
|
test:go-verbose-test --test_env=GO_TEST_WRAP_TESTV=1
|
2023-10-16 11:51:29 +00:00
|
|
|
|
|
|
|
|
# .aspect/bazelrc/correctness.bazelrc sets this, but this breaks with a lot of Go external deps, so
|
|
|
|
|
# we instead disable it.
|
|
|
|
|
common --noincompatible_disallow_empty_glob
|
2023-11-07 10:54:03 +00:00
|
|
|
|
2024-05-02 12:56:45 +00:00
|
|
|
# Ensure clippy and rustfmt run for Rust targets
|
2023-11-07 10:54:03 +00:00
|
|
|
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
|
|
|
|
|
build --output_groups=+clippy_checks
|
2024-05-02 12:56:45 +00:00
|
|
|
build --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
|
|
|
|
|
build --output_groups=+rustfmt_checks
|
|
|
|
|
build --@rules_rust//:rustfmt.toml=//docker-images/syntax-highlighter:rustfmt.toml
|
2024-01-02 18:54:03 +00:00
|
|
|
|
|
|
|
|
common --noenable_bzlmod
|