This repository was archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
release: move src-cli to monorepo #61925
Open
BolajiOlajide
wants to merge
983
commits into
main
Choose a base branch
from
bo/src-cli-monorepo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 250 commits
Commits
Show all changes
983 commits
Select commit
Hold shift + click to select a range
e6f55b9
Add release notes for 3.40.2 (#757)
olafurpg dd9000a
Make src-cli installable via npm. (#760)
olafurpg 9ab268f
Use `setup-node` GitHub Actions step before running `npm publish`. (#…
olafurpg 72c480b
Pin dependency @types/tar to 6.1.1 (#761)
renovate[bot] ad9dbba
Simplify npm package release by setting the version (#763)
olafurpg 4236862
Fix silly quote bug (#765)
olafurpg dc24b0f
Fix the regexp to extract the version from git refs (#766)
olafurpg 097f617
go.mod: update to latest sourcegraph/sourcegraph/lib (#767)
LawnGnome a8eddf8
changelog: update for 3.40.8 (#769)
LawnGnome 17dd444
batches: ensure .gitconfig email is properly inserted in batch spec (…
BolajiOlajide 087a6b7
batches: bump `sourcegraph/lib` (#772)
courier-new 040e554
changelog: update for 4.30.9 (#771)
courier-new 75fa7f1
batches: Mount paths into a container (#770)
Piszmog 181e3de
Only apply cache result progress if resulted in diff (#778)
eseliger 98f49b9
Fix step caching (#781)
eseliger 20635ab
Don't write execution results to SSBC cache and remove unnecessary ad…
eseliger ce71dcb
Prepare changelog for 3.40.10 (#782)
eseliger 4723b4b
docker: use a short timeout when inspecting images (#783)
LawnGnome 8503b35
batches: Don't let stderr clutter git output (#785)
eseliger f776d41
Polish and use native workspaces in executors mode (#768)
eseliger 46cc59c
Prepare changelog for 3.40.11 (#788)
eseliger 524c89a
batches: use Docker CPU count as default parallelism, not GOMAXPROCS …
LawnGnome 96335e5
batches: upsert batch change when running `src batch remote (#787)
BolajiOlajide 9689dc7
Prepare changelog for 3.41.0 (#792)
eseliger 0755599
batches: Cache filesystem mount (#795)
Piszmog 237e58a
batches: add SRC_HEADERS for passing multiple custom headers (#796)
BolajiOlajide 05e3f02
workflows: update pr-auditor workflow (#791)
bobheadxi ef2ba4d
Cancel reading from stdin on Ctrl-C (#794)
mrnugget 256a8b7
batches: Refactor caching to get rid of execution cache results altog…
eseliger 2fbc937
remove quotes from upload ID URL (#799)
Strum355 16f9963
Refactor execution to be able to use runSteps in exec mode directly (…
eseliger 87b7685
deps: upgrade sourcegraph/lib (#800)
bobheadxi dab9591
Use new API to resolve workspaces server-side (#801)
eseliger 4d5a398
Add changelog for 3.42.0 (#802)
eseliger 8db7dd7
Fix workspace resolution for non-server-side (#803)
eseliger f02a713
Don't keep unsupported/ignored repos error for server-side resolution…
eseliger 86c548b
Port workspaces path fix to src-cli (#779)
eseliger 625547b
test: use autogold for testdata (#806)
rvantonder e043d96
search: use chunk matches to render multiline streamed results (#807)
rvantonder c0cad1a
Update dependency @types/tar to v6.1.2 (#808)
renovate[bot] b400c2d
batches: Log error from executeBatchSpecInWorkspaces (#811)
eseliger da6bd59
Run go mod tidy (#812)
eseliger b86c397
batches: fix Docker Desktop for Linux handling (#813)
LawnGnome abd00f5
orgs: update `create` mutation (#815)
d0a443b
batches: Make sure no corrupted repozips are used (#817)
eseliger 7430f1d
gomod: update grafana/regexp (#814)
keegancsmith ff9a8d7
chore: Bump scip dependency for bug fixes. (#820)
varungandhi-src 854b9c9
bump sourcegraph/sourcegraph/lib (#821)
Strum355 1aeca04
Prepare changelog for 3.43.0 (#818)
eseliger fc87b62
docs: Link to usage docs, de-emphasize deprecated command. (#824)
varungandhi-src 0164877
Prepare CLI for extension sunsetting (#825)
philipp-spiess e6e03e8
Update release process until 4.0 stable is released. (#827)
LawnGnome 8a75c6f
release.sh: allow -rc.X suffixes (#829)
LawnGnome 8c0658f
goreleaser: force releases to be marked as pre-release (#830)
LawnGnome 8afc465
Remove src-cli workspace resolution (#819)
eseliger a415fac
Remove old feature gates from pre-4.0 (#822)
eseliger 96c8c8c
Fix over recursion of git serve (#810)
varsanojidan 812cde1
src doc: add code-intel and remove lsif (#831)
mrnugget 1ef0f08
deps: upgrade github.com/sourcegraph/log (#835)
bobheadxi 6a997c0
readme: add instructions for docker (#836)
keegancsmith 8d1c247
Add `src users clean` to src-cli (#826)
DaedalusG 70466eb
removed development printlns :facepalm: (#838)
DaedalusG 2e0a028
doc: tinker with the help for -clean-archives for clarity (#839)
LawnGnome 756a50e
Add changelog entry for 3.43.2 (#837)
eseliger 6a43f0c
batches: Fix remote command - Batch Change ID not provided (#842)
Piszmog 692663e
changelog: 4.0.0 (#843)
LawnGnome cb9c49f
Revert 4.0-pre changes (#828)
LawnGnome 1dab5b2
batches: check that docker is running when running src batch (#844)
BolajiOlajide 0f2ef91
code-intel: Don't panic on errors in SCIP code paths. (#847)
varungandhi-src 5b02986
Update dependency @types/tar to v6.1.3 (#850)
renovate[bot] 4e07d07
chore: Bump scip dependency for Relationship.is_definition. (#854)
varungandhi-src ad1b36a
batches: Remote Mount #5 - src-cli (#816)
Piszmog 5a9d166
Update changelog for next release version (#857)
Piszmog ac3c970
chore: Bump scip dependency for LSIF conversion fix. (#858)
varungandhi-src 23cab1f
Add a add subcommand to extsvc (#856)
jhchabran e0d3136
code-intel: Fix double word typo (#851)
abitrolly fb189ab
batches: show warning when batch changes are too large (#860)
LawnGnome ecce113
Automate versioned Homebrew formula publishing, fix patch releases (#…
courier-new ef06271
Prepare changelog for 4.1 (#865)
courier-new 85c118a
ssbc: Don't drop repo origin (#871)
eseliger e4cacfc
secrets: Allow using secrets from os.Environ (#872)
eseliger 1174f68
batches: fix whitespace problem introduced in #860 (#873)
LawnGnome fc3f13f
Changed query syntax link to correct page (#874)
ee916cd
Add windows tutorial for cli config (#875)
zhimin-z 993ee0a
Use `GITHUB_REF_NAME` to determine current tag for release workflow (…
courier-new c908e51
Improve log output of docker pull errors (#880)
eseliger d5778f1
Fix broken code-intel link (#882)
philipp-spiess 4346388
batches: Workspace file upload for local runs (#861)
Piszmog eaf900b
Add changelog entry for 4.1.1 (#881)
eseliger 8424c23
Prepare changelog for 4.1.1 (#883)
courier-new 73964e6
update changelog (#884)
BolajiOlajide e77731f
update release process (#885)
BolajiOlajide c9902bf
batches: improve handling of non-root steps (#886)
LawnGnome 4d2957c
snapshot: add 'snapshot summary', 'snapshot test' (#888)
bobheadxi 5d82eb0
snapshot: add pg_dump command builder with 'snapshot databases' (#889)
bobheadxi fa50cb7
snapshot: add snapshot contents uploader (#890)
bobheadxi e765697
Support binary diffs (#887)
eseliger c06c567
changelog: add mention of new 'src snapshot' commands (#891)
bobheadxi 7462d79
snapshot: improve docstrings (#892)
bobheadxi 173d2ad
snapshot: trim extension statements from pgdump when uploading (#893)
bobheadxi ba6d0bf
add CRUD support for repo key-value pairs (#896)
tbliu98 cbc5871
add watchdog goroutine for docker (#898)
BolajiOlajide a2de954
update changelog (#899)
BolajiOlajide 0476543
Rename users clean or prune -- use aggregated user statistics (#901)
DaedalusG 0768bfb
correct query formatting (#903)
DaedalusG b5564ea
Fixup development docs (#905)
eseliger eb68e5f
Return an error when additional headers conflicts (#910)
jhchabran ed6a481
batches: update limit in unlicensed alert (#900)
courier-new f1ef4c8
Validate: add ability to check if code insights works on an instance …
mucles 4ef7cba
codeintel: print every error encountered while retrying code-intel up…
Strum355 6d72b3f
Fix src batch repo file parameter parsing (#919)
eseliger 90bd461
instancehealth: remove monitoring check (#920)
bobheadxi c84c80a
batches: skip empty log output (#923)
BolajiOlajide 0ffe3d3
Validate: add ability to expand `src validate` commands for future he…
jdpleiness 2a63033
`users prune` - Paginate graphql site users - fix bug for soft delete…
DaedalusG 1e9a0cf
update changelog (#924)
BolajiOlajide 1c70d53
[language-platform] update src-cli to handle scip file upload (#897)
cesrjimenez dd50ea0
Validate: add support for kubernetes deployment validation with `src …
jdpleiness 79c8fa1
Add deleteWhenDone option to insights (#927)
jdpleiness c967c5e
Update CHANGELOG.md for 4.4.1 release (#928)
jdpleiness 715ed43
batches: query max unlicensed changesets count (#929)
adeola-ak e9ce3f6
snapshot: fix incorrect ref to validation error (#933)
bobheadxi 8579a58
Do not override executor queue endpoints (#934)
efritz a1f16e8
Prep changelog for 4.4.2 release (#935)
efritz a84baf7
update changelog for 4.5 release (#937)
BolajiOlajide b7eb62b
permissions-center: use new `permissionSyncJobs` query. (#942)
sashaostrikov f5de12d
ci: update to actions/checkout@v3 (#908)
daxmc99 f7f5b1d
servegit: use more performant WalkDir (#938)
keegancsmith cc0ee59
src validation for ebs-csi drivers and VPCs (#939)
jasonhawkharris 9a46c5e
Teams CLI interface (#922)
eseliger 8de09aa
add side effect imports for azure and gcp auth (#944)
jasonhawkharris df169f1
Adds validation of CSI drivers for GKE (#948)
jasonhawkharris 241050b
Implement CLI for ingested codeowners (#943)
eseliger 34f3599
validate persistent volumes for aks clusters (#950)
jasonhawkharris 7875b7d
Adds conditions for clusters that do not have Sourcegraph installed. …
jasonhawkharris 37ff66f
Add Snapshot Restore command (#947)
jac 85115b1
Update to Go 1.19.6 (#946)
jhchabran 42706ee
version: Clarify origin of error (#953)
eseliger 07cb66d
Add changelog entries for Own-related additions (#954)
422a71c
changelog: cut [email protected] (#955)
coury-clark db398d0
Bump sourcegraph dependency to fix version parsing of insiders (#959)
eseliger 97b08ed
Admin: add `src admin create` command (#957)
jdpleiness 0ce1ae4
Fix: no longer require SRC_GITHUB_TOKEN to be set (#958)
jdpleiness 9e8f082
Release: update CHANGELOG.md for release process of 5.0.2 (#960)
jdpleiness e0a4d7b
Fix `go.mod` dirty state error in build (#961)
jdpleiness 13f6567
Allow empty commits in copy pre-release step (#962)
courier-new b869716
Fix `src admin create` outputing token to stderr instead of stdout (#…
jdpleiness 5295c1f
Fix GraphQL query to reflect changes in 5.0 (#964)
jdpleiness 72e805c
Update asdf to Go 1.19.7 (#967)
evict 58b3f70
Update to Go 1.19.8 (#968)
evict f0e8fc2
Update CHANGELOG.md for release (#969)
jdpleiness 3c38e81
actions: fix job name conflict (#970)
burmudar f5469f2
Add nix flake support (#965)
ryuheechul ea9e501
(chore) rename "repo {add|update|delete}-kvp" to "repo {add|update|de…
erzhtor 1ef7956
Scj/update/smtp validate (#973)
scjohns 4eff6b7
Scj/update/executor validate (#974)
scjohns ef134fb
update changelog (#976)
scjohns 3d540ec
(feat) add "src repos {add|update|delete}-metadata -repo-name" flag s…
erzhtor b367736
Adds the `src scout` utility to the CLI (#978)
jasonhawkharris 165b945
add ability to dump all resource data to text file (#981)
jasonhawkharris f3812db
build src-cli w/ bazel (#979)
davejrt 0890929
fix new line (#982)
davejrt 4766869
add usage command to 'src scout' (#983)
jasonhawkharris 4effeda
Adds the `--pod` flag to `scout usage` (#984)
jasonhawkharris d9d8ca6
scout/usage: add `--docker` flag to `scout usage` tool (#985)
jasonhawkharris 391d916
scout/usage: add `--container` flag to `src scout usage` (#986)
jasonhawkharris 7fc6627
correct headers for exporting usage data to file (#987)
jasonhawkharris 23e8eb2
scout/advise: first iteration of the `src scout advise` subcommand (#…
jasonhawkharris 5a99c9b
add output flag for advise (#990)
jasonhawkharris 81cb1c9
remove docker flag from all scout sub-commands (#999)
jasonhawkharris 25f9e0f
test advise package and more tests for kube package (#1000)
jasonhawkharris 1cd7ede
print warnings with `--warnings` flag (#1001)
jasonhawkharris ec92b2a
reference docker user from environment (#1003)
coury-clark 9449056
use --clean instead of --rm-dist in goreleaser (#1004)
coury-clark 7128a28
remove go get from releaser (#1005)
coury-clark ef0516b
help text: remove 'upload' command that does not exist (#1006)
mrnugget 31f7c45
changelog: cut [email protected] (#1002)
unknwon 12b8e23
"update pr-auditor workflow" (#1007)
burmudar 35689b4
go-releaser: upgrade workflow (#1013)
burmudar c0e74d1
codeintel: handle -insecure-skip-verify in SCIP endpoint detection (#…
Strum355 b388f85
instancehealth: permissionSyncJobs -> permissionsSyncJobs (#1010)
bobheadxi 7c5da8e
batches: File upload error handling (#1015)
Piszmog b9e783a
changelog update 5.1.1. (#1017)
BolajiOlajide 1405961
switch to attoto/clipboard package (#1022)
jasonhawkharris ee449a7
docker/info use format JSON (#1008)
Dasio 77abad8
README: fix PowerShell env var instructions (#1025)
mrnugget 0ba39d4
ci: fix goimports lint (#1026)
mrnugget 84ffc3e
Clean up volumes if workspace preparation fails (#1021)
lowjoel 4c42568
changelog update (#1027)
BolajiOlajide 511ebf8
5.1.2 changelog update (#1028)
BolajiOlajide c0d85ec
codeintel: allow configuring max concurrency in uploads (#1023)
Strum355 4c76e19
changelog entry for codeintel upload concurrency flag (#1029)
Strum355 f3a1963
docs: Tweak examples for src code-intel upload (#1019)
varungandhi-src 573ddf8
codeintel: Fail fast on 401 failure in SCIP detection (#1034)
varungandhi-src 998d087
docs: Mention SCIP not just LSIF (#1033)
varungandhi-src bdc0413
servegit: use error hook (#1037)
keegancsmith 93218fa
changelog: cut [email protected] (#1038)
unknwon e58f6a8
update go in workflows to be 1.20 (#1043)
burmudar e12882d
code-search: fix fork attribute for src-cli batch changes (#1045)
BolajiOlajide 437d0ec
changelog update 5.2.1 (#1046)
BolajiOlajide 8df5490
code-search: remove -i flag (#1047)
BolajiOlajide f2f0948
goreleaser: quote go version number (#1048)
burmudar d53e95f
pr-auditor: use new token (#1053)
burmudar 0621a63
populate branch name during template resolution (#1054)
camdencheek 1798cc3
Update go.mod to fix several vulnerabilities (#1057)
willdollman 180d4e0
changelog: cut [email protected] (#1058)
keegancsmith d29ee42
chore: use scip-go instead of lsif-go for precise indexing in CI (#1060)
Strum355 43ca41b
npm: add readme when prepacking (#1059)
BolajiOlajide 5db13a9
Add CODEOWNERS file (#1061)
varungandhi-src 9a8dee7
Update dependency aspect_bazel_lib to v1.42.1 (#995)
renovate[bot] a136d96
Update dependency aspect_bazel_lib to v1.42.2 (#1062)
renovate[bot] f07c2e9
Update golang Docker tag to v1.22.1 (#723)
renovate[bot] 3096fd4
Update dependency bazel_gazelle to v0.35.0 (#996)
renovate[bot] 9e50e22
Update dependency bazel_skylib to v1.5.0 (#997)
renovate[bot] 2352d0a
Update dependency io_bazel_rules_go to v0.46.0 (#998)
renovate[bot] e174127
Update dependency tar to ^6.2.1 (#877)
renovate[bot] b1f6221
Update actions/setup-node action to v4 (#1044)
renovate[bot] eabf75d
Update actions/checkout action to v4 (#1036)
renovate[bot] 612873d
Update dependency shfmt to v3.8.0 (#895)
renovate[bot] 00d702f
Update actions/setup-go action to v5 (#1052)
renovate[bot] 0428303
Update goreleaser/goreleaser-action action to v5 (#1041)
renovate[bot] 0c3159f
Update dependency aspect_bazel_lib to v2 (#1051)
renovate[bot] 19302e4
Update dependency shellcheck to v0.10.0 (#894)
renovate[bot] b6164a0
Update docker/setup-qemu-action action to v3 (#1040)
renovate[bot] 7c4dac6
fix deprecated field (#1066)
camdencheek f468496
Update dependency @types/tar to v6.1.12 (#1067)
renovate[bot] 612c233
Update docker/setup-buildx-action action to v3 (#1039)
renovate[bot] 73444ec
Update dependency ubuntu to v22 (#1030)
renovate[bot] 2d15ea9
Update dependency bazel_gazelle to v0.36.0 (#1065)
renovate[bot] 1e92fa8
Update dependency aspect_bazel_lib to v2.7.0 (#1068)
renovate[bot] 8d0899a
Update alpine Docker tag to v3.19.1 (#722)
renovate[bot] f5cd681
Update golang Docker tag to v1.22.2 (#1064)
renovate[bot] efd12d5
Update golang:1.22.2-alpine Docker digest to cdc86d9 (#1069)
renovate[bot] d8950a1
Add 'src-cli/' from commit 'efd12d571bb3a0a59e4c517317d88f91fd693050'
BolajiOlajide bd5c916
update golangci config
BolajiOlajide 94d2d41
make use of sg/lib/errors for errors
BolajiOlajide 540e879
bazel
BolajiOlajide 5095139
fix lint
BolajiOlajide 6d6acfb
prettier
BolajiOlajide 665a339
fix lint errors
BolajiOlajide 97aeb01
fix lint errors
BolajiOlajide 90fa960
format gazelle
BolajiOlajide 2590548
empty commit to test CLA
BolajiOlajide 24daa88
Merge branch 'main' into bo/src-cli-monorepo
BolajiOlajide c831a03
set env var for bazel tests
BolajiOlajide d82a14f
rewrite tests to work with bazel
BolajiOlajide bf3abb5
fix failing tests
BolajiOlajide 5810adb
Merge branch 'main' into bo/src-cli-monorepo
BolajiOlajide 408ba99
bazel
BolajiOlajide 7c657cd
fix thigns (#62635)
BolajiOlajide File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Anything Git or VSCode related is definitely irrelevant for a build. | ||
| .git* | ||
| .vscode | ||
|
|
||
| # The docker directory contains other Docker images. | ||
| docker | ||
|
|
||
| # The release directory is created by goreleaser and isn't required here. | ||
| release | ||
|
|
||
| # Documentation and examples aren't needed. | ||
| *.md | ||
| *.{yaml,yml} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * -text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ### Test plan | ||
|
|
||
| <!-- | ||
| As part of SOC2/GN-104 and SOC2/GN-105 requirements, all pull requests are REQUIRED to | ||
| provide a "test plan". A test plan is a loose explanation of what you have done or | ||
| implemented to test this, as outlined in our Testing principles and guidelines: | ||
| https://docs.sourcegraph.com/dev/background-information/testing_principles | ||
| Write your test plan here after the "Test plan" header. | ||
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # For more information, refer to the "Dependent Docker images" section of | ||
| # DEVELOPMENT.md. | ||
| name: Publish Docker image dependencies | ||
|
|
||
| # We only want to build on releases; this condition is 100% stolen from the | ||
| # goreleaser action. | ||
| on: | ||
| push: | ||
| tags: | ||
| - "*" | ||
| - "!latest" | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # We need buildx to be able to build a multi-architecture image. | ||
| - name: Set up Docker buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| # We also need QEMU, since this is running on an AMD64 host and we want to | ||
| # build ARM64 images. | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
Check warningCode scanning / Semgrep OSS Semgrep Finding: security-semgrep-rules.semgrep-rules.yaml.third-party-action-not-pinned-to-commit-sha
An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
|
||
| with: | ||
| platforms: arm64 | ||
|
|
||
| - run: ./docker/batch-change-volume-workspace/push.py -d ./docker/batch-change-volume-workspace/Dockerfile -i sourcegraph/src-batch-change-volume-workspace -p linux/amd64,linux/arm64,linux/386 --readme ./docker/batch-change-volume-workspace/README.md | ||
| env: | ||
| DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Go CI | ||
|
|
||
| on: | ||
| - push | ||
|
|
||
| jobs: | ||
| go-test: | ||
| strategy: | ||
| matrix: | ||
| go-version: [1.20.x] | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
| - run: go test -race -v ./... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| name: Go Lint | ||
|
|
||
| on: | ||
| - push | ||
|
|
||
| jobs: | ||
| go-lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: 1.20.x | ||
| - run: ./dev/go-lint.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: GoReleaser check | ||
|
|
||
| on: | ||
| push: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| goreleaser: | ||
| name: check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: 1.20.x | ||
| - name: Check GoReleaser config | ||
| uses: goreleaser/goreleaser-action@v5 | ||
Check warningCode scanning / Semgrep OSS Semgrep Finding: security-semgrep-rules.semgrep-rules.yaml.third-party-action-not-pinned-to-commit-sha
An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
|
||
| with: | ||
| version: latest | ||
| args: check | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,258 @@ | ||
| name: Build and Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - '*' | ||
|
|
||
| # There are two cases where this GitHub action will run: | ||
| # | ||
| # 1. We are releasing a new latest version for src-cli, as a major, minor, or patch | ||
| # update, for instance 4.0.2 -> 4.1.0, OR | ||
| # 2. We are releasing a new minor/patch version for an older major/minor version of | ||
| # src-cli, for instance if the latest version is 4.0.2 and we're releasing 3.43.3 | ||
| # | ||
| # In both cases, we want to run both goreleaser and npm to publish new versions in all the | ||
| # places we care about. For goreleaser publishing to Homebrew, we need to publish to | ||
| # different formulas depending on if we're case 1. or case 2, and neither goreleaser nor | ||
| # Homebrew has a good way of handling this automatically. In the case of the former (a new | ||
| # latest release), we must: | ||
| # | ||
| # 1. Copy the main formula in our Homebrew tap for the previous latest release to a | ||
| # versioned formula | ||
| # 2. Build and publish the new release to the main formula | ||
| # 3. Update the Homebrew symlink alias for the latest version | ||
| # | ||
| # In the case of the latter (a patch release for an older version), we only need to: | ||
| # | ||
| # 1. Build and publish the new release to a versioned Homebrew formula | ||
| # | ||
| # This action contains 5 jobs to accommodate both cases: | ||
| # | ||
| # release_type [always] - checks tags, determines if we're case 1. or case 2. | ||
| # goreleaser_pre [if case 1.] - copies the main formula to a versioned formula | ||
| # goreleaser [always] - runs tests, builds + publishes with goreleaser | ||
| # goreleaser_post [if case 1.] - updates symlink to latest version | ||
| # npm [always] - publishes to npm | ||
| jobs: | ||
| # release_type compares the current tag to the highest versioned tag available on the | ||
| # repo to determine if this release is for a new latest version or a patch of an older | ||
| # version. | ||
| release_type: | ||
| name: Determine release type | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| is_latest_version: ${{ env.is_latest_version }} | ||
| latest_tag: ${{ env.latest_tag }} | ||
| second_latest_tag: ${{ env.second_latest_tag }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set current tag, latest (highest version) tag, and second latest tag | ||
| # For latest and second latest tags, we can't use git tag --sort=version:refname | ||
| # because git doesn't have a concept of pre-release versions and thus mis-sorts | ||
| # versions like 4.0.0-rc.0 *after* 4.0.0. | ||
| run: | | ||
| echo "current_tag=${GITHUB_REF_NAME}" >> $GITHUB_ENV | ||
| echo "latest_tag=$(git tag | tr - \~ | sort --version-sort | tr \~ - | tail -1)" >> $GITHUB_ENV | ||
| echo "second_latest_tag=$(git tag | tr - \~ | sort --version-sort | tr \~ - | tail -2 | sed -n 1p)" >> $GITHUB_ENV | ||
| - name: Install semver | ||
| run: | | ||
| wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver | ||
| chmod +x /usr/local/bin/semver | ||
| - name: Compare tags | ||
| # If the current tag is also the latest (highest-versioned) tag, semver compare | ||
| # returns 0. If the current tag is older (i.e. it's a patch for an older version), | ||
| # semver compare will return -1. By definition, it should be impossible for the | ||
| # current tag to be newer than the latest tag unless somehow the current tag is | ||
| # not a real tag, but if for some reason this happens, it will be treated the same | ||
| # as if it were the latest. | ||
| run: | | ||
| if [ "$(semver compare ${{ env.current_tag }} ${{ env.latest_tag }})" -ge 0 ] | ||
| then | ||
| echo "is_latest_version=1" >> $GITHUB_ENV | ||
| else | ||
| echo "is_latest_version=0" >> $GITHUB_ENV | ||
| fi | ||
| - name: Log variables | ||
| run: | | ||
| echo "Version for this release: ${{ env.current_tag }}" | ||
| echo "Latest version: ${{ env.latest_tag }}" | ||
| if [[ ${{ env.is_latest_version }} == 1 ]] | ||
| then | ||
| echo "Releasing new latest version." | ||
| else | ||
| echo "Releasing patch of older version." | ||
| fi | ||
|
|
||
| # goreleaser_pre copies the main formula in our Homebrew tap for the previous latest | ||
| # release (second latest tag) to a versioned formula, so that it is preserved when | ||
| # goreleaser runs and overwrites the main formula for the latest build. | ||
| goreleaser_pre: | ||
| name: Copy previous release | ||
| runs-on: ubuntu-latest | ||
| needs: release_type | ||
| # Only run this step if we're releasing a new latest version. Creating a patch release | ||
| # does not touch the main formula. | ||
| if: needs.release_type.outputs.is_latest_version == 1 | ||
| steps: | ||
| - name: Set variables | ||
| run: | | ||
| echo "latest_tag=${{ needs.release_type.outputs.latest_tag }}" >> $GITHUB_ENV | ||
| echo "second_latest_tag=${{ needs.release_type.outputs.second_latest_tag }}" >> $GITHUB_ENV | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set versioning variables | ||
| run: | | ||
| echo "versioned_formula_file=Formula/src-cli@${{ env.second_latest_tag }}.rb" >> $GITHUB_ENV | ||
| echo "versioned_classname=SrcCliAT$(echo ${{ env.second_latest_tag }} | sed 's/\.//g')" >> $GITHUB_ENV | ||
| - name: Log variables | ||
| run: | | ||
| echo "Second latest tag (previous latest release): ${{ env.second_latest_tag }}" | ||
| echo "Versioned formula file: ${{ env.versioned_formula_file }}" | ||
| echo "Versioned classname: ${{ env.versioned_classname }}" | ||
| - name: Checkout Homebrew tap | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: sourcegraph/homebrew-src-cli | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.BOT_CROSS_REPO_PAT }} | ||
| - name: Copy main release formula file to versioned formula file | ||
| run: cp Formula/src-cli.rb ${{ env.versioned_formula_file }} | ||
| # Homebrew expects the name of the class in a versioned formula file to be of the | ||
| # format {Formula}AT{Major}{Minor}{Patch}, but the main formula classname is just | ||
| # {Formula}, so we manually update the name: SrcCli -> SrcCliAT### | ||
| - name: Rename formula classname | ||
| run: sed -i 's/class SrcCli/class ${{ env.versioned_classname }}/' ${{ env.versioned_formula_file }} | ||
| - name: Commit result | ||
| run: | | ||
| git config user.name sourcegraph-bot | ||
| git config user.email [email protected] | ||
| git add . | ||
| git commit --allow-empty -m "Copy previous release" | ||
| git push | ||
|
|
||
| # goreleaser runs tests before building, then uses goreleaser to publish to Homebrew and | ||
| # Docker Hub. | ||
| goreleaser: | ||
| name: Run goreleaser | ||
| runs-on: ubuntu-latest | ||
| needs: [release_type, goreleaser_pre] | ||
| # By default, this job will be skipped if either "needs" job is skipped. This tells | ||
| # GitHub actions to always run it, so long as the previous jobs that ran didn't fail. | ||
| if: | | ||
| always() && | ||
| (needs.release_type.result == 'success') && | ||
| (needs.goreleaser_pre.result == 'success' || needs.goreleaser_pre.result == 'skipped') | ||
| outputs: | ||
| # Passthrough from previous jobs so that they're also available in goreleaser_post | ||
| second_latest_tag: ${{ needs.release_type.outputs.second_latest_tag }} | ||
| latest_tag: ${{ needs.release_type.outputs.latest_tag }} | ||
| is_latest_version: ${{ env.is_latest_version }} | ||
| steps: | ||
| - name: Set variables | ||
| run: echo "is_latest_version=${{ needs.release_type.outputs.is_latest_version }}" >> $GITHUB_ENV | ||
| - name: Set config file | ||
| # These goreleaser config files are identical except for the brews.name template. | ||
| # Homebrew expects the main formula to be named one way, and versioned formulas to | ||
| # be named another, but goreleaser only allows us to specify a single template. | ||
| run: | | ||
| if [[ ${{ env.is_latest_version }} == 1 ]] | ||
| then | ||
| echo "config_file=.goreleaser.yml" >> $GITHUB_ENV | ||
| else | ||
| echo "config_file=.goreleaser-patch.yml" >> $GITHUB_ENV | ||
| fi | ||
| - name: Log config file | ||
| run: | | ||
| echo "Goreleaser config file: ${{ env.config_file }}" | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: 1.20.x | ||
| - run: go test ./... | ||
| - run: go test -race -v ./... | ||
| - run: echo "${DOCKER_PASSWORD}" | docker login -u=$DOCKER_USERNAME --password-stdin | ||
| env: | ||
| DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
| - name: Run GoReleaser | ||
| uses: goreleaser/goreleaser-action@v5 | ||
Check warningCode scanning / Semgrep OSS Semgrep Finding: security-semgrep-rules.semgrep-rules.yaml.third-party-action-not-pinned-to-commit-sha
An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
|
||
| with: | ||
| version: latest | ||
| # We use a different goreleaser config for releasing a new latest version vs. | ||
| # releasing a patch on an older version. For releasing the new latest version, | ||
| # we want to update the main (unversioned) Homebrew formula. For releasing a | ||
| # patch on an older version, we want to publish a new versioned formula and | ||
| # leave the main formula untouched. | ||
| args: release --clean --config=${{ env.config_file }} | ||
| env: | ||
| # Use separate access token, because we need a scope:repo token to publish the brew formula. | ||
| GITHUB_TOKEN: ${{ secrets.GH_PAT }} | ||
|
|
||
| # goreleaser_post updates the symlink name to refer to the new release version. The | ||
| # symlink enables users to install the latest src-cli with the versioned command: | ||
| # $ brew install sourcegraph/src-cli/[email protected] | ||
| # alongside the command to install it via the main formula: | ||
| # $ brew install sourcegraph/src-cli/src-cli | ||
| goreleaser_post: | ||
| name: Create new release version symlink | ||
| runs-on: ubuntu-latest | ||
| needs: goreleaser | ||
| # Only run this step if we're releasing a new latest version. Creating a patch release | ||
| # does not require updating the symlink. | ||
| if: needs.goreleaser.outputs.is_latest_version == 1 | ||
| steps: | ||
| - name: Set variables | ||
| run: | | ||
| echo "old_symlink_name=Aliases/src-cli@${{ needs.goreleaser.outputs.second_latest_tag }}" >> $GITHUB_ENV | ||
| echo "new_symlink_name=Aliases/src-cli@${{ needs.goreleaser.outputs.latest_tag }}" >> $GITHUB_ENV | ||
| - name: Log variables | ||
| run: | | ||
| echo "Old symlink: ${{ env.old_symlink_name }}" | ||
| echo "New symlink: ${{ env.new_symlink_name }}" | ||
| - name: Checkout Homebrew tap | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: sourcegraph/homebrew-src-cli | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.BOT_CROSS_REPO_PAT }} | ||
| - name: Replace symlink | ||
| run: mv ${{ env.old_symlink_name }} ${{ env.new_symlink_name }} | ||
| - name: Commit result | ||
| run: | | ||
| git config user.name sourcegraph-bot | ||
| git config user.email [email protected] | ||
| git add . | ||
| git commit -m "Update latest release symlink" | ||
| git push | ||
|
|
||
| # npm publishes the new version to the npm package registry | ||
| npm: | ||
| runs-on: ubuntu-latest | ||
| needs: goreleaser | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 16 | ||
| registry-url: 'https://registry.npmjs.org' | ||
| - run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | ||
| - run: echo "Releasing version ${{ env.version }}" | ||
| - run: yarn version --no-git-tag-version --new-version "${{ env.VERSION }}" | ||
| working-directory: npm-distribution | ||
| - run: npm publish --access public | ||
| working-directory: npm-distribution | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / Semgrep OSS
Semgrep Finding: security-semgrep-rules.semgrep-rules.yaml.third-party-action-not-pinned-to-commit-sha