Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codeintel: add an --associated-index-id flag for autoindexer usage #430

Merged
merged 4 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

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