When using a importChangesets campaign, omitting on and steps is legal: https://docs.sourcegraph.com/campaigns/how-tos/tracking_existing_changesets
If the keys are simply omitted in the YAML, applying the spec works without a hitch. However, when these are set to null:
โ Error:
parsing campaign spec: 2 errors occurred:
* on: Invalid type. Expected: array, given: null
* steps: Invalid type. Expected: array, given: null
This is a bit of an edge case, because I'm not sure how many people will try to do this:
null in values that do not exist: query getCampaigns($namespace:String!) {
organization(name:$namespace) {
campaigns(first:99) {
nodes { name currentSpec { parsedInput } }
}
}
}
importChangesets)src campaign apply it. Without replacing null values, this attempts to apply something like:name: release-sourcegraph-3.21.0
description: "[TEST] Track publishing of [email protected]"
on: null
steps: null
importChangesets:
- ...
changesetTemplate:
title: ""
body: ""
branch: ""
commit:
message: ""
published: false
from the original spec:
name: release-sourcegraph-3.21.0
description: "[TEST] Track publishing of [email protected]"
importChangesets:
- ...
and produces the error above
also see https://github.com/sourcegraph/sourcegraph/pull/15032
I think for updating the campaign spec, rawSpec instead of parsedInput should be used. I think we should still not add null fields, since it's not the same as not defined, from a yaml/json perspective.
originalInput (the correct spelling of rawSpec) worked nicely for the particular use-case described in the issue: https://github.com/sourcegraph/sourcegraph/pull/15032/commits/ea4f1a9777f12fa3fd25eeb3f9c8885ea5119f06
Sounds like moving to originalInput worked, so shall we close this issue? Or is there another part to this that I am missing?