Allow to store null variables
What does this MR do?
It seems that I was over-eager assuming that : null
variables will be rejected by Runner in json payload, but it proven to not be true and to cause additional problems: https://gitlab.com/gitlab-org/gitlab-ce/issues/54379
This test proves me wrong:
package main
import (
"encoding/json"
"fmt"
"log"
)
type JobVariable struct {
Key string `json:"key"`
Value string `json:"value"`
}
type JobResponse struct {
Variables []JobVariable `json:"variables"`
}
func main() {
var r JobResponse
body := `{"variables":[{"key":"KEY","value":null}]}`
err := json.Unmarshal([]byte(body), &r)
if err != nil {
log.Fatalln(err)
}
saved, err := json.Marshal(&r)
if err != nil {
log.Fatalln(err)
}
fmt.Print(string(saved))
}
What are the relevant issue numbers?
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54379
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.