Add schema for importing existing changesets (#12374)

This commit is contained in:
Erik Seliger 2020-08-07 14:02:49 +02:00 committed by GitHub
parent 1e2ed4525b
commit b3a1017f8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 0 deletions

View File

@ -85,6 +85,30 @@
}
}
},
"importChangesets": {
"type": "array",
"description": "Import existing changesets on code hosts.",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["repository", "externalIDs"],
"properties": {
"repository": {
"type": "string",
"description": "The repository name as configured on your Sourcegraph instance."
},
"externalIDs": {
"type": "array",
"description": "The changesets to import from the code host. For GitHub this is the PR number, for GitLab this is the MR number, for Bitbucket Server this is the PR number.",
"uniqueItems": true,
"items": {
"oneOf": [{ "type": "string" }, { "type": "integer" }]
},
"examples": [120, "120"]
}
}
}
},
"changesetTemplate": {
"type": "object",
"description": "A template describing how to create (and update) changesets with the file changes produced by the command steps.",

View File

@ -90,6 +90,30 @@ const CampaignSpecSchemaJSON = `{
}
}
},
"importChangesets": {
"type": "array",
"description": "Import existing changesets on code hosts.",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["repository", "externalIDs"],
"properties": {
"repository": {
"type": "string",
"description": "The repository name as configured on your Sourcegraph instance."
},
"externalIDs": {
"type": "array",
"description": "The changesets to import from the code host. For GitHub this is the PR number, for GitLab this is the MR number, for Bitbucket Server this is the PR number.",
"uniqueItems": true,
"items": {
"oneOf": [{ "type": "string" }, { "type": "integer" }]
},
"examples": [120, "120"]
}
}
}
},
"changesetTemplate": {
"type": "object",
"description": "A template describing how to create (and update) changesets with the file changes produced by the command steps.",

View File

@ -317,6 +317,8 @@ type CampaignSpec struct {
ChangesetTemplate *ChangesetTemplate `json:"changesetTemplate,omitempty"`
// Description description: The description of the campaign.
Description string `json:"description,omitempty"`
// ImportChangesets description: Import existing changesets on code hosts.
ImportChangesets []*ImportChangesets `json:"importChangesets,omitempty"`
// Name description: The name of the campaign, which is unique among all campaigns in the namespace. A campaign's name is case-preserving.
Name string `json:"name"`
// On description: The set of repositories (and branches) to run the campaign on, specified as a list of search queries (that match repositories) and/or specific repositories.
@ -725,6 +727,13 @@ func (v *IdentityProvider) UnmarshalJSON(data []byte) error {
return fmt.Errorf("tagged union type must have a %q property whose value is one of %s", "type", []string{"oauth", "username", "external"})
}
type ImportChangesets struct {
// ExternalIDs description: The changesets to import from the code host. For GitHub this is the PR number, for GitLab this is the MR number, for Bitbucket Server this is the PR number.
ExternalIDs []interface{} `json:"externalIDs"`
// Repository description: The repository name as configured on your Sourcegraph instance.
Repository string `json:"repository"`
}
// Log description: Configuration for logging and alerting, including to external services.
type Log struct {
// Sentry description: Configuration for Sentry