Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
{
2021-07-06 13:04:02 +00:00
"$id" : "batch_spec.schema.json#" ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"$schema" : "http://json-schema.org/draft-07/schema#" ,
2021-03-09 09:07:11 +00:00
"title" : "BatchSpec" ,
"description" : "A batch specification, which describes the batch change and what kinds of changes to make (or what existing changesets to track)." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"type" : "object" ,
"additionalProperties" : false ,
"required" : [ "name" ] ,
"properties" : {
2024-07-09 08:35:01 +00:00
"version" : {
"type" : "number" ,
"description" : "The version of the batch spec schema. Defaults to 1." ,
"enum" : [ 1 , 2 ]
} ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"name" : {
"type" : "string" ,
2021-03-09 09:07:11 +00:00
"description" : "The name of the batch change, which is unique among all batch changes in the namespace. A batch change's name is case-preserving." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"pattern" : "^[\\w.-]+$"
} ,
"description" : {
"type" : "string" ,
2021-03-09 09:07:11 +00:00
"description" : "The description of the batch change."
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
} ,
"on" : {
2021-10-11 13:53:05 +00:00
"type" : [ "array" , "null" ] ,
2021-03-09 09:07:11 +00:00
"description" : "The set of repositories (and branches) to run the batch change on, specified as a list of search queries (that match repositories) and/or specific repositories." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"items" : {
"title" : "OnQueryOrRepository" ,
"oneOf" : [
{
"title" : "OnQuery" ,
"type" : "object" ,
2021-03-09 09:07:11 +00:00
"description" : "A Sourcegraph search query that matches a set of repositories (and branches). Each matched repository branch is added to the list of repositories that the batch change will be run on." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"additionalProperties" : false ,
"required" : [ "repositoriesMatchingQuery" ] ,
"properties" : {
"repositoriesMatchingQuery" : {
"type" : "string" ,
"description" : "A Sourcegraph search query that matches a set of repositories (and branches). If the query matches files, symbols, or some other object inside a repository, the object's repository is included." ,
"examples" : [ "file:README.md" ]
}
}
} ,
{
"title" : "OnRepository" ,
"type" : "object" ,
2021-03-09 09:07:11 +00:00
"description" : "A specific repository (and branch) that is added to the list of repositories that the batch change will be run on." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"additionalProperties" : false ,
"required" : [ "repository" ] ,
"properties" : {
"repository" : {
"type" : "string" ,
"description" : "The name of the repository (as it is known to Sourcegraph)." ,
"examples" : [ "github.com/foo/bar" ]
} ,
"branch" : {
2021-12-08 02:22:35 +00:00
"description" : "The repository branch to propose changes to. If unset, the repository's default branch is used. If this field is defined, branches cannot be." ,
"type" : "string"
} ,
"branches" : {
"description" : "The repository branches to propose changes to. If unset, the repository's default branch is used. If this field is defined, branch cannot be." ,
"type" : "array" ,
"items" : {
"type" : "string"
}
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
}
2021-12-08 02:22:35 +00:00
} ,
"$comment" : "This is a convoluted way of saying either `branch` or `branches` can be provided, but not both at once, and neither are required." ,
"anyOf" : [
{
"oneOf" : [
{
"required" : [ "branch" ]
} ,
{
"required" : [ "branches" ]
}
]
} ,
{
"not" : {
"required" : [ "branch" , "branches" ]
}
}
]
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
}
]
}
} ,
2021-01-29 13:42:19 +00:00
"workspaces" : {
2021-10-11 13:53:05 +00:00
"type" : [ "array" , "null" ] ,
2021-01-29 13:42:19 +00:00
"description" : "Individual workspace configurations for one or more repositories that define which workspaces to use for the execution of steps in the repositories." ,
"items" : {
"title" : "WorkspaceConfiguration" ,
"type" : "object" ,
"description" : "Configuration for how to setup workspaces in repositories" ,
"additionalProperties" : false ,
"required" : [ "rootAtLocationOf" ] ,
"properties" : {
"rootAtLocationOf" : {
"type" : "string" ,
"description" : "The name of the file that sits at the root of the desired workspace." ,
"examples" : [ "package.json" , "go.mod" , "Gemfile" , "Cargo.toml" , "README.md" ]
} ,
"in" : {
"type" : "string" ,
"description" : "The repositories in which to apply the workspace configuration. Supports globbing." ,
"examples" : [ "github.com/sourcegraph/src-cli" , "github.com/sourcegraph/*" ]
2021-02-12 13:35:53 +00:00
} ,
"onlyFetchWorkspace" : {
"type" : "boolean" ,
"description" : "If this is true only the files in the workspace (and additional .gitignore) are downloaded instead of an archive of the full repository." ,
"default" : false
2021-01-29 13:42:19 +00:00
}
}
}
} ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"steps" : {
2021-10-11 13:53:05 +00:00
"type" : [ "array" , "null" ] ,
2021-03-09 09:07:11 +00:00
"description" : "The sequence of commands to run (for each repository branch matched in the `on` property) to produce the workspace changes that will be included in the batch change." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"items" : {
"title" : "Step" ,
"type" : "object" ,
2021-03-09 09:07:11 +00:00
"description" : "A command to run (as part of a sequence) in a repository branch to produce the required changes." ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"additionalProperties" : false ,
"required" : [ "run" , "container" ] ,
"properties" : {
"run" : {
"type" : "string" ,
"description" : "The shell command to run in the container. It can also be a multi-line shell script. The working directory is the root directory of the repository checkout."
} ,
"container" : {
"type" : "string" ,
"description" : "The Docker image used to launch the Docker container in which the shell command is run." ,
"examples" : [ "alpine:3" ]
} ,
2021-01-14 14:06:06 +00:00
"outputs" : {
2021-10-11 13:53:05 +00:00
"type" : [ "object" , "null" ] ,
2021-01-14 14:06:06 +00:00
"description" : "Output variables of this step that can be referenced in the changesetTemplate or other steps via outputs.<name-of-output>" ,
"additionalProperties" : {
2021-10-11 13:53:05 +00:00
"title" : "OutputVariable" ,
2021-01-14 14:06:06 +00:00
"type" : "object" ,
"required" : [ "value" ] ,
"properties" : {
"value" : {
"type" : "string" ,
"description" : "The value of the output, which can be a template string." ,
"examples" : [ "hello world" , "${{ step.stdout }}" , "${{ repository.name }}" ]
} ,
"format" : {
"type" : "string" ,
"description" : "The expected format of the output. If set, the output is being parsed in that format before being stored in the var. If not set, 'text' is assumed to the format." ,
"enum" : [ "json" , "yaml" , "text" ]
}
}
}
} ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"env" : {
2020-11-24 06:18:06 +00:00
"description" : "Environment variables to set in the step environment." ,
"oneOf" : [
2021-10-11 13:53:05 +00:00
{
"type" : "null"
} ,
2020-11-24 06:18:06 +00:00
{
"type" : "object" ,
"description" : "Environment variables to set in the step environment." ,
"additionalProperties" : {
"type" : "string"
}
} ,
{
"type" : "array" ,
"items" : {
"oneOf" : [
{
"type" : "string" ,
"description" : "An environment variable to set in the step environment: the value will be passed through from the environment src is running within."
} ,
{
"type" : "object" ,
2021-11-11 12:26:27 +00:00
"description" : "An environment variable to set in the step environment: the key is used as the environment variable name and the value as the value." ,
2021-05-05 12:28:51 +00:00
"additionalProperties" : {
"type" : "string"
} ,
2020-11-24 06:18:06 +00:00
"minProperties" : 1 ,
"maxProperties" : 1
}
]
}
}
]
2020-10-29 08:22:33 +00:00
} ,
"files" : {
2021-10-11 13:53:05 +00:00
"type" : [ "object" , "null" ] ,
2020-10-29 08:22:33 +00:00
"description" : "Files that should be mounted into or be created inside the Docker container." ,
2021-05-05 12:28:51 +00:00
"additionalProperties" : {
"type" : "string"
}
} ,
"if" : {
2021-12-08 02:22:35 +00:00
"oneOf" : [
{
"type" : "boolean"
} ,
{
"type" : "string"
} ,
{
"type" : "null"
}
] ,
2021-05-05 12:28:51 +00:00
"description" : "A condition to check before executing steps. Supports templating. The value 'true' is interpreted as true." ,
"examples" : [
"true" ,
"${{ matches repository.name \"github.com/my-org/my-repo*\" }}" ,
"${{ outputs.goModFileExists }}" ,
"${{ eq previous_step.stdout \"success\" }}"
]
2022-06-07 17:38:21 +00:00
} ,
"mount" : {
"description" : "Files that are mounted to the Docker container." ,
"type" : [ "array" , "null" ] ,
"items" : {
"type" : "object" ,
"additionalProperties" : false ,
"required" : [ "path" , "mountpoint" ] ,
"properties" : {
"path" : {
"type" : "string" ,
"description" : "The path on the local machine to mount. The path must be in the same directory or a subdirectory of the batch spec." ,
"examples" : [ "local/path/to/file.text" , "local/path/to/directory" ]
} ,
"mountpoint" : {
"type" : "string" ,
"description" : "The path in the container to mount the path on the local machine to." ,
"examples" : [ "path/to/file.txt" , "path/to/directory" ]
}
}
}
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
}
}
}
} ,
2020-12-11 09:26:42 +00:00
"transformChanges" : {
2021-10-11 13:53:05 +00:00
"type" : [ "object" , "null" ] ,
2020-12-11 09:26:42 +00:00
"description" : "Optional transformations to apply to the changes produced in each repository." ,
"additionalProperties" : false ,
"properties" : {
"group" : {
2021-10-11 13:53:05 +00:00
"type" : [ "array" , "null" ] ,
2020-12-11 09:26:42 +00:00
"description" : "A list of groups of changes in a repository that each create a separate, additional changeset for this repository, with all ungrouped changes being in the default changeset." ,
2021-10-11 13:53:05 +00:00
"items" : {
"title" : "TransformChangesGroup" ,
"type" : "object" ,
"additionalProperties" : false ,
"required" : [ "directory" , "branch" ] ,
"properties" : {
"directory" : {
"type" : "string" ,
"description" : "The directory path (relative to the repository root) of the changes to include in this group." ,
"minLength" : 1
} ,
"branch" : {
"type" : "string" ,
"description" : "The branch on the repository to propose changes to. If unset, the repository's default branch is used." ,
"minLength" : 1
} ,
"repository" : {
"type" : "string" ,
"description" : "Only apply this transformation in the repository with this name (as it is known to Sourcegraph)." ,
"examples" : [ "github.com/foo/bar" ]
}
2020-12-11 09:26:42 +00:00
}
}
}
}
} ,
2020-08-07 12:02:49 +00:00
"importChangesets" : {
2021-10-11 13:53:05 +00:00
"type" : [ "array" , "null" ] ,
2020-08-07 12:02:49 +00:00
"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" : {
2021-10-11 13:53:05 +00:00
"type" : [ "array" , "null" ] ,
2020-08-07 12:02:49 +00:00
"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" : {
2021-05-05 12:28:51 +00:00
"oneOf" : [
{
"type" : "string"
} ,
{
"type" : "integer"
}
]
2020-08-07 12:02:49 +00:00
} ,
"examples" : [ 120 , "120" ]
}
}
}
} ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"changesetTemplate" : {
"type" : "object" ,
"description" : "A template describing how to create (and update) changesets with the file changes produced by the command steps." ,
"additionalProperties" : false ,
2021-06-30 16:50:30 +00:00
"required" : [ "title" , "branch" , "commit" ] ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"properties" : {
2021-02-12 13:35:53 +00:00
"title" : {
"type" : "string" ,
"description" : "The title of the changeset."
} ,
"body" : {
"type" : "string" ,
"description" : "The body (description) of the changeset."
} ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"branch" : {
"type" : "string" ,
"description" : "The name of the Git branch to create or update on each repository with the changes."
} ,
2023-05-31 17:19:07 +00:00
"fork" : {
"type" : "boolean" ,
"description" : "Whether to publish the changeset to a fork of the target repository. If omitted, the changeset will be published to a branch directly on the target repository, unless the global `batches.enforceFork` setting is enabled. If set, this property will override any global setting."
} ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"commit" : {
2020-07-23 07:13:47 +00:00
"title" : "ExpandedGitCommitDescription" ,
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
"type" : "object" ,
"description" : "The Git commit to create with the changes." ,
"additionalProperties" : false ,
"required" : [ "message" ] ,
"properties" : {
"message" : {
"type" : "string" ,
"description" : "The Git commit message."
2020-09-09 18:30:45 +00:00
} ,
"author" : {
"title" : "GitCommitAuthor" ,
"type" : "object" ,
"description" : "The author of the Git commit." ,
"additionalProperties" : false ,
"required" : [ "name" , "email" ] ,
"properties" : {
"name" : {
"type" : "string" ,
"description" : "The Git commit author name."
} ,
"email" : {
"type" : "string" ,
"format" : "email" ,
"description" : "The Git commit author email."
}
}
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
}
}
} ,
"published" : {
2021-06-30 16:50:30 +00:00
"description" : "Whether to publish the changeset. An unpublished changeset can be previewed on Sourcegraph by any person who can view the batch change, 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. If omitted, the publication state is controlled from the Batch Changes UI." ,
2020-10-01 18:48:36 +00:00
"oneOf" : [
2021-10-11 13:53:05 +00:00
{
"type" : "null"
} ,
2020-10-01 18:48:36 +00:00
{
2021-05-05 12:28:51 +00:00
"oneOf" : [
{
"type" : "boolean"
} ,
{
"type" : "string" ,
"pattern" : "^draft$"
}
] ,
2021-03-09 09:07:11 +00:00
"description" : "A single flag to control the publishing state for the entire batch change."
2020-10-01 18:48:36 +00:00
} ,
{
"type" : "array" ,
"description" : "A list of glob patterns to match repository names. In the event multiple patterns match, the last matching pattern in the list will be used." ,
"items" : {
"type" : "object" ,
"description" : "An object with one field: the key is the glob pattern to match against repository names; the value will be used as the published flag for matching repositories." ,
2020-10-15 23:08:58 +00:00
"additionalProperties" : {
2021-05-05 12:28:51 +00:00
"oneOf" : [
{
"type" : "boolean"
} ,
{
"type" : "string" ,
"pattern" : "^draft$"
}
]
2020-10-15 23:08:58 +00:00
} ,
2020-10-01 18:48:36 +00:00
"minProperties" : 1 ,
"maxProperties" : 1
}
}
]
Prepare codebase for new campaigns workflow (#11675)
* WIP: New campaigns workflow
* Remove old UI for switch to new campaigns workflow (#11891)
* Add a basic implementation of the applyCampaign mutation (#11934)
* update campaigns docs to reflect new flow (#11972)
* update GraphQL API to remove unneeded namespace param, add applyCampaign test (#11982)
* add applyCampaign resolver test, temporarily un-implement createCampaign
The createCampaign mutation is strictly less powerful than applyCampaign, and it adds needless complexity to implement createCampaign now, especially since we'll be changing the impl of applyCampaign a lot. So, let's remove the createCampaign impl for now.
Then we also need to change the resolver test from testing createCampaign to testing applyCampaign.
* remove unneeded namespace param from createCampaign and applyCampaign mutations
The namespace is immutably stored in the campaign spec, which is also provided as a param.
* Implement moveCampaign mutation (#12049)
* Fix campaigns web code after rebase
* Implement ChangesetSpec resolver and validation of specs (#12092)
* Implement ChangesetSpec.Description in resolver and data layer
* Add ChangesetSpec/CampaignSpec schema and Validate() method
* Validate ChangesetSpec against schema on create
* Validate CampaignSpec against schema
* Allow YAML as CampaignSpec input (caveat: 'on' needs to be quoted)
* Fix critical whitespace error
* Fix CampaignSpec.ParsedInput response
* Remove debug log statement
* Remove TODO comment
* Fix indentation in raw specs for testing
* Run prettier
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Use fork of ghodss/yaml to use 'on' as key in CampaignSpec (#12153)
As we noticed last week: we can't use `on` as a key in a `CampaignSpec`
because `yaml.YAMLToJSON` would convert that `on` into a `true` and that
in turn would fail when validated.
The solution here is to use a custom fork of `ghodss/yaml` that allows
passing in a custom unmarshal-function which does _not_ do the
conversion.
The function we're passing in comes from the yaml.v3 library which
changed its behavior when parsing boolean values (see
https://github.com/ghodss/yaml/pull/65).
We lose the ability to use `YAMLToJSONStrict` since that only works with
yaml.v2, but yaml.v3 already warns about duplicated keys and the JSON
schema validation gives us enough of a safety net for the rest.
* Remove duplication in ChangesetSpec/CampaignSpec.UnmarshalValidate (#12156)
* Remove repositoryDiffs (#12205)
* Remove openChangesets resolver (#12209)
We don't need it for the new UI anymore, so reducing the headache of maintaining it.
* Implement minimal resolvers to incorporate schema changes (#12215)
* Use same changeset resolver for hidden and visible changesets (#12221)
* Fix compilation after rebase
* Delete expired CampaignSpecs and ChangesetSpecs (#12210)
* Fix compilation after rebase
* Delete expired Campaign/ChangesetSpecs
* Return correct ExpiresAt in Campaign/ChangesetSpec resolvers
* Clean up tests for spec expiry
* Remove unneeded Truncate
Co-authored-by: Erik Seliger <erikseliger@me.com>
* Remove unused dependency (#12245)
* Implement placeholders for status and preview API (#12226)
* Remove store.GetRepoIDsForFailedChangesetJobs (#12323)
This was a left-over from the last PR that removed some functionality.
I know that there's a lot more code that's technically unused now, but
this one stood out since it had the really specific usecase of loading
error messages for a campaign.
* Another set of small follow-ups after introducing ExternalChangesetState (#12330)
* Add a ChangesetState.Valid() method
* Rename test method to reflect name of method under test
* Update naming and un-export methods
* Implement missing bits in CampaignSpec/ChangesetSpec resolvers (#12247)
* Fix intendation of query in test
* Implement CampaignSpec.ViewerCanAdminister
* Add safety-check to ChangesetSpecDescription.Diff method
* Clean up repository permissions test
* Implement rest of ChangesetSpec and CampaignSpec resolvers
* Add options to CountChangesetSpecsOpts
* Implement changesetSpecConnectionResolver
* Reduce test data after reducing test cases
* Change type checks on ChangesetSpecDescription
* Query __typename in test to make sure we get the right response
* Use same repo query pattern in ChangesetResolver as in changesetSpecResolver
* Implement the after param for changesetSpecs connection
* Check for permissions in applyCampaign and moveCampaign
* Add a test for ChangesetSpec.Description.Diff
* Remove isHidden filter
* Do not yield ChangesetSpec if repo is (soft-)deleted
* Fix rebase gone wrong
* Check namespace perms in CreateCampaignSpec/MoveCampaign (#12362)
(This is part #11675 and the new workflow)
Before this, every user could create a campaign spec in any org or user
namespace. And the same was true for moveCampaign: a user could move a
campaign into namespace they wanted.
This changes both implementations in the service layer to check for the
permissions of the current user (saved in the ctx):
1. If it's a site admin, they can create/move things in any namespace.
2. If not and the target namespace is an org, we check for org
membership.
3. If not and the target namespace is a user, we check that it's the
same as the current user.
* Make schema for env more strict to only accept strings (#12335)
Environment variables can only be strings, so we shouldn't accept int, bool etc.
* Drop old campaigns tables and add missing columns (#12388)
* Drop old campaigns tables and add missing columns
This drops the following tables:
- changeset_jobs
- patches
- patch_sets
Why drop them? Since we decided we're going to migrate existing
campaigns into read-only versions and that we don't want to keep working
state (changeset_jobs) around, it doesn't make sense to keep the tables.
Why keep empty tables?
So, this removes the tables and all the code that depends on them.
It also does two other things:
- Add a `changeset_spec_id` column to `changesets` (that's not yet read/written to in the `campaigns.Store`)
- Add three `diff_stat_*` columns to `changeset_specs`, populate them when creating a new `ChangesetSpec` and reading/writing them in the `campaigns.Store`.
Why? Because I don't want to write another migration that adds diff
stats to changeset specs in case those were created between the
introduction of changeset specs and us adding the fields.
* Do not show changeset count in frontend
* Add notice to WIP campaigns docs that they're WIP (#12393)
* Campaign frontend cleanup work (#12256)
Co-authored-by: Quinn Slack <sqs@sourcegraph.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
2020-07-22 12:59:35 +00:00
}
}
}
}
}