Commit Graph

25 Commits

Author SHA1 Message Date
Jean-Hadrien Chabran
35aed2491e
feat(rel): plug upgradetest into release tests (#61563)
---------

Co-authored-by: Warren Gifford <warrenbruceg@gmail.com>
2024-04-19 16:36:38 +02:00
Warren Gifford
7afa6d8ac9
Upgrade test CLI tool (#60594)
* migrate just the upgrade test tooling from the original branch

* sg lint

* change to sourcegraph logs

* bazel configure

* replace all log instances, fix and remove bug_versions dependency in bazel

* remove obselete select for darwin-docker builds

* Apply suggestions from code review

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>

* address review feedback

* prettier

---------

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
2024-04-02 09:44:09 -07:00
Noah S-C
98e0f75d1e
bazel: use transitions to apply cross-compile platform automatically to oci_image (#60569)
Removes the need to pass `--config=docker-darwin` through the following mechanisms:

1. `--enable_platform_specific_config` to enable certain flags on macos only e.g. `--extra_toolchains @zig_sdk//toolchain:linux_amd64_gnu.2.34` and `--sandbox_add_mount_pair=/tmp` (see [.bazelrc change](https://github.com/sourcegraph/sourcegraph/pull/60569/files?file-filters%5B%5D=dotfile&show-viewed-files=true))
2. Apply a transition (using https://github.com/fmeum/with_cfg.bzl, please view [the following great video on it](https://www.youtube.com/watch?v=U5bdQRQY-io)) on `oci_image` targets when on the `@platforms//os:macos` platform to transition to the `@zig_sdk//platform:linux_amd64` platform. 
	- This will start at `oci_image` targets and propagate down to e.g. `go_{binary,library}` etc targets with the "transitioned" platform configuration, resulting in them being built with the transitioned-to platform
3. Remove `darwin_docker_e2e_go` config_setting and `darwin-docker` bool_flag.
	- These aren't necessary anymore, as the places where these were used were not in the transitive closure rooted at an `oci_image` target, meaning they wouldn't be transitioned.

To review, view [the following (filtered) files](https://github.com/sourcegraph/sourcegraph/pull/60569/files?file-filters%5B%5D=.bzl&file-filters%5B%5D=.sh&file-filters%5B%5D=.yaml&file-filters%5B%5D=No+extension&file-filters%5B%5D=dotfile&show-viewed-files=true)  along with [the root BUILD.bazel](https://github.com/sourcegraph/sourcegraph/pull/60569/files#diff-7fc57714ef13c3325ce2a1130202edced92fcccc0c6db34a72f7b57f60d552a3). All the other files are just changing the `load` statements from `@rules_oci` to `//dev:oci_defs.bzl`

## Test plan

CI, checked image locally and `sg test bazel-backend-integration` & `sg test bazel-e2e`
2024-02-20 13:57:56 +00:00
Noah S-C
06262e0936
bazel: patches to allow use_default_shell_env for e2e testing (#59675)
Another step towards https://github.com/sourcegraph/sourcegraph/issues/59155, previously `bazel test //...` would error at analysis time on `//client/web/src/end-to-end:e2e` due to it attempting to perform variable substitution for env vars e.g. `"HEADLESS": "$(E2E_HEADLESS)"`, for values not defined via `--define` (we only set these explicitly in .aspect/bazelrc/ci.sourcegraph.bazelrc and some `sg` targets).

By leveraging https://bazel.build/rules/lib/builtins/actions#run.use_default_shell_env, we can allow the test to read values from `--action_env` while _also_ having explicit values set via `env` macro parameter. Previously, setting `env` macro parameter would completely shadow any `--action_env` values. 
Unfortunately, we cant use `--test_env` for this, as `js_run_binary` is an action not a test (or something like that?).

We also cant do env renaming anymore, meaning we have to drop the `E2E_` prefix for some env vars. At least one script needed some reworking to accommodate that `e2e_test.sh` 

![image](https://github.com/sourcegraph/sourcegraph/assets/18282288/133a98c6-411d-4a10-95fd-4abd42cedb24)


## Test plan

👁️ CI once again 👁️
2024-01-24 18:50:19 -08:00
Jean-Hadrien Chabran
54dd821f56
ci: isolate P4 SubRepo perms into a different target that gets run concurrently (#59670) 2024-01-17 15:45:31 +01:00
Jean-Hadrien Chabran
551fae4cb3
ci: remove outdated scripts (#59666) 2024-01-17 11:39:33 +00:00
Erik Seliger
bb09a4ac1f
Remove HTTP for inter-service RPC (#59093)
In the upcoming release, we will only support gRPC going forward. This PR removes the old HTTP client and server implementations and a few leftovers from the transition.
2024-01-11 19:46:32 +01:00
Erik Seliger
dad4871a96
Make sure we test gRPC in CI suites (#59094)
Some of the suites weren't yet using gRPC - this PR turns it on so we gain some more confidence before we start dropping HTTP entirely.
2023-12-19 00:35:56 +01:00
William Bezuidenhout
e85386c989
sg: add config to run backend-integration tests locally (#58829)
when generating unique ids in integration tests fallback to hexdump if openssl is not available
2023-12-08 17:27:51 +02:00
William Bezuidenhout
d9c1d287c8
aspect workflows: add initial aspect workflow yaml (#56569)
* add initial aspect workflow yaml
- try reading docker config env var
- bump both timers
- bump grpc test timout to long
- skip additional perforce test and run all tests
- bump timeouts
- more timeout bumps and skip p4 test
- bump doc:test timeout
- bump e2e_test timeout
- bump database/connections/live timeout
- tag integration tests as exclusive

* add recommended bazelrc in workflows to speed up cold builds

* disable experimental_fetch_all_coverage_outputs

* port changes from https://github.com/sourcegraph/sourcegraph/compare/aspect-trial/wb-add-initial-config...aspect-trial/wb-add-initial-config-greg

* bazel configure

* add //:postcss_config_js as data target to client/web

* remove postcss added in debug

* use node-fetch and only test codeintellify

* use testing fetch.js setup

* fix syntax in testSetup

* various fixes

revert timeout bump on repository test
re-enable git p4 test
add testing from shared deps
bazel configure

* update comments on skipped tests

* restore `is_percy_enabled` for mocha_test

* slightly increase repo cloning wait

* use process.cwd instead of __dirname

* set sizing to moderate as well for embeddings

* remove setting CI in workflows yaml

* fix sizing

* workflow yaml tweaks and bazelrc tweaks

* make bazelrc consistent with what was in workflow yaml

---------

Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
Co-authored-by: Greg Magolan <greg@aspect.dev>
2023-11-24 11:52:17 +02:00
Greg Magolan
1101c68ebb
build(bazel): mark integration tests that must run in isolation as exclusive (#58508) 2023-11-23 15:23:50 +02:00
Jean-Hadrien Chabran
a83feede18
bzl: do not mount data volumes for e2e tests (#58101) 2023-11-03 16:53:59 +02:00
Greg Magolan
64a466e06a
build: fixup typo in BUILD file no-sandbox tag (#57969) 2023-10-30 14:45:15 +01:00
Petri-Johan Last
39ddc34fcb
Make sub-repo permissions integration test functional (#57792) 2023-10-24 05:05:22 +00:00
Erik Seliger
c4557864e5
Revert "Make sub-repo permissions integration test functional (#57764)" (#57771)
This reverts commit 7f3e4755bd.

It seems to time out.
2023-10-20 14:39:02 +00:00
Petri-Johan Last
7f3e4755bd
Make sub-repo permissions integration test functional (#57764) 2023-10-20 13:27:17 +00:00
Jean-Hadrien Chabran
38aa230150
bzl: bump oci_rules to 1.3.4 (#57013)
* bzl: bump rules_oci to 1.3.4

* testing things

* Load the image as intended
2023-09-26 10:23:30 +02:00
Erik Seliger
9f9bf43927
Merge enterprise and non-enterprise server images (#56446)
There's only one version now, so we can merge these two. Another one on the road to getting rid of the enterprise/non-enterprise distinction entirely!
2023-09-11 14:39:27 +02:00
Jean-Hadrien Chabran
54005e461f
Allow to run e2e tests locally (#55998)
Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>
Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-08-29 11:08:47 -05:00
Eric Fritz
0889c891db
codeintel: Make codenav results more consistent (#54410) 2023-08-09 00:30:07 +00:00
Manuel Ucles
7b77930043
create grpc_backend_integration_test (#55136) 2023-07-21 07:00:53 -07:00
Jean-Hadrien Chabran
22eb5a4140
bzl: re-enable code-intel-qa (only on main) (#54587)
Re-enable code-intel-qa, marked as flaky, on `main` branch only. 

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

CI
2023-07-04 14:02:34 +00:00
Jean-Hadrien Chabran
7fdf85a653
bzl+doc: improve and document how to write a server integration test (#53673)
We recently refactored how to run server integration tests with Bazel,
so they are standalone tasks requiring no prior setup to run them.

This PR takes this further, by providing a macro named
`server_integration_test` to be used in `testing/BUILD.bazel` to
centralize all test runners/wrapper to run those tests who are targeting
the server image.

It also adds a how-to describing how they work at high level as well as
step-by-step guide to help teammates to start writing or maintaining the
existing scripts.

@peterguy I'm tagging you here, as per this
[message](https://sourcegraph.slack.com/archives/C04MYFW01NV/p1686850329953539?thread_ts=1686661082.758009&cid=C04MYFW01NV)
where it looked you needed to do exactly this. This makes it sound
you're the perfect reviewer for this bit of documentation.

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

CI + local preview for the docs.

---------

Co-authored-by: Dave Try <davetry@gmail.com>
2023-06-19 17:44:01 +00:00
Noah S-C
db025265ff
shell: /bin/bash -> /usr/bin/env bash (#53000)
Changes interpreter in shell scripts to not hard-code bash location, for
portability

## Test plan

Previously `DOCKER_BAZEL=true IMAGE=strum355/frontend VERSION=5.0.5 ./enterprise/cmd/frontend/build.sh` wouldn't work for me, now it does : )
2023-06-06 13:51:55 +01:00
Jean-Hadrien Chabran
58da6780d7
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 👇: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 12:12:52 +02:00