Skip to content

Commit

Permalink
codeintel: add an --associated-index-id flag for autoindexer usage (#430
Browse files Browse the repository at this point in the history
)

* accept and pass associated-index-id flag

* bump codeintelutils version

* bump codeintelutils version again

* mark 'upload-route' flag "for internal use only"
  • Loading branch information
gbrik authored Jan 18, 2021
1 parent 761c534 commit b7ed8a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cmd/src/lsif_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Examples:
uploadRoute *string
rawVerbosity *int
verbosity lsifUploadVerbosity
associatedIndexID *int
}

flagSet := flag.NewFlagSet("upload", flag.ExitOnError)
Expand All @@ -69,8 +70,9 @@ Examples:
flags.noProgress = flagSet.Bool("no-progress", false, `Do not display a progress bar.`)
flags.maxPayloadSizeMb = flagSet.Int("max-payload-size", 100, `The maximum upload size (in megabytes). Indexes exceeding this limit will be uploaded over multiple HTTP requests.`)
flags.ignoreUploadFailures = flagSet.Bool("ignore-upload-failure", false, `Exit with status code zero on upload failure.`)
flags.uploadRoute = flagSet.String("upload-route", "/.api/lsif/upload", "The path of the upload route.")
flags.uploadRoute = flagSet.String("upload-route", "/.api/lsif/upload", "The path of the upload route. For internal use only.")
flags.rawVerbosity = flagSet.Int("trace", 0, "-trace=0 shows no logs; -trace=1 shows requests and response metadata; -trace=2 shows headers, -trace=3 shows response body")
flags.associatedIndexID = flagSet.Int("associated-index-id", -1, "ID of the associated index record for this upload. For internal use only.")

parseAndValidateFlags := func(args []string) error {
flagSet.Parse(args)
Expand Down Expand Up @@ -160,6 +162,10 @@ Examples:
fmt.Println(argsString)
}

if *flags.associatedIndexID < 0 {
flags.associatedIndexID = nil
}

return nil
}

Expand All @@ -180,6 +186,7 @@ Examples:
GitHubToken: *flags.gitHubToken,
File: *flags.file,
MaxPayloadSizeBytes: *flags.maxPayloadSizeMb * 1000 * 1000,
AssociatedIndexID: flags.associatedIndexID,
MaxRetries: 10,
RetryInterval: time.Millisecond * 250,
UploadProgressEvents: make(chan codeintelutils.UploadProgressEvent),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/pkg/errors v0.9.1
github.com/sourcegraph/campaignutils v0.0.0-20201124055807-2f9cfa9317e2
github.com/sourcegraph/codeintelutils v0.0.0-20210113171425-9ec641b48a8e
github.com/sourcegraph/codeintelutils v0.0.0-20210118231003-6698e102a8a1
github.com/sourcegraph/go-diff v0.6.1
github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ github.com/sourcegraph/campaignutils v0.0.0-20201124055807-2f9cfa9317e2 h1:MJu/6
github.com/sourcegraph/campaignutils v0.0.0-20201124055807-2f9cfa9317e2/go.mod h1:xm6i78Mk2t4DBLQDqEFc/3x6IPf7yYZCgbNaTQGhJHA=
github.com/sourcegraph/codeintelutils v0.0.0-20210113171425-9ec641b48a8e h1:PdNc6fH0HHQ5xbnCwPkHuFdVCofQilFm9gG40fEQKms=
github.com/sourcegraph/codeintelutils v0.0.0-20210113171425-9ec641b48a8e/go.mod h1:HplI8gRslTrTUUsSYwu28hSOderix7m5dHNca7xBzeo=
github.com/sourcegraph/codeintelutils v0.0.0-20210118225004-6e6891d301ca h1:YotYereMYoAX/Q/2OS3zn2MJKgVbVdzQU65PRiaGHYE=
github.com/sourcegraph/codeintelutils v0.0.0-20210118225004-6e6891d301ca/go.mod h1:HplI8gRslTrTUUsSYwu28hSOderix7m5dHNca7xBzeo=
github.com/sourcegraph/codeintelutils v0.0.0-20210118231003-6698e102a8a1 h1:IPWruUo+BwPJqCHBVgjKxK6zTxMkOhwCSYpQ/jZHG/w=
github.com/sourcegraph/codeintelutils v0.0.0-20210118231003-6698e102a8a1/go.mod h1:HplI8gRslTrTUUsSYwu28hSOderix7m5dHNca7xBzeo=
github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ=
github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs=
github.com/sourcegraph/jsonx v0.0.0-20200629203448-1a936bd500cf h1:oAdWFqhStsWiiMP/vkkHiMXqFXzl1XfUNOdxKJbd6bI=
Expand Down

0 comments on commit b7ed8a5

Please sign in to comment.