sourcegraph/dev/zoekt/update
Keegan Carruthers-Smith 0a038b1593
gomod: update zoekt to fix several CVEs in dependencies (#60093)
This is in preperation for the 5.3 release.

19fa44cea9...245e0cebf7

- fdc144f8fd all: gofmt -s -w .
- 746f38849d matchtree: fix panic for missing files
- 62017762fc gomod: update mountinfo to latest
- 0ddb91fea5 all: use stdlib slices package
- 7ec3d8e8bf gomod: update grpc for GHSA-m425-mq94-257g
- 245e0cebf7 gomod: update otel and circl for CVEs

Test Plan: CI and the relevant CVEs we solved no longer appear when
running "trivy fs go.mod".
2024-02-02 15:36:04 +00:00

46 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
export GO111MODULE=on
# Can specify a SHA pushed to our fork instead of master
version="${1:-main}"
name="sourcegraph/zoekt"
repo="github.com/${name}"
response="$(mktemp)"
trap 'rm -f "$response"' EXIT
curl --silent --fail "https://api.github.com/repos/${name}/commits?per_page=1&sha=${version}" >"${response}"
newsha="$(jq -r '.[0].sha[:12]' <"${response}")"
oldsha="$(go mod edit -print | grep "$repo" | grep -o '[a-f0-9]*$')"
echo "https://$repo/compare/$oldsha...$newsha"
curl --silent --fail "https://api.github.com/repos/sourcegraph/zoekt/compare/$oldsha...$newsha" >"${response}"
echo
jq -r '.commits[] | "- https://github.com/sourcegraph/zoekt/commit/" + .sha[:10] + " " + (.commit.message | split("\n")[0])' <"${response}" |
sed 's/ (#[0-9]*)//g'
echo
jq -r '.commits[] | "- " + .sha[:10] + " " + (.commit.message | split("\n")[0])' <"${response}" |
sed 's/ (#[0-9]*)//g'
echo
go get "${repo}@${version}"
go mod download ${repo}
go mod tidy
echo "Ensure that we update Bazel dependency files."
bazel run '//:gazelle-update-repos'
echo "Ensure that we update Bazel build files."
bazel run '//:gazelle'
echo "Ensure we update go.sum by actually compiling some code which depends on zoekt."
echo "We do this by running 'go test' without actually running any tests."
go test -run '^$' github.com/sourcegraph/sourcegraph/internal/search/zoekt