Commit Graph

601 Commits

Author SHA1 Message Date
Jean-Hadrien Chabran
1c3ba6eb85
chore(ci): lower concurrent jobs when pushing to dockerhub (#64469)
We're currently evaluating only pushing on Dockerhub when releasing, as
everything else uses GCR, but until then, we lower the concurrency to 4
when pushing there, and we keep 8 on the others.

Follow-up to https://github.com/sourcegraph/devx-support/issues/1163

## Test plan

CI
2024-08-14 16:23:39 +00:00
William Bezuidenhout
26f14c0888
ci: set go mod tidy step timeout (#64449)
Closes DINF-198

## Test plan
CI
```
{
      "label": ":bazel:🧹 Go mod tidy",
      "key": "bazel-go-mod",
      "command": [
        "./dev/ci/bazel-gomodtidy.sh"
      ],
      "timeout_in_minutes": "5",
      "retry": {
        "automatic": [
          {
            "limit": 1,
            "exit_status": "*"
          },
          {
            "limit": 1,
            "exit_status": -1
          }
        ]
      },
      "agents": {
        "queue": "aspect-small"
      }
    },
```

## Changelog
2024-08-13 17:45:30 +02:00
Shivasurya
3cb7ab8c6a
Support SAST Scanning with both GHAS and Custom post processing script (#64423)
This pull request supports buildkite semgrep sast scan to work on both
GHAS and with custom post processing script. This script checks if GHAS
is enabled or not and runs the semgrep scan and process the result. This
way we could support repositories without GHAS enabled.

<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

- CI 🟢 
- sast scans are reported without any issues

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
- chore(security): Support SAST Scanning with both GHAS and Custom post
processing script
2024-08-13 09:43:09 -04:00
Michael Lin
20f22d29f0
sg/cloud: fix eph cmd typo (#64427)
fixed typo. these commands are under `sg cloud eph`

## Test plan

CI
2024-08-13 06:53:07 +02:00
William Bezuidenhout
cacc01be6f
ci: provide a more descriptive error when pipegen fails (#64362)
Give a more descriptive error when we are unable to find a merge base
and can't find the files that have changed.

Closes DINF-162
## Test plan
1. `git fetch -v --prune --depth=100 -- origin
ccbaba24b72f3c6f4524b3f560ca839143ea463b`
2. `git merge-base HEAD origin/main` --- you'll get nothing since there
is no merge base in the current history

Increase the repo history
1. `git fetch --unshallow`
2. `git merge-base HEAD origin/main`
```
0a6e509af3
```
## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->

Co-authored-by: Bolaji Olajide <bolaji.olajide@sourcegraph.com>
2024-08-08 14:13:07 +00:00
Noah S-C
b9c4e2aae9
Revert "Revert "refactor: upgrade to rules_oci 2.0 (2nd attempt)"" (#64354)
Reverts sourcegraph/sourcegraph#64351

## Test plan

Need to test on main due to main-only CI steps (even with main dry-run)
2024-08-08 09:00:08 +00:00
Noah S-C
addba96f47
Revert "refactor: upgrade to rules_oci 2.0 (2nd attempt)" (#64351)
Reverts sourcegraph/sourcegraph#63829

Not working with Aspect Delivery

## Test plan

CI
2024-08-07 22:15:21 +00:00
Greg Magolan
be015c58c2
refactor: upgrade to rules_oci 2.0 (2nd attempt) (#63829)
2nd attempt of #63111, a follow up
https://github.com/sourcegraph/sourcegraph/pull/63085

rules_oci 2.0 brings a lot of performance improvement around oci_image
and oci_pull, which will benefit Sourcegraph. It will also make RBE
faster and have less load on remote cache.

However, 2.0 makes some breaking changes like

- oci_tarball's default output is no longer a tarball
- oci_image no longer compresses layers that are uncompressed, somebody
has to make sure all `pkg_tar` targets have a `compression` attribute
set to compress it beforehand.
- there is no curl fallback, but this is fine for sourcegraph as it
already uses bazel 7.1.

I checked all targets that use oci_tarball as much as i could to make
sure nothing depends on the default tarball output of oci_tarball. there
was one target which used the default output which i put a TODO for
somebody else (somebody who is more on top of the repo) to tackle
**later**.

## Test plan

CI. Also run delivery on this PR (don't land those changes)

---------

Co-authored-by: Noah Santschi-Cooney <noah@santschi-cooney.ch>
2024-08-07 22:21:49 +01:00
Bolaji Olajide
2e642bc85e
fix(bazel): surface error message when gazelle cant process glob expression (#64214)
Closes DINF-89

Gazelle sometimes have trouble processing glob expressions, and this
isn't reported as a failure even though it ultimately results in the
`BUILD.bazel` not being correctly updated.

## Test plan

* Manual testing

In `client/web/BUILD.bazel`, add a new `src` to the `web_lib` ts_project
target that includes a glob pattern.

```
...
ts_project(
    name = "web_lib",
    srcs = glob(["!src/playwright/*.spec.ts"]) + [
        "src/Index.tsx",
        "src/LegacyLayout.tsx",
        "src/LegacyRouteContext.tsx",
        "src/LegacySourcegraphWebApp.tsx",
        "src/PageError.tsx",
        "src/SearchQueryStateObserver.tsx",
        "src/SourcegraphWebApp.tsx",
...
```

When you run `go run ./dev/sg bazel configure`, the command should fail
with an error message instead of returning exit 0.

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->

---------

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
2024-08-06 17:37:15 -05:00
Noah S-C
1538e42180
chore(bazel): emit json profile for image push jobs (properly) (#64189)
Typo when copying the flags from somewhere else, names mismatched and
didnt upload 🤦

Also adding in proper BEP emitting, it appears the build_event_log.bin
that was being output was actually for the honeyvent bazel invocation

## Test plan

CI main dry-run
https://buildkite.com/sourcegraph/sourcegraph/builds/285375

## Changelog
2024-07-31 13:46:15 +01:00
Noah S-C
6d3e4a5b74
chore(bazel): emit json profile for image push jobs (#64188)
For more insights into whats happening during those damn build commands

Also removes emitting to honeycomb, that was my experiment that has
concluded.

## Test plan

CI

## Changelog
2024-07-31 12:11:54 +00:00
Erik Seliger
c917330d6b
authz: Drop requirement for installing authz providers in every service (#63743)
This is a register call that is easy to forget. When forgotten, all queries against the repo store will block forever.

In addition, this adds a hard-dependency on conf to every services startup, plus a busy loop. With multi-tenant, this will not work great because authz providers would be a global, and we instead want most things to be ephemeral so they're per-provider. This is a step toward that, but doesn't yet remove the providers global variable.

Good news, it turns out that we don't actually need to register the providers in every service! The reason they were required was to check if zero providers are configured, or if authzbypass mode is enabled.

Authz bypass mode is usually ON, except when there are problems with the authz providers, meaning some authz providers might not be able to sync permissions. Bypassing of permissions is only ever happening if there are ALSO zero providers configured.

So this is basically an optimization for the case where an instance has zero authz configured so that the SQL queries are a bit simpler. This also helps in tests because with bypass mode on and no providers configured, authz enforcement is effectively off in the repo store.
This makes it so that in tests we need to do slightly more work, but also makes for a more realistic test vs at runtime setup. Also, it's highly recommended to use mocks for DB wherever possible in more high-level components to keep tests fast.

To never have a scenario where we accidentally mess up here and enable bypass mode erroneously, this PR drops that entirely. Authz is always enforced, but when a code host connection is unrestricted (i.e., will not spawn a provider) the repos are still visible, so this should be no change over before.

## Test plan

The stack starts and works, and all CI tests are still passing. Code review should help as well.
2024-07-31 01:23:34 +02:00
Jean-Hadrien Chabran
7b0f478d6f
chore(ci): pass --profile to bazel-do jobs (#64148)
Follow-up to [this
comment](https://github.com/sourcegraph/sourcegraph/pull/63910#discussion_r1683190713)
where the need was raised for having profiles for further inspection of
problematic targets when run in isolation.

Basically, every bazel-do will now collect the profile, and it'll be
uploaded as a job artifact.

## Test plan

See https://buildkite.com/sourcegraph/sourcegraph/builds/284913 for a
test run.

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-30 08:01:27 -05:00
William Bezuidenhout
9898262143
ci: automatic retry push images job at least 1 (#64145)
Closes DINF-154

## Test plan
CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-30 09:32:03 +01:00
Noah S-C
878931fceb
chore(ci): emit execlog for image push jobs (#64130)
So we can dig into why stuff is being built

## Test plan

CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-29 14:08:10 +00:00
Noah S-C
51cf4dcba8
fix(ci): reduce push_all concurrency even further due to ratelimits (#64111)
😢 

## Test plan

CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-26 19:13:27 +01:00
James Cotter
d2dd9ac454
msp/deploy: remove old author variable (#64107)
Leftover that somehow slipped through 🤦🏻 

## Test plan
CI
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
2024-07-26 16:56:53 +01:00
James Cotter
20664df7fc
msp/deploy: use BUILDKITE_BUILD_CREATOR as fallback (#64104)
If a build is triggered from the web the variable BUILDKITE_BUILD_AUTHOR
is not set which the msp_deploy.sh script requires. This PR uses
BUILDKITE_BUILD_CREATOR as a fallback if _AUTHOR is missing

## Test plan
Tested locally
2024-07-26 15:51:09 +01:00
Noah S-C
59a0d15eab
fix(ci): reduce push_all concurrency due to ratelimits (#64106)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-26 14:44:23 +00:00
Noah S-C
1069817b5b
chore(bazel): rework push_all to improve concurrency by avoiding bazel server lock (round 2) (#64079)
Second attempt at https://github.com/sourcegraph/sourcegraph/pull/64044,
now that rate limit is set right. So lets boost the concurrency to all
cores!

## Test plan

main dry-run
https://buildkite.com/sourcegraph/sourcegraph/builds/284268#0190e9cf-b902-4f7c-a1ad-fca8700b8fa0

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-25 12:59:43 +00:00
Noah S-C
c016ce08c1
Revert "chore(bazel): rework push_all to improve concurrency by avoiding bazel server lock" (#64051)
Reverts sourcegraph/sourcegraph#64044

Dockerhub cant handle it and keeps ratelimiting us

## Test plan

CI
2024-07-24 19:33:21 +00:00
William Bezuidenhout
0309564f93
ci: make internal+promote release higher priority in runtypes (#64049)
With the https://github.com/sourcegraph/sourcegraph/pull/63985/files
PatchRelease is matched before InternalRelease leading to the wrong
build being generated.

We therefore move the Promote and Internal Release runtypes higher in
priority so that they get matched first.

## Test plan
```
export RELEASE_INTERNAL=true
export VERSION="5.5.2463"
go run ./dev/sg ci preview
```
👇🏼 
```
go run ./dev/sg ci preview
⚠️ Running sg with a dev build, following flags have different default value unless explictly set: skip-auto-update, disable-analytics
If the current branch were to be pushed, the following pipeline would be run:
  Parsed diff:
  changed files: [WORKSPACE client/web-sveltekit/BUILD.bazel client/web-sveltekit/playwright.config.ts client/web-sveltekit/src/lib/navigation/GlobalHeader.svelte client/web-
  sveltekit/src/routes/[...repo=reporev]/(validrev)/(code)/page.spec.ts client/web/src/cody/chat/new-chat/NewCodyChatPage.tsx client/web/src/cody/sidebar/new-cody-sidebar/NewCodySidebar.tsx
  client/web/src/cody/sidebar/new-cody-sidebar/NewCodySidebarWebChat.tsx client/web/src/enterprise/batches/settings/AddCredentialModal.tsx
  client/web/src/enterprise/batches/settings/BatchChangesCreateGitHubAppPage.tsx client/web/src/repo/blame/hooks.ts client/web/src/repo/blame/shared.ts cmd/frontend/auth/user.go
  cmd/frontend/auth/user_test.go cmd/frontend/internal/codycontext/context.go cmd/frontend/internal/codycontext/context_test.go deps.bzl dev/ci/push_all.sh dev/ci/runtype/runtype.go go.mod go.sum
  internal/codeintel/uploads/BUILD.bazel internal/codeintel/uploads/internal/background/backfiller/BUILD.bazel internal/codeintel/uploads/internal/background/backfiller/mocks_test.go
  internal/codeintel/uploads/internal/background/commitgraph/BUILD.bazel internal/codeintel/uploads/internal/background/commitgraph/job_commitgraph.go
  internal/codeintel/uploads/internal/background/expirer/BUILD.bazel internal/codeintel/uploads/internal/background/expirer/mocks_test.go
  internal/codeintel/uploads/internal/background/processor/BUILD.bazel internal/codeintel/uploads/internal/background/processor/mocks_test.go internal/codeintel/uploads/internal/store/BUILD.bazel
  internal/codeintel/uploads/internal/store/commitdate.go internal/codeintel/uploads/internal/store/commitdate_test.go internal/codeintel/uploads/internal/store/observability.go
  internal/codeintel/uploads/internal/store/store.go internal/codeintel/uploads/mocks_test.go internal/database/migration/shared/data/cmd/generator/consts.go
  internal/database/migration/shared/data/stitched-migration-graph.json package.json pnpm-lock.yaml schema/schema.go schema/site.schema.json]
  diff changes: "Go, Client, pnpm, Docs, Shell"
  The generated build pipeline will now follow, see you next time!

  • Detected run type: Internal release
  • Detected diffs: Go, Client, pnpm, Docs, Shell
  • Computed variables:
    • VERSION=5.5.2463
  • Computed build steps:
    • Aspect Workflow specific steps
      • 🤖 Generated steps that include Buildifier, Gazelle, Test and Integration/E2E tests
    • Image builds
      • :bazel::packer: 🚧 Build executor image
    • :bazel: Bazel prechecks & build  sg
    • :bazel: BackCompat Tests
    • :bazel:🧹 Go mod tidy
    • Linters and static analysis
      • 🍍:lint-roller: Run sg lint → depends on bazel-prechecks
    • Client checks
      • :java: Build (client/jetbrains)
      • :vscode: Tests for VS Code extension
      • :stylelint: Stylelint (all)
    • Security Scanning
      • Semgrep SAST Scan
    • Publish candidate images
      • :bazel::docker: Push candidate Images
    • End-to-end tests
      • :bazel::docker::packer: Executors E2E → depends on bazel-push-images-candidate
    • Publish images
      • :bazel::packer:  Publish executor image → depends on executor-vm-image:candidate
      • :bazel:⤴️ Publish executor binary
      • :bazel::docker: Push final images → depends on main::test main::test_2
    • Release
      • Release tests → depends on bazel-push-images
      • Finalize internal release

```
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-24 18:59:58 +00:00
Noah S-C
14123fcc42
chore(bazel): rework push_all to improve concurrency by avoiding bazel server lock (#64044)
This PR is a second attempt at improving push_all.sh, continuing on from
(and inspired by) https://github.com/sourcegraph/sourcegraph/pull/63391.
As a recap, that PR uses
[--script_path](https://bazel.build/reference/command-line-reference#flag--script_path)
to emit a short bash script for every `oci_push` target, which
essentially does minor setup + invokes the executable as if running
`bazel run`.

While the idea in https://github.com/sourcegraph/sourcegraph/pull/63391
was good, it trades concurrent server locking with an equal amount of
overhead in sequentially building the scripts. By observing the
scripts<b>[1]</b> that it would emit, we can notice a few things:
- The path
`/home/noah/.cache/bazel/_bazel_noah/8fd1d20666a46767e7f29541678514a0/execroot/__main__/bazel-out/k8-fastbuild/bin/`
shows up twice, which is the same path that `./bazel-bin` points at
- The script only `cd`'s to a path, unsets some environment variables,
and then executes the underlying script of the target.

The path can be observed to be a combination of bazel-bin, the target's
package (`//cmd/batcheshelper` in this case), as well as the target with
some extra static strings (`candidate_push` with `push_` prefix and
`.sh{,.runfiles}` suffixes for the script & its runfiles respectively).
Knowing this, and assuming that this is reliably so, we can opt to
recreate this manually instead, saving on the hefty overhead of `bazel
run --script_path`.

The current average times for `Push candidate images` and `Push final
images` are ~7m50s and ~8m30s respectively. While the example
main-dry-run build
[here](https://buildkite.com/sourcegraph/sourcegraph/builds/284041#0190e54a-9aaa-471a-81bf-623fce6ffa45)
isnt fully representative of how much rebuilding is required, it sets a
pretty solid 3m20s baseline.

Note this may break with rules_oci changes, but imo thats a small and
very infrequent cost to pay for cleaner log output + shaving a good
piece of time off.

<details><summary><b>[1]</b> A <code>--script_path</code>
example</summary>

```
#!/nix/store/mqc7dqwp046lh41dhs7r7q7192zbliwd-bash/bin/bash
cd /home/noah/.cache/bazel/_bazel_noah/8fd1d20666a46767e7f29541678514a0/execroot/__main__/bazel-out/k8-fastbuild/bin/cmd/batcheshelper/push_candidate_push.sh.runfiles/__main__ && \
  exec env \
    -u JAVA_RUNFILES \
    -u RUNFILES_DIR \
    -u RUNFILES_MANIFEST_FILE \
    -u RUNFILES_MANIFEST_ONLY \
    -u TEST_SRCDIR \
    BUILD_WORKING_DIRECTORY=/home/noah/Sourcegraph/sourcegraph \
    BUILD_WORKSPACE_DIRECTORY=/home/noah/Sourcegraph/sourcegraph \
  /home/noah/.cache/bazel/_bazel_noah/8fd1d20666a46767e7f29541678514a0/execroot/__main__/bazel-out/k8-fastbuild/bin/cmd/batcheshelper/push_candidate_push.sh "$@"
```

</details> 

## Test plan

Observe a `sg ci build main-dry-run`
[here](https://buildkite.com/sourcegraph/sourcegraph/builds/284041#0190e54a-9aaa-471a-81bf-623fce6ffa45).

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-24 16:55:09 +01:00
Will Dollman
9dd901f3c9
Integrate security release approval into release pipeline (#63990)
As part of the [Vuln Scanning
Improvements](https://linear.app/sourcegraph/project/[p0]-vulnerability-scanning-improvements-75299c4312dd/issues)
project, I've been working on tooling to automate the security approval
step of the release process.

This PR integrates these improvements into the release pipeline:

* Internal releases will run a vulnerability scan
* Promote-to-public releases will check for security approval

If a public release does not have security approval, it will block the
promotion process. The step happens at the start of the pipeline so
should be a fast-fail. You can also check for release approval before
running promotion by running `@secbot cve approve-release <version>` in
the #secbot-commands channel. In an ideal world we (security) will have
already gone through and approved ahead of release.

I've tested this PR as much as I can without running an actual release!
We have a 5.5.x release tomorrow so it'll be a good test. If it does
cause problems that can't be easily solved, it can always be temporarily
disabled.

I've tagged this PR to be backported to `5.5.x`.

<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Pre-merge checklist

- [x] Revert commit that disables release promotion

## Test plan

Manual testing of the release process:
- [x] [Successful test
run](https://buildkite.com/sourcegraph/sourcegraph/builds/283774#0190dfd6-fa70-4cea-9711-f5b8493c7714)
that shows the security scan being triggered
- [x] [Promote to public test
run](https://buildkite.com/sourcegraph/sourcegraph/builds/283826) that
shows the security approval approving a release
- [x] [Promote to public test
run](https://buildkite.com/sourcegraph/sourcegraph/builds/283817#0190e0ec-0641-4451-b7c7-171e664a3127)
that shows the security approval rejecting a release with un-accepted
CVEs

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-24 09:19:49 +01:00
Bolaji Olajide
067115910c
fix(ci): check command out for error when git fails (#63993)
Closes [#1110](https://github.com/sourcegraph/devx-support/issues/1110)
Closes DINF-96

We don't print the stdErr when a command fails … in particular when git
fails. Therefore we see very little in the panic of what went wrong.

Explanation:
> There's a weird behavior that occurs where an error isn't accessible
in the err variable
// from a *Cmd executing a git command after calling CombinedOutput().
// This occurs due to how Git handles errors and how the exec package in
Go interprets the command's output.
// Git often writes error messages to stderr, but it might still exit
with a status code of 0 (indicating success).
// In this case, CombinedOutput() won't return an error, but the error
message will be in the out variable.

## Test plan

Manual testing

```go
func main() {
	ctx := context.Background()
	cmd := exec.CommandContext(ctx, "git", "rev-parse", "--is-inside-work-tree")
	out, err := handleGitCommandExec(cmd)
	if err != nil {
		// er := errors.Wrap(err, fmt.Sprintf("idsdsd: %s", string(out)))
		panic(err)
	}
	fmt.Println("hello", string(out))
}
```

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-23 09:56:33 -05:00
Will Dollman
b7242d280f
Publish images for all commits on release branches (#63985)
In order to run nightly vulnerability scans of Sourcegraph releases, we
need to publish a new set of images whenever the release branch is
pushed to.

Previously, this was implemented in
https://github.com/sourcegraph/sourcegraph/pull/63379 but with RFC 795
the release branch format changed from 5.5.1234 to 5.5.x.

This PR updates the regex to catch this new format.

The end result of this is that whenever Buildkite runs on a branch
matching `\d.\d.x`, it will push images to the
`us.gcr.io/sourcegraph-dev/gitserver` registry with the tag
`$branch-insiders`.

I've also tagged this PR for backport as we want it on the current patch
release branch 5.5.x :)

<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

- Test buildkite run on branch `will-0.0.x` (with modified regex to
match that branch)
https://buildkite.com/sourcegraph/sourcegraph/builds/283608

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-22 16:12:56 +01:00
Quinn Slack
1fe876e89c
finish removing chromatic (#63966)
We removed Chromatic in
https://github.com/sourcegraph/sourcegraph/pull/62228, but there were
still some remnants.

## Test plan

CI
2024-07-21 18:37:02 -07:00
Noah S-C
b7dac3b808
fix(ci): only emit bazel execlog artifact for 'test' commands (#63916)
Delivery Manifest step has started to run `bazel build` commands, in them clobbering our execlog artifacts. We should only emit it for the test buildkite jobs (at least for the time being), as it currently doesnt make sense for e.g. the image push jobs which contain multiple invocations

## Test plan

CI

## Changelog
2024-07-18 15:17:12 +01:00
William Bezuidenhout
098ad8ecf7
fix(ci): panic using correct err (#63599)
It was panicing using the wrong error value

## Test plan
CI
## Changelog
* ci - use correct err value to panic on
2024-07-02 14:16:08 +00:00
William Bezuidenhout
720b2ecdc2
fix(sg/bazel-do): use ci.sourcegraph.bazelrc with bazel-do (#63545)
Without `ci.sourcegraph.bazelrc` the bazel environment won't have the
right credentials to access the db. This adds the rc to the bazel-do
invocation.

For context - the `ci.sourcegraph.bazelrc` contains this following
```
# Needed for DB in CI
common --test_env=PGUSER=postgres
common --test_env=PGPASSWORD=postgres
common --test_env=PGSSLMODE=disable
common --test_env=PGDATABASE=postgres
```

## Test plan

https://buildkite.com/sourcegraph/sourcegraph/builds/280332#01905ef3-1fce-4d76-bf5b-0530dc434cff
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog
* sg - ensure bazel-do invocations use the ci sourcegraph bazelrc
2024-06-28 13:14:26 +00:00
Quinn Slack
dc478c82dd
chore(ci): remove Percy visual tests (#63515)
These are more frequently erroneous than helpful.

See
https://sourcegraph.slack.com/archives/C04MYFW01NV/p1719209633005499.

This eliminates a source of frustration and flakiness in pull requests
and removes a lot of code and Bazel complexity.

If we want to revive them, we can revert this commit. Note that
`client/web-sveltekit` does not use Percy, and if we want it to, we can
always revert this commit or start over from scratch if that's easier.


<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

CI

Co-authored-by: Jean-Hadrien Chabran <jean-hadrien.chabran@sourcegraph.com>
2024-06-27 16:20:06 +02:00
Noah S-C
7a9d2b02e4
chore(ci): emit compact executon log in CI (#63420)
Second attempt at https://github.com/sourcegraph/sourcegraph/pull/61760,
we can start using these to dig into action cache misses etc

## Test plan

CI passes green


## Changelog
2024-06-21 19:50:35 +01:00
Will Dollman
e24226a764
Publish images from patch release branches (#63379)
We currently don't publish images from the new-style patch release
branches like `5.4.5099`, as this is all performed using the new release
tooling.

In order to improve the release process, we (Security) would like to run
a daily scan of the current set of images built from the patch release
branch. Currently we only scan images built from `main`, but these
slowly diverge from the patch release branch in the 2 week window
between a monthly release and the patch release.

To give a specific example, we currently have no easy/automated way to
scan images from the `5.4.5099` branch that a release will be cut from
this afternoon until the release team run the internal release process.

This PR updates the pipeline so that whenever a new commit is pushed to
the patch release branch, it will publish a new set of images and
include the tag `<branch>-insiders`. Currently just pushing to
us.gcr.io, but equally could push to dockerhub.

Example of the jobfile for a matching branch after this PR:

`bazel --bazelrc=/tmp/aspect-generated.bazelrc
--bazelrc=.aspect/bazelrc/ci.sourcegraph.bazelrc run
//cmd/batcheshelper:candidate_push --stamp
--workspace_status_command=./dev/bazel_stamp_vars.sh -- --tag
dc438648b0 --tag dc438648b0cc_2024-06-20 --tag dc438648b0cc_279230
--tag will/5.4.9999-insiders --repository
us.gcr.io/sourcegraph-dev/batcheshelper && echo -e
'<tr><td>batcheshelper</td><td><code>us.gcr.io/sourcegraph-dev</code></td><td><code>dc438648b0cc</code>,
<code>dc438648b0cc_2024-06-20</code>, <code>dc438648b0cc_279230</code>,
<code>will/5.4.9999-insiders</code></td></tr>'
>>./annotations/pushed_images.md`

[Example buildkite
run](https://buildkite.com/sourcegraph/sourcegraph/builds/279230#_)
where the pattern was updated to match this branch, and pushing
non-candidate images was disabled.

This resolves one part of
[SEC-1734](https://linear.app/sourcegraph/issue/SEC-1734/scan-images-from-patch-release-branches)

<!-- 💡 To write a useful PR description, make sure that your description
covers:
- WHAT this PR is changing:
    - How was it PREVIOUSLY.
    - How it will be from NOW on.
- WHY this PR is needed.
- CONTEXT, i.e. to which initiative, project or RFC it belongs.

The structure of the description doesn't matter as much as covering
these points, so use
your best judgement based on your context.
Learn how to write good pull request description:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4
-->


## Test plan

- Manual testing of buildkite pipeline

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


## Changelog

<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?

Audience: TS/CSE > Customers > Teammates (in that order).

Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->

<!--
Example:

Title: fix(search): parse quotes with the appropriate context
Changelog section:

## Changelog

- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
2024-06-20 15:46:37 +01:00
Noah S-C
d237975918
chore(ci): instrument push_all.sh commands in honeycomb (#63350)
So I can measure the impact of changes on the individual `bazel run`
invocations

## Test plan

main dry-run and seeing the output
https://ui.honeycomb.io/sourcegraph/datasets/buildkite-pushall/result/bCLzgquaSdV?hideCompare

## Changelog
2024-06-19 18:16:21 +01:00
James Cotter
1712928bc5
msp/deploy: encode commit_message as base64 (#63165)
Encodes the commit_message as base64 to avoid issues with special
characters breaking the deploy command

Part of CORE-172

## Test Plan
CI

[_Created by Sourcegraph batch change
`jac/msp-rollout-base64`._](https://sourcegraph.sourcegraph.com/users/jac/batch-changes/msp-rollout-base64)
2024-06-07 23:31:42 +01:00
William Bezuidenhout
8bb0ab54eb
release: never use build number in image family (#63157)
the executor image and docker mirror image should now follow the
following naming convention:

Image family:
`sourcegraph-executors-[nightly|internal|'']-<MAJOR>-<MINOR>`
Image name:
`sourcegraph-executor-[nightly|internal|'']-<MAJOR>-<MINOR>-<BUILD_NUMBER>`

example:
Image family: `sourcegraph-executors-5-4`
Image name: `sourcegraph-executor-5-4-277666`

## What happens during releases and _not_ releases?
#### Nightly
**`nightly` suffix**
Image family: `sourcegraph-executors-nightly-<MAJOR>-<MINOR>`
Image name:
`sourcegraph-executor-nightly-<MAJOR>-<MINOR>-<BUILD_NUMBER>`
#### Internal
**`internal` suffix**
Image family: `sourcegraph-executors-internal-<MAJOR>-<MINOR>`
Image name:
`sourcegraph-executor-internal-<MAJOR>-<MINOR>-<BUILD_NUMBER>`
#### Public / Promote to public

** No suffix **

Image family: `sourcegraph-executors-<MAJOR>-<MINOR>`
Image name: `sourcegraph-executor-<MAJOR>-<MINOR>-<BUILD_NUMBER>`

>  [!IMPORTANT]
> Should we keep the imagine name stable at
`sourcegraph-executor-<MAJOR>-<MINOR>-<BUILD_NUMBER>`
> and only change the family name? 
>
> **Why?**
>
> The Image family dictates the collection of images and that changes
each major minor and or release phase so there is really no use in
changing the image name too, except at a glance you can see from the
name what image family it belongs to?
## Test plan

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


## Changelog

<!--
1. Ensure your pull request title is formatted as: $type($domain): $what
2. Add bullet list items for each additional detail you want to cover
(see example below)
3. You can edit this after the pull request was merged, as long as
release shipping it hasn't been promoted to the public.
4. For more information, please see this how-to
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c?

Audience: TS/CSE > Customers > Teammates (in that order).

Cheat sheet: $type = chore|fix|feat $domain:
source|search|ci|release|plg|cody|local|...
-->

<!--
Example:

Title: fix(search): parse quotes with the appropriate context
Changelog section:

## Changelog

- When a quote is used with regexp pattern type, then ...
- Refactored underlying code.
-->
2024-06-07 17:23:24 +02:00
Noah S-C
bb178ba729
chore(tooling): bump Go version to 1.22.4 (#63124)
Bump for @evict 

## Test plan

CI passes with no complaints

## Changelog

- Bumped version of Go used to build to 1.22.4
2024-06-06 15:19:03 +00:00
James Cotter
bcc4367f86
msp/deploy: add 'author' and 'commit_message' annotations (#63108)
Add 'author' and 'commit_message' annotations on release

## Test plan
CI
2024-06-05 11:43:02 -07:00
Noah S-C
e1974fe9f5
chore(bazel): update ownership tags to increase coverage (#63001)
Brings us up to 73%, a bit of buffer room


## Test plan

`./dev/check-test-ownership.sh` prints out 73


## Changelog
2024-05-31 14:10:29 +00:00
Jean-Hadrien Chabran
21b2918ef2
chore(local): catch bazel-do issues before push (#62943) 2024-05-28 15:16:13 +02:00
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
Jean-Hadrien Chabran
75bd631412
fix(local): panic in sg ci preview (#62928) 2024-05-27 15:06:25 +02:00
James McNamara
69b1bfb4d0
feat(ci): docker-images runtype (#62708)
---------

Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
2024-05-27 14:45:01 +02:00
Jean-Hadrien Chabran
7c15db348d
chore(rel): fix tests not waiting for push prod (#62089) 2024-05-23 16:15:33 +02:00
William Bezuidenhout
c97842e3c4
sg: cloud ephemeral - only push one tag (#62843)
only push one tag
2024-05-22 11:33:59 +02:00
Varun Gandhi
e4bb0b5ce6
chore: Remove client construction from SignUp/In funcs (#62789)
These functions are used in test code, which makes it tricker to
pass in loggers for checking requests and responses. Instead, make
the API method-based. This introduces slightly more boilerplate
since Client construction is fallible, but it allows calling code
to pass in loggers more easily for debugging test failures.
2024-05-21 15:18:58 +02: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
sourcegraph-release-guild-bot
f4ec7e52d8
msp: add commit attribute to rollout (#62742)
Co-authored-by: James Cotter <jamescotter@pm.me>
2024-05-16 20:35:34 +01:00
Noah S-C
9b6ba7741e
bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
Jean-Hadrien Chabran
2a09fe27db
chore(ci): bump backcompat target to 5.4.0 (#62623)
* chore(ci): bump backcompat target to 5.4.0
2024-05-13 11:37:11 +02:00