With this patch, the `errors.HasType` API behaves similar to `Is` and `As`,
where it checks the full error tree instead of just checking a linearized version
of it, as cockroachdb/errors's `HasType` implementation does not respect
multi-errors.
As a consequence, a bunch of relationships between HasType and Is/As that
you'd intuitively expect to hold are now true; see changes to `invariants_test.go`.
The previous approach to enable race detection was too radical and
accidently led to build our binaries with the race flage enabled, which
caused issues when building images down the line.
This happened because putting a `test --something` in bazelrc also sets
it on `build` which is absolutely not what we wanted. Usually folks get
this one working by having a `--stamp` config setting that fixes this
when releasing binaries, which we don't at this stage, as we're still
learning Bazel.
Luckily, this was caught swiftly. The current approach insteads takes a
more granular approach, which makes the `go_test` rule uses our own
variant, which injects the `race = "on"` attribute, but only on
`go_test`.
## Test plan
<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
CI, being a main-dry-run, this will cover the container building jobs,
which were the ones failing.
---------
Co-authored-by: Alex Ostrikov <alex.ostrikov@sourcegraph.com>
Reintroduces the same changes as
https://github.com/sourcegraph/sourcegraph/pull/51104 minus
syntax-highlighter which we're unable to compile with the right
toolchain at the moment.
Tested as a full main-dry-run, as well as running the stack with compose
and checking indexing and syntax-highlighting.
Executors are also built correctly.
## Test plan
CI + manual test via compose.
---------
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
We updated sourcegraph/alpine-3.14 today in 3b3879b9 to remove a bunch
of CVEs in bind-tools. This commit makes it so we use the new image.
Test Plan: CI works and has far less security reports.
Now that we require go1.18, we can use a builtin type alias for
"interface{}": "any". I've updated all code except lib, which can be
imported by external modules. That is currently pinned at go1.16.
Additionally I had to rerun generate since rewriting generated go code
will fail CI.
find -name '*.go' | xargs gofmt -s -r 'interface{} -> any' -w
git checkout lib
go generate ./...
Test Plan: CI will exercise that the code still compiles. Otherwise this
is a noop.
We have a 3.14 image available, but when we introduced it we ran into problems
using it. This updates all images to use the newer version of alpine.
ruplacer --go \
sourcegraph/alpine-3.12:142406_2022-04-14_8836ac3499f4@sha256:4681a48d1fb9a73fef1b540c08b3411f797351bbeda749f5dca21213a1e71526 \
sourcegraph/alpine-3.14:142406_2022-04-14_8836ac3499f4@sha256:2a2d1cbaec78882661fe1aa5b0a4af0c23a37be2ea9ff8aadc2da5b80852c233
I also had to pin postgresql in the server image since we can't upgrade it
otherwise customer upgrades fail (incompatible on disk data). Additionally we
had to include libstc++ and libgcc for tree sitter.
Risks: I am relying on our CI to catch problems with this upgrade. The main
risks here are us not testing things which exercise non-go binaries that rely
on shared libraries. What comes to mind is things like p4 and tree-sitter, I
am unsure if they get properly exercised. However, I think now is a good time
to land a change like this since we have a lot of time until branch cut.
Test Plan: main dry run on CI to test docker image building and integration
testing.
Alpine packages only keep the most recent few releases, with older releases being dropped on a regular basis. We enforce versions, it seems, mostly to ensure the inclusion of particular security patches. Since not upgrading will only break our builds, and when we run into issues we just upgrade anyway, we should just only ever pin minimum versions.
To make this the new standard, also adds a hadolint.yaml to disable DL3018 by default
No customer asked for these, but I figured it can't hurt. Also setting the GOARCH explicitly makes it safer that the amd64 labeled binaries actually are amd64.
I ran into issues setting up Sourcegraph on NixOS, because NixOS, like
some other distros, doesn't have a /bin/bash. We already use /usr/bin/env
in many of our scripts, so this improves consistency, too.
In this commit, along with moving to
github.com/cockroachdb/errors, we update a few tests and some
error checks in non-test code.
List of files that have code changes apart from changes in the
error package import:
enterprise/internal/batches/sources/gitlab.go
enterprise/internal/batches/sources/gitlab_test.go
internal/conf/client.go
internal/store/store_test.go
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com>
This mostly updates our dev CI/helpers which hardcoded master to instead
hardcode main. In the case of CI we treat both main and master as the
default branch.
We could complicate the design of Serve such that we wait for background
updates to stop. However, this would be for the benefit of tests
only. Instead we just disable background updates in tests.
We now only run git update-server-info if a repository has not been
configured.
This change exposed a bug in our hook setting being incorrect. This wasn't
visible before since we would always run update-server-info when listing
repos.
Debug logs for now contain which directories we search which are not
repository roots. This will help debug performance issues where a
customer may unintentionally be crawling a very large tree.
If you see this log message you may think something is broken. We still
want to show it because it may contain useful information if a setup is
misconfigured.