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
campaigns: allow partial publishing of changesets #13476
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f52f466
campaigns: allow partial changeset publishing
LawnGnome 185390a
Update to the latest campaignutils.
LawnGnome c0b8ed2
Update schema/campaign_spec.schema.json
LawnGnome c25578a
Update generated file.
LawnGnome 58cad1a
Rename override to overridable.
LawnGnome 5fc7817
Add docs.
LawnGnome 25acbaf
Tweak CHANGELOG.
LawnGnome 71d24ed
Lead with a non-glob example.
LawnGnome 925c783
Fix docsite check warnings.
LawnGnome 5bd4438
Merge remote-tracking branch 'sourcegraph/main' into aharvey/template…
LawnGnome e86a527
Another go mod tidy run.
LawnGnome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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 |
---|---|---|
|
@@ -186,7 +186,7 @@ changesetTemplate: | |
branch: campaigns/update-rxjs | ||
commit: | ||
message: Update rxjs to 6.6.2 | ||
published: false | ||
published: true | ||
``` | ||
|
||
```yaml | ||
|
@@ -199,7 +199,10 @@ changesetTemplate: | |
author: | ||
name: Anna Wizard | ||
email: [email protected] | ||
published: true | ||
published: | ||
# Do not meddle in the affairs of wizards, for they are subtle and quick to anger. | ||
- git.istari.example/*: false | ||
- git.istari.example/anna/*: true | ||
``` | ||
|
||
## [`changesetTemplate.title`](#changesettemplate-title) | ||
|
@@ -238,8 +241,72 @@ changesetTemplate: | |
|
||
## [`changesetTemplate.published`](#changesettemplate-published) | ||
|
||
Whether to publish the changeset. | ||
Whether to publish the changeset. This may be a boolean value (ie `true` or `false`), or [an array to only publish some changesets within the campaign](#publishing-only-specific-changesets). | ||
|
||
An unpublished changeset can be previewed on Sourcegraph by any person who can view the campaign, but its commit, branch, and pull request aren't created on the code host. | ||
|
||
A published changeset results in a commit, branch, and pull request being created on the code host. | ||
|
||
### [Publishing only specific changesets](#publishing-only-specific-changesets) | ||
|
||
To publish only specific changesets within a campaign, an array of single-element objects can be provided. For example: | ||
|
||
```yaml | ||
published: | ||
- github.com/sourcegraph/sourcegraph: true | ||
- github.com/sourcegraph/src-cli: false | ||
``` | ||
|
||
Each key will be matched against the repository name using [glob](https://godoc.org/github.com/gobwas/glob#Compile) syntax. The [gobwas/glob library](https://godoc.org/github.com/gobwas/glob#Compile) is used for matching, with the key operators being: | ||
|
||
| Term | Meaning | | ||
|------|---------| | ||
| `*` | Match any sequence of characters | | ||
| `?` | Match any single character | | ||
| `[ab]` | Match either `a` or `b` | | ||
| `[a-z]` | Match any character between `a` and `z`, inclusive | | ||
| `{abc,def}` | Match either `abc` or `def` | | ||
|
||
If multiple entries match a repository, then the last entry will be used. For example, `github.com/a/b` will _not_ be published given this configuration: | ||
|
||
```yaml | ||
published: | ||
- github.com/a/*: true | ||
- github.com/*: false | ||
``` | ||
|
||
If no entries match, then the repository will not be published. To make the default true, add a wildcard entry as the last item in the array: | ||
|
||
```yaml | ||
published: | ||
- github.com/*: false | ||
- "*": true | ||
``` | ||
|
||
> NOTE: The standalone `"*"` is quoted in the key to avoid ambiguity in the YAML document. | ||
|
||
### Examples | ||
|
||
To publish all changesets created by a campaign: | ||
|
||
```yaml | ||
changesetTemplate: | ||
published: true | ||
``` | ||
|
||
To only publish changesets within the `sourcegraph` GitHub organization: | ||
|
||
```yaml | ||
changesetTemplate: | ||
published: | ||
- github.com/sourcegraph/*: true | ||
``` | ||
|
||
To publish all changesets that are not on GitLab: | ||
|
||
```yaml | ||
changesetTemplate: | ||
published: | ||
- gitlab.com/*: false | ||
- "*": true | ||
``` |
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
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 |
---|---|---|
|
@@ -130,9 +130,11 @@ name: hello-world | |
|
||
changesetTemplate: | ||
# ... | ||
published: false | ||
published: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What. the. hell. How did I manage to get that wrong? 😄 |
||
``` | ||
|
||
> NOTE: You can also [publish some of a campaign's changesets](campaign_spec_yaml_reference.md#publishing-only-specific-changesets). | ||
|
||
Then run the `src campaign preview` command again, or `src campaign apply` to immediately publish the changesets. | ||
|
||
In the Sourcegraph web UI you'll see a progress indicator for the changesets that are being published. Any errors will be shown, and you can retry publishing after you've resolved the problem by running `src campaign apply` again. You don't need to worry about multiple branches or pull requests being created when you retry, because the same branch name will be used. | ||
|
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this just mean "published: true"? Wouldn't the wildcard "*" need to be the first entry to set the default to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure I don't know what you're talking about.