Commit Graph

31 Commits

Author SHA1 Message Date
Will Dollman
d1b71a0a8a
bazel: Cleanup oci_deps.bzl (#62769)
* security: Update dind base image to patch multiple CVEs

Patches CVE-2023-45288 CVE-2024-2511 CVE-2024-32002 CVE-2024-32004 CVE-2024-32020 CVE-2024-32021 CVE-2024-32465

* ci: Tweak automated security update PR title

* Remove unused image hashes from oci_deps

* Tweak oci_deps comment

* Fixup old @wolfi_base references

* Add wolfi_base load

* use the correct base image

* Remove unneeded wolfi_base call
2024-05-28 10:00:31 +01:00
Michael Bahr
e85028b8bd
fix: update links for dev docs (#62758)
* fix: license checker info is in docs-legacy

* fix: update remaining dev links
2024-05-17 13:47:34 +02:00
Noah S-C
9b6ba7741e
bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
Will Dollman
bd2d7e8a7c
[ci] Improve buildkite stage subsection titles (#62271) 2024-04-30 13:52:36 +01:00
Will Dollman
e42a954eb9
Fix container image auto-updates (#61971)
* Add some timestamp debug logging

* Download sg from bazel-prechecks step

* Document steps better

* add bazel ops

* chmod +x sg

* Use default queue

* Print git envars

* drop pipefail temporarily

* Wrap gh binary

* fix arg passing

* Update PR tags and re-set git author info

* Use bazel wrapper script for gh

* Tidy up output

* Re-enable pipefail

* Still seeing git author overrides!

* Tweak pr title + body
2024-04-30 10:43:43 +00:00
Will Dollman
220a3b802f
Fix CI issue when removing packages (#62033)
* Remove qdrant package for testing

* Soft-fail if no apkfragments were found

* Bump docker-client for testing

* Revert "Remove qdrant package for testing"

This reverts commit 4c9eac7399.

* Revert "Bump docker-client for testing"

This reverts commit 39fad85086.
2024-04-19 14:33:13 +01: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
William Bezuidenhout
218bc806ea
wolfi: add debugging and use switch for new branch (#61530) 2024-04-02 18:44:50 +02:00
William Bezuidenhout
e14b473027
ci: call Aspect Agent Health check before doing rc gen (#61216)
* call Aspect Agent Health check before doing rc gen

* run aspect health check on aspect agents
2024-03-18 15:24:27 +02:00
Will Dollman
9d918d6393
Update perforce CDN urls to use stable versions (#60784)
See https://github.com/orgs/Homebrew/discussions/4686#discussioncomment-6628463

Thanks @jac !

## Test plan

- Ensure CI builds correctly

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

Why does it matter? 

These test plans are there to demonstrate that are following industry standards which are important or critical for our customers. 
They might be read by customers or an auditor. There are meant be simple and easy to read. Simply explain what you did to ensure 
your changes are correct!

Here are a non exhaustive list of test plan examples to help you:

- Making changes on a given feature or component: 
  - "Covered by existing tests" or "CI" for the shortest possible plan if there is zero ambiguity
  - "Added new tests" 
  - "Manually tested" (if non trivial, share some output, logs, or screenshot)
- Updating docs: 
  - "previewed locally" 
  - share a screenshot if you want to be thorough
- Updating deps, that would typically fail immediately in CI if incorrect
  - "CI" 
  - "locally tested" 
-->
2024-03-07 16:51:59 +00:00
Noah S-C
c16f45c790
wolfi: fix keys dir for building wolfi packages (#60922)
The script for building wolfi packages was missing a change to find the melange keys, which the script for building the package index contained https://github.com/sourcegraph/sourcegraph/pull/60860/files#diff-33ae81b3302c56080854c8f451cdd920f5f92660f6a37a4ae06b8da5ffd23d40

## Test plan

Testing in https://buildkite.com/sourcegraph/sourcegraph/builds/264254 from https://github.com/sourcegraph/sourcegraph/pull/60784
2024-03-07 16:22:23 +00:00
William Bezuidenhout
ad97b8b4ea
Reapply "ci: use aspect workflow agents (#60317)" (#60856)" (#60860)
This reverts commit 5dee69a56a.
2024-03-06 11:37:49 +02:00
William Bezuidenhout
5dee69a56a
Revert "ci: use aspect workflow agents (#60317)" (#60856)
This reverts commit 67b2c665f1.
2024-03-05 11:13:05 +00:00
William Bezuidenhout
67b2c665f1
ci: use aspect workflow agents (#60317)
* initial change to use aspect-default and remove ifs

* use rosetta bazelrc in bazel ci scripts

* use /tmp/aspect-generated.bazelrc path everywhere

change gcp project depending on queue

* restore aspect buildkite plugin
2024-03-05 12:07:47 +02:00
Will Dollman
89c5bd391e
Bump all packages to sign them (#60780)
* Bump all packages to sign them

* Update hashes and other minor issues

* Remove unused syntect-server package

* Revert "Remove unused syntect-server package"

This reverts commit 073e7b38da.

* Undo syntect-server epoch bump
2024-02-28 14:15:04 +00:00
Will Dollman
18674f1371
Sign melange packages (#60778)
* Sign packages

* Bump p4cli to test

* Fixup missing vars

* Bump p4 expected hash

* Revert p4cli and bump docker-client

* Revert test docker-client bump
2024-02-28 13:04:30 +00:00
Will Dollman
59f1eac656
Set wolfi auto-update backport target branch to 5.3 (#60309) 2024-02-08 10:55:23 +00:00
Noah S-C
06ea78ee9d
ci: use ci bazelrc flags everywhere (#59667)
Differences in flags are causing a lot of analysis cache discarding in CI due to differences.

We mightnt see the results for this until every branch has these changes, as bazel only keeps one analysis cache around.

But also sometimes builds are very fast even when analysis cache is busted 🙃 so who knows

## Test plan

👁️ Observing sourcegraph & aspect pipelines 👁️
2024-01-17 12:15:22 +00:00
Noah S-C
bc97fdbe34
add shellcheck & shfmt to pre-commit's pre-push hook (#59485)
Closes https://github.com/sourcegraph/sourcegraph/issues/54829

Next steps: 
- what safeguards will we have in place for when we remove this from `sg lint`
- should we remove it from `sg lint`, its likely not contributing much overhead even in the uncommon case of shell files being touched

_How did some of these violations get in when theres shell lints :clueless:_

## Test plan

`pre-commit run --hook-stage=pre-push shellcheck shfmt`
2024-01-11 14:16:22 +00:00
Erik Seliger
f9ac351dc3
Remove App from codebase (#59115)
Cody no longer needs it and it is obsolete now!

Since App added a non-insignificant amount of new concepts and alternative code paths, I decided to take some time and remove it from out codebase.
This PR removes ~21k lines of code. If we ever want parts of single binary (app), the redis kv alternatives, or the release pipeline for a native mac app back, we can look back at this PR and revert parts of it, but maintaining 21k lines of code and many code paths for which I had to delete a surprisingly small amount of tests justifies this move for me very well.

Technically, to some extent SG App and Cody App both still existed in the codebase, but we don't distribute either of them anymore, so IMO we shouldn't keep this weight in our code.

So.. here we go.

This should not affect any of the existing deployments, we only remove functionality that was special-cased for app.
2023-12-21 01:07:05 +01:00
Will Dollman
11442ca3db
wolfi: Remove manual install of github cli from base image auto-update (#57574)
`gh` is now included in the base image by default
2023-10-16 10:48:10 +01:00
Will Dollman
3a6f1b422c
wolfi: Improve auto-update image docs and PR body (#57588)
* Add buildkite link to PR, and update on rebuild

* Fine-tune docs
2023-10-13 13:45:00 +00:00
William Bezuidenhout
0c432960f5
wolfi+ci: improve wolfi image annotation (#57586)
* add wolfi annotation ctx

* fix formatting of annoation and use annotatedCmd

* add job output link

* Update wolfi-images/cadvisor.yaml

Co-authored-by: Will Dollman <will.dollman@sourcegraph.com>

---------

Co-authored-by: Will Dollman <will.dollman@sourcegraph.com>
2023-10-13 12:16:03 +00:00
Will Dollman
9218d7a03d
wolfi: Tweaks to update automation (#57565)
* `gh` is now included in the base image by default

* Add release branch backport label

* Update image update docs

* Tweak PR metadata

* Print go version to debug weird error

* Comment out pipeline for faster debugging

* Remove pipeline dep

* Fix go run

* Temporarily re-add github cli fetch

* Revert pipeline optimisation
2023-10-12 20:40:23 +00:00
Will Dollman
9632aa9bc1
Autogenerate pull requests for base image hash updates (#57557)
* Add pipeline step to run sg wolfi update-hashes

* Remove unused variable

* Testing sg version

* Update sg command

* Test gh cli client

* Ad-hoc install gh-cli

This will later be added to the base agents, so this is just a temporary step

* Commit changes to oci_deps and try using gh to fetch PRs

* Remove sg debug commands

* Fox typoo

* Delete branch if it already exists

This might cause problems with stateful runners - need to confirm

* Add debugging

* Tweak github PR search

* Catch potential error in git br -D

* Enable push and PR creation

* Tweak PR metadata

* Add test plan to PR

* Use a multi-line string

* Remove debug comments

* Comment out unused variable

* Replace `cat` with `git diff` to show changes

* Quiet grep

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>

* Add git emoji in output

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>

* Add github icon to output

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>

---------

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-10-12 15:09:41 +00:00
Will Dollman
7ea0475c32
wolfi: Bump base images for 5.2.1 (CVE-2023-38545) (#57529)
* Bump base images

* wolfi: print cwd on failure

* wolfi: fix cwd

Because of the recent move we went up one directory too much, leading to
the Wolfi scripts failing.

---------

Co-authored-by: Vincent Ruijter <vincent.ruijter@sourcegraph.com>
Co-authored-by: Vincent <evict@users.noreply.github.com>
2023-10-11 11:13:46 +01:00
William Bezuidenhout
6895d49f35
app: remove old app release scripts and release types (#57466)
remove old app release scripts and release types
2023-10-09 17:04:39 +02:00
Petri-Johan Last
10dca65499
[chore] Use consistent go-github versioning (#57391) 2023-10-06 10:48:18 +02:00
Erik Seliger
58fe87f6b5
enterprise: Move last directory out (#57392)
This is the end of the PR train to remove the enterprise directory from out repo since we have consolidated to use a single license.

Bye rough code split :)
2023-10-05 20:15:40 +00:00