Skip to content

Add connection type to ci config fields

Laura Montemayor requested to merge lm-update-w-connections-graphql into master

What does this MR do?

This is the backend MR for: !49983 (merged)

This MR changes the response structure for Ci::ConfigResolver, so it can include nodes via connection_type. This change is needed to clean up some technical debt in how the frontend consumes data, as we currently have two different approaches for dealing the same data.

Example query
query ($content: String!) {
  ciConfig(content: $content) {
    stages {
      nodes {
        name
        groups {
          nodes {
            size
            name
            jobs {
              nodes {
                name
                needs {
                  nodes {
                    name
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

{ "content": "rspec 0 1:\n stage: build\n script: \"rake spec\"\n needs: []\n\nrspec 0 2:\n stage: build\n script: \"rake spec\"\n needs: []\n\nspinach:\n stage: build\n script: \"rake spinach\"\n needs: []\n\ndocker:\n stage: test\n script: \"curl http://dockerhub/URL\"\n needs: [spinach, rspec 0 1]\n" }

Response
{
  "data": {
    "ciConfig": {
      "stages": {
        "nodes": [
          {
            "name": "build",
            "groups": {
              "nodes": [
                {
                  "size": 2,
                  "name": "rspec",
                  "jobs": {
                    "nodes": [
                      {
                        "name": "rspec 0 1",
                        "needs": {
                          "nodes": []
                        }
                      },
                      {
                        "name": "rspec 0 2",
                        "needs": {
                          "nodes": []
                        }
                      }
                    ]
                  }
                },
                {
                  "size": 1,
                  "name": "spinach",
                  "jobs": {
                    "nodes": [
                      {
                        "name": "spinach",
                        "needs": {
                          "nodes": []
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "name": "test",
            "groups": {
              "nodes": [
                {
                  "size": 1,
                  "name": "docker",
                  "jobs": {
                    "nodes": [
                      {
                        "name": "docker",
                        "needs": {
                          "nodes": [
                            {
                              "name": "spinach"
                            },
                            {
                              "name": "rspec 0 1"
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Does this MR meet the acceptance criteria?

Conformity

#293693 (closed)

Edited by Laura Montemayor

Merge request reports