Deploy with Graph Artifacts

Integrate graph artifacts into CI/CD pipelines and Kubernetes deployments

Requires ≥ Router v2.7.0

GraphOS supports two approaches for deploying with graph artifacts. Choose the one that fits your infrastructure:

  • CI/CD pipeline: Your pipeline fetches the artifact URI from the GraphOS Platform API and writes it to the router's configuration at deploy time. This approach works with any infrastructure.

  • Apollo GraphOS Operator for Kubernetes: If you run on Kubernetes, you can declare the desired artifact reference in a Supergraph custom resource and let the Operator manage the router deployment. This replaces manual environment variable management in your pipeline scripts.

Deploy with your CI/CD pipeline

To integrate graph artifacts into your CI/CD workflow, in your pipeline, programmatically fetch the latest graph artifact's reference URI using the GraphOS Platform API, then save it to your router's configuration as part of deployment.

  1. Fetch the graph artifact history of a variant using the GraphOS Platform API.

    GraphQL
    GetGraphArtifactHistory
    1# Fetch the latest Graph Artifact URIs for a specific graph variant
    2query GetGraphArtifactHistory($graphId: ID!, $variantName: String!) {
    3  graph(id: $graphId) {
    4    variant(name: $variantName) {
    5      launchHistory {
    6        graphArtifact {
    7          completedAt
    8          status
    9          location {
    10            uri
    11          }
    12        }
    13      }
    14    }
    15  }
    16}

    Specify your graph ID and variant name for the query:

    JSON
    Variables
    1{
    2  "graphId": "my-graph-id",
    3  "variantName": "production"
    4}

    In the response, find the graphArtifact with the latest completedAt value and a status of GRAPH_ARTIFACT_COMPLETED. The value of its location.uri field is the most recent artifact reference. Write the URI to your router's configuration during deployment to make sure it runs that specific schema version. Example response:

    JSON
    ExampleResponse
    1{
    2  "data": {
    3    "graph": {
    4      "variant": {
    5        "launchHistory": [
    6          {
    7            "graphArtifact": {
    8              "completedAt": "2025-09-30T19:22:02.684293Z",
    9              "status": "GRAPH_ARTIFACT_COMPLETED",
    10              "location": {
    11                "uri": "artifact.api.apollographql.com/my-graph-id@sha256:157be07b693c50376853f3cfaf4abb9fa61c9996f2f10912ffa1d0e92361b461"
    12              }
    13            }
    14          },
    15          {
    16            "graphArtifact": {
    17              "completedAt": "2025-09-29T17:12:43.036755Z",
    18              "status": "GRAPH_ARTIFACT_COMPLETED",
    19              "location": {
    20                "uri": "artifact.api.apollographql.com/my-graph-id@sha256:613750b0cf4f9fed76af65cf79d7be21bb5262de65e011dc469d51755c69ed49"
    21              }
    22            }
    23          }
    24        ]
    25      }
    26    }
    27  }
    28}
  2. Configure the router to run the graph artifact by setting the APOLLO_GRAPH_ARTIFACT_REFERENCE environment variable or specifying the --graph-artifact-reference router command line argument.

  3. If problems arise, repeat step 2 to roll back using the reference URI of a known-good graph artifact.

Deploy with the Apollo GraphOS Operator for Kubernetes

If your routers run on Kubernetes, the Apollo GraphOS Operator is an alternative to the CI/CD pipeline approach above. Rather than having your pipeline imperatively fetch and write an artifact URI, you declare the desired artifact reference in a Supergraph custom resource. The Operator then provisions and manages the router Deployment, Service, ConfigMap, and Secret, and Kubernetes handles the orchestration. Go to the Apollo GraphOS Operator docs for more information.