> For the complete documentation index, see [llms.txt](https://gitbook.techbytes.app/devops-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.techbytes.app/devops-docs/processes/apollo-studio-ci-cd.md).

# Apollo Studio CI/CD

Steps to configure CI/CD for GraphQL Schema in Apollo studio

### Create API Key

* Open your graph explorer.
* Click on the gear icon on the left pane.
* Goto This graph tab
* Click on API Keys -> Create New Key -> Choose Name -> Create Copy API Key

### Install rover

rover is a cli tool to interact with Apollo Studio.

Run the below command to install rover:

```bash
curl -sSL https://rover.apollo.dev/nix/latest | sh
```

### Authentication:

To use the rover tool to interact with your apollo studio project, you need to authenticate, to do that you need to set `APOLLO_KEY` environment variable in the bash.

```
export APOLLO_KEY=<YOUR_API_KEY>
```

### Schema Checks

You can optionally run the below command to check for any improper changes that could negatively impact existing clients.

```bash
rover subgraph check <GRAPHQL REF> --name <SUBGRAPH Name> --schema <SCHEMA Path> 
```

* `GRAPHQL REF`: it would be in the format **name\@variant** (you can find this by clicking on the subgraphs tab in the left panel at the header you can see something like `Subgraphs for x@y` , where **x** is name, and **y** is variant )
* `SUBGRAPH Name`: You can find this at subgraphs tab -> Name header
* `SCHEMA Path` : This is the local path of the schema

You can refer to the Overall sample command below:

```bash
rover subgraph check myproject@main --name myproject-alpha --schema my_folder/schema.graphql 
```

### Publish Schema

To update the existing subgraph with the new schema, you can use the below command:

```bash
rover subgraph publish <GRAPHQL REF> --name <SUBGRAPH Name> --schema <SCHEMA Path>  --routing-url <GRAPHQL Endpoint>
```

`GRAPHQL Endpoint`: The url for your graphql API, apollo studio explorer will use this while calling the API.

You can refer to the Overall sample command below:

```
rover subgraph publish myproject@main --name myproject-alpha --schema my_folder/schema.graphql --routing-url https://example.com/graphql
```
