Commit Graph

58 Commits

Author SHA1 Message Date
Will Dollman
144999c1f3
Publish sourcegraph-base image (#62002)
* Publish sourcegraph-base image

* Add oci_defs

* Remove dind from legacy image builds - this breaks runtype.CandidateNoTest

* Switch executor-vm command to bazel

* Set isCandidate true when using CandidateNoTest run type

* Rename sourcegraph and sourcegraph-base to better reflect their current purposes

sourcegraph -> sourcegraph-base
sourcegraph-base -> sourcegraph-template

* Re-lock sourcegraph-template

* Update wolfi target

* Add Aspect bazelrc to executor-vm build.sh

This script may be run locally or on CI, so handle both cases

* Tweak bazelrc generation

* Update configHashes - bodge alert
2024-04-19 14:44:06 +01:00
Erik Seliger
c9d99b284b
Pass conf down to authz providers (#61907)
This makes the dependency on conf clearer so that you understand that you must have a working connection to confserver when you're calling this function in the package.

Test plan:

Existing test suites
2024-04-18 16:07:12 +02:00
Will Dollman
d56fa926dd
Build images end-to-end using Bazel v2 (#61845)
* wip

* gitserver (mostly) wolfi 4 bazel

* the big heck of all things

* Add rules_apko lock translation rules to WORKSPACE

* Call apko_repositories() more

* fix rules_apko to handle our shorter repo urls

* fix workspace from rebase, and missing locks

* visibility on wolfi_base_image

* hand-fix a lock coz apko lock is 🅱️roken

* remove chainguard repo+keyring from base

* update locks

* add chainguard repo+keychain to single server manifest

* unrelated fixes, server+grafana still h*cked

* fix postgres-exporter

* the big fix

* aws lib got bumped?

* downgrade sso-oidc? idk

* ignore wolfi locks from prettier

* dynamically do the locks with a reporule

* document and make nice :nails:

* bazel run @rules_apko//apko patch

* Fix .typo.typo

* Update tooling for end-to-end Bazel images (#61106)

* Update sg wolfi image to build using Bazel

* bazel run @rules_apko//apko patch

* Fix .typo.typo

* Add update-images and implement apko YAML change monitoring

* Use bazel apko and add support for additional repos

* Refactor sg wolfi

* Rework wolfi base image auto-update pipeline

* sg bazel configure

* [rough] Add --check flag to sg wolfi lock

* Refactor sg wolfi lock --check

* Simplify check and update apko lock hash operations

* Fix resolveImagePath when running in bazel

* Fixup logic error in CheckApkoLockHashes

* Tweak DoBaseImageBuild output

* Remove debug output

* Fix sg wolfi lock --check behaviour for all images

* Replace base image build step with apko lock --check

* Remove debug line

* Minor fixups for CI step

* Wrap with AnnotatedCmd

* Fixup annotation

* Update apko lockfiles

* Allow additional repos to be passed

* Update build-base-image.sh with bazel + add back to pipeline

* Ensure that modified base images are rebuilt

* Solve bazelception

* Remove timestamp for bit-level reproducibility

* Skip local keygen when running on buildkite

* Add workaround for lack of local repo support in rules_apko

* Run apkoOps first as it's quick and might fail

* Remove blocking allBaseImagesBuilt step

* Remove unused promethus-gcp image

* Add special cases to resolveImagePath

* Cleanly handle case where no bazel build path exists

This could happen in cases where a base image is only used outside of sourcegraph/sourcegraph,
or if you've added a new base image config but haven't added the associated Bazel scaffolding

* Add debugging around failing docker builds

* More debugging

* Normalise apko_lockfile to match repo.bzl

* Fixup apko docker call

* Try passing imageconfigdir differently to docker

* Run ls in different container

* Soft-fail when using legacy build in Buildkite

* Add missing include

* Workaround for building sourcegraph and sourcegraph-dev

* Add postgresql-client package to server

This contains createdb, which was recently moved from postgresql

* Inflate postgres-12-codeinsights image to avoid rules_apko errors

* Remove update line from yaml files

* Fix issue caused by moving base sourcegraph image

* Remove apk-tools from server

* Update lockfiles

* Address review feedback

* Remove debug lines

* fix unbound var

---------

Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>

* go mod tidy + gazelle-update-repos after merging main

* Use aspect bazel cache

* Use Aspect bazel caching when calling bazel in bash and sg

* Append annotation

* Run apko lock on aspect agent

* Remove base image builds

Discussion in https://sourcegraph.slack.com/archives/C05EVRLQEUR/p1712307465660509

* Remove unused functionality

* Update BaseImageConfig comments

* Rewrite wolfi-images/README.md

* Add .apko/range.sh to .gitattributes

* Remove "wolfi" from :base_image and :base_tarball targets

* remove allowlist extras from debugging

* Tweak user instructions around package testing

* Add agent healthcheck to buildkite scripts

* prettier

* sg bazel configure

* bazel run //:gazelle-update-repos

---------

Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>
Co-authored-by: Noah S-C <noah@sourcegraph.com>
2024-04-12 16:18:43 +01:00
Will Dollman
2c1d55c00e
Revert "Hackathon: Build images end-to-end using Bazel (#60785)" (#61644)
This reverts commit 44db6658b6.
2024-04-05 13:43:19 +00:00
Will Dollman
44db6658b6
Hackathon: Build images end-to-end using Bazel (#60785)
* wip

* gitserver (mostly) wolfi 4 bazel

* the big heck of all things

* Add rules_apko lock translation rules to WORKSPACE

* Call apko_repositories() more

* fix rules_apko to handle our shorter repo urls

* fix workspace from rebase, and missing locks

* visibility on wolfi_base_image

* hand-fix a lock coz apko lock is 🅱️roken

* remove chainguard repo+keyring from base

* update locks

* add chainguard repo+keychain to single server manifest

* unrelated fixes, server+grafana still h*cked

* fix postgres-exporter

* the big fix

* aws lib got bumped?

* downgrade sso-oidc? idk

* ignore wolfi locks from prettier

* dynamically do the locks with a reporule

* document and make nice :nails:

* bazel run @rules_apko//apko patch

* Fix .typo.typo

* Update tooling for end-to-end Bazel images (#61106)

* Update sg wolfi image to build using Bazel

* bazel run @rules_apko//apko patch

* Fix .typo.typo

* Add update-images and implement apko YAML change monitoring

* Use bazel apko and add support for additional repos

* Refactor sg wolfi

* Rework wolfi base image auto-update pipeline

* sg bazel configure

* [rough] Add --check flag to sg wolfi lock

* Refactor sg wolfi lock --check

* Simplify check and update apko lock hash operations

* Fix resolveImagePath when running in bazel

* Fixup logic error in CheckApkoLockHashes

* Tweak DoBaseImageBuild output

* Remove debug output

* Fix sg wolfi lock --check behaviour for all images

* Replace base image build step with apko lock --check

* Remove debug line

* Minor fixups for CI step

* Wrap with AnnotatedCmd

* Fixup annotation

* Update apko lockfiles

* Allow additional repos to be passed

* Update build-base-image.sh with bazel + add back to pipeline

* Ensure that modified base images are rebuilt

* Solve bazelception

* Remove timestamp for bit-level reproducibility

* Skip local keygen when running on buildkite

* Add workaround for lack of local repo support in rules_apko

* Run apkoOps first as it's quick and might fail

* Remove blocking allBaseImagesBuilt step

* Remove unused promethus-gcp image

* Add special cases to resolveImagePath

* Cleanly handle case where no bazel build path exists

This could happen in cases where a base image is only used outside of sourcegraph/sourcegraph,
or if you've added a new base image config but haven't added the associated Bazel scaffolding

* Add debugging around failing docker builds

* More debugging

* Normalise apko_lockfile to match repo.bzl

* Fixup apko docker call

* Try passing imageconfigdir differently to docker

* Run ls in different container

* Soft-fail when using legacy build in Buildkite

* Add missing include

* Workaround for building sourcegraph and sourcegraph-dev

* Add postgresql-client package to server

This contains createdb, which was recently moved from postgresql

* Inflate postgres-12-codeinsights image to avoid rules_apko errors

* Remove update line from yaml files

* Fix issue caused by moving base sourcegraph image

* Remove apk-tools from server

* Update lockfiles

* Address review feedback

* Remove debug lines

* fix unbound var

---------

Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>

* go mod tidy + gazelle-update-repos after merging main

* Use aspect bazel cache

* Use Aspect bazel caching when calling bazel in bash and sg

* Append annotation

* Run apko lock on aspect agent

* Remove base image builds

Discussion in https://sourcegraph.slack.com/archives/C05EVRLQEUR/p1712307465660509

* Remove unused functionality

* Update BaseImageConfig comments

* Rewrite wolfi-images/README.md

* Add .apko/range.sh to .gitattributes

* Remove "wolfi" from :base_image and :base_tarball targets

* remove allowlist extras from debugging

* Tweak user instructions around package testing

* Add agent healthcheck to buildkite scripts

* prettier

---------

Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>
Co-authored-by: Noah S-C <noah@sourcegraph.com>
2024-04-05 13:57:45 +01:00
Noah S-C
21e8d2876b
bazel: move internal/version stamping to internal/version's go_library decl (#61495)
Instead of having to declare the stamp vars on every go_binary (and risk forgetting one, like in https://github.com/sourcegraph/sourcegraph/pull/61480/files#r1543982602), we can stamp at the go_library declaration point instead.

## Test plan

Locally tested with `strings`
2024-03-29 13:41:19 +00: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
Greg Magolan
20a3c0836e
bazel: don't build most oci_tarball targets with bazel build //... by tagging them all manual (#60529)
This change is to mitigate excessive remote cache network traffic in the event that oci_tarball targets are cache busted en masse.

Only //cmd/server:image_tarball and //docker-images/executor-vm:image_tarball and used as inputs to downstream targets so only
these two will be built and remote cached on CI.
2024-02-15 09:02:50 +00:00
Quinn Slack
e5baad0ccd
remove more remannts of OSS build (#58253)
Removes:

- doc mentions of OSS build
- linters related to OSS/enterprise code
- unused `osscmd` package and related definitions
2023-11-10 07:59:03 +00:00
William Bezuidenhout
1ae6cc6bfd
logger: update log lib and remove use of description (#57690)
* log: remove use of description paramter in Scoped

* temporarily point to sglog branch

* bazel configure + gazelle

* remove additional use of description param

* use latest versions of zoekt,log,mountinfo

* go.mod
2023-10-18 17:29:08 +02:00
Erik Seliger
59af27246b
authz: Don't return error for subrepoperm constructor (#57471)
See inline comment, there's no good reason to make this so complicated. So simplifying here.
2023-10-09 21:30:43 +02:00
Eric Fritz
e04d225bf7
codenotify: dr. fritz is kil (#57313) 2023-10-03 16:19:55 +00:00
Erik Seliger
e0a8ff3d89
app: Move out of enterprise and merge with cmd/sourcegraph-oss (#56447)
Another item on the checklist to get rid of the enterprise directory.
2023-09-08 16:23:46 +02:00
Erik Seliger
4cee2a0fb5
Move precise-code-intel-worker out of enterprise (#54926)
Not required anymore, just a git mv and some path changes.

## Test plan

CI.
2023-07-13 20:09:16 +02:00
Eric Fritz
d07ca6e45f
codeintel: Migrate code to enterprise (#11419) 2020-06-10 18:05:51 -05:00
Eric Fritz
c58fd6ce05
codeintel: Remove failure_stacktrace and rename failure_{summary -> message} (#11418) 2020-06-10 16:53:52 -05:00
Eric Fritz
4bbd36d422
codeintel: Add retries to larger bodies in bundle manager client (#11036) 2020-06-10 09:20:01 -05:00
Nick Snyder
a12c43ee93
Whitelist -> Allowlist (#11390)
See https://github.com/sourcegraph/sourcegraph/issues/11389
2020-06-09 15:09:46 -07:00
Eric Fritz
0fe1633b88
codeintel: Parse and write diagnostic results to bundles (#11356) 2020-06-08 16:07:10 -05:00
Keegan Carruthers-Smith
4c40a06df1
gomod: update all (#11345)
Had to pin two dependencies.

github.com/golang/protobuf@v1.3.5 - It seems to be enforcing something
to do with resource names. This is causing our use of our k8s client to
panic.

github.com/aws/aws-sdk-go-v2@v0.20.0 - They removed some types in the
endpoint package we relied on. Unsure how to fix yet, so punting until
the next time someone tries to update dependencies.
2020-06-08 17:15:42 +02:00
Eric Fritz
7c99cd982e
codeintel: SQLite batch write (#11240) 2020-06-03 14:16:01 -05:00
Eric Fritz
69bf52c2e3
codeintel: Change representation of moniker lookups in bundle files (#11112) 2020-06-03 13:54:41 -05:00
Eric Fritz
5ff1e04154
codeintel: Send tar files via SendDB (#11074) 2020-06-01 13:46:47 -05:00
Eric Fritz
fc15df5136
codeintel: Refactor SQLite layer, introduce migration mechanism (#11135) 2020-06-01 13:26:39 -05:00
Eric Fritz
a19d6f5ffb
codeintel: Replace DefinitionReferenceRow type with MonikerLocations (#11106) 2020-05-29 14:57:04 -05:00
Eric Fritz
2eae464dcd
codeintel: GetUpload should return reader, not file (#11042) 2020-05-29 14:50:19 -05:00
Eric Fritz
d6dce97d26
codeintel: Move ownership of serializer into persistence layer (#11098) 2020-05-28 20:21:53 -05:00
Eric Fritz
89475e36c6
codeintel: Reorganize bundles package (#11096) 2020-05-28 19:58:38 -05:00
Eric Fritz
32f87ec190
codeintel: Split worker file into worker and processor (#11085) 2020-05-28 15:30:25 -05:00
Eric Fritz
f4411d8aaa
codeintel: Do not use copy of scanner slice (#11088) 2020-05-28 15:29:47 -05:00
Eric Fritz
5ce7e1556a
codeintel: Line reader goroutine leak (#11072) 2020-05-28 14:54:42 -05:00
Eric Fritz
1e83fa635a
codeintel: LSIF line reader (#10990) 2020-05-27 16:45:21 -05:00
Eric Fritz
3841d497c4
codeintel: Write to SQLite file in parallel (#11027) 2020-05-27 12:59:53 -05:00
Eric Fritz
d819c088d0
codeintel: Remove always-nil err returns (#11028) 2020-05-27 12:39:00 -05:00
Eric Fritz
6b12b26757
codeintel: Replace encoding/json with json-iterator/go for reading LSIF (#10992) 2020-05-27 12:06:15 -05:00
Eric Fritz
8a905acbbf
codeintel: Reduce allocations in serializer (#10997) 2020-05-27 12:06:03 -05:00
Eric Fritz
83deb2a823
codeintel: Reduce the size of bundle-manager network payloads (#11004) 2020-05-27 10:46:32 -05:00
Eric Fritz
cc029b5047
codeintel: Refactor lsif input parsing (#10935) 2020-05-25 19:07:25 -05:00
Eric Fritz
bc554a1290
codeintel: Do not wrap tx.Done errors twice in worker (#10887) 2020-05-22 09:11:50 -05:00
Eric Fritz
e111a24df5
codeintel: Remove job handle abstraction (#10818) 2020-05-19 18:24:42 -05:00
Eric Fritz
e5ff13b9d5
codeintel: Rename poll interval envvar (#10796) 2020-05-19 16:43:12 -05:00
Eric Fritz
706e241174
codeintel: Add context param to gitserver functions (#10791) 2020-05-18 20:07:45 -05:00
Eric Fritz
08e7ef8774
codeintel: Move upload resetter from api-server to worker (#10680) 2020-05-14 10:25:31 -05:00
Eric Fritz
3d0d0cf315
codeintel: Ensure we serialize all referenced result ids (#10615) 2020-05-12 13:08:07 -05:00
Eric Fritz
807e467bdf
codeintel: Ensure paths respect root when checking existence in git (#10611) 2020-05-12 10:59:25 -05:00
Eric Fritz
9f8019437a
codeintel: Do not block on second signal in precise-code-intel services (#10584) 2020-05-11 20:12:44 -05:00
Eric Fritz
267b64460d
codeintel: Do not fail on relative (but non-subset) document paths (#10578) 2020-05-11 16:23:09 -05:00
Eric Fritz
44200c5ecc
codeintel: Remove upload files after processing (#10562) 2020-05-11 16:05:05 -05:00
Eric Fritz
523a94fa50
codeintel: Add healthcheck server to worker (#10573) 2020-05-11 14:43:31 -05:00
Eric Fritz
c863b82ee2
codeintel: Fix transaction logic on process failure (#10530) 2020-05-11 08:28:13 -05:00