Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a better message when a subgraph is published with no changes #1757

Conversation

bonnici
Copy link
Contributor

@bonnici bonnici commented Sep 29, 2023

If a rover subgraph publish is run but there are no changes to the schema or routing URL, the publish mutation will succeed but nothing is actually changed related to the subgraph and a build/launch is never created. We indicate that this is the case by sending back wasUpdated: false but rover is not currently using that field (and it's not even exposed via the platform-api). This has caused some confusion because when customer's see the "the subgraph has was updated" message they think that something must have gone wrong during composition. This can be reproduced by simply running a subgraph publish twice for the same schema and URL:

> APOLLO_KEY=x \
  rover subgraph publish x@x \
  --schema ./schema.graphql \
  --name subgraph-name \
  --routing-url http://some.url.here.com
Publishing SDL to x@x (subgraph: subgraph-name) using credentials from the default profile.
The 'subgraph-name' subgraph in 'x@x' was updated
The supergraph schema for 'x@x' was NOT updated with a new schema
> APOLLO_KEY=x \
  rover subgraph publish x@x \
  rover subgraph publish x@x \
  --schema ./schema.graphql \
  --name subgraph-name \
  --routing-url http://some.url.here.com
Publishing SDL to x@x (subgraph: subgraph-name) using credentials from the default profile.
The 'subgraph-name' subgraph in 'x@x' was updated
The supergraph schema for 'x@x' was NOT updated with a new schema

This PR updates the message shown after the second publish above so that it would instead say:

Publishing SDL to x@x (subgraph: subgraph-name) using credentials from the default profile.
The 'subgraph-name' subgraph was NOT updated because no changes were detected
The supergraph schema for 'x@x' was NOT updated with a new schema

This was tested by using:

APOLLO_REGISTRY_URL=x \
  APOLLO_KEY=x \
  cargo run subgraph publish x@x \
  --schema ~/some/path/booking-schema.graphql \
  --name booking-subgraph \
  --routing-url http://some.url.here.com

On my staging graph and repeating it with no changes, then repeating it again after making a change to the schema.

@bonnici bonnici marked this pull request as ready for review October 4, 2023 02:12
@EverlastingBugstopper EverlastingBugstopper added the fix 🩹 fixes a bug label Oct 5, 2023
@EverlastingBugstopper EverlastingBugstopper added this to the vNext milestone Oct 5, 2023
@EverlastingBugstopper EverlastingBugstopper merged commit 69e5e59 into apollographql:main Oct 5, 2023
7 of 8 checks passed
EverlastingBugstopper added a commit that referenced this pull request Oct 5, 2023
# [0.20.0] - 2023-10-05

## 🚀 Features

- **Persisted Queries is now GA - @glasser, #1756**

The `rover persisted-queries publish` command is now out of the public
preview phase and has entered general availability. Check out [the
documentation](https://www.apollographql.com/docs/graphos/operations/persisted-queries)
for this enterprise feature.

## 🐛 Fixes

- **Better message for a subgraph published with no changes - @bonnici,
#1757**

`rover subgraph publish` now logs a message to `stdout` when a subgraph
was published and there were no changes to the schema.

- **Don't log username/password if `APOLLO_ROVER_DOWNLOAD_HOST` includes
authentication in the URL - @EverlastingBugstopper, #1758**

Previously, when using the `APOLLO_ROVER_DOWNLOAD_HOST` environment
variable to override the download location of a plugin binary, Rover
would log the entire URL to stdout, potentially leaking username and
password authentication details if they were included in the URL. Now,
Rover strips that information from the URLs before printing the download
location. If Rover is not able to strip that information (likely due to
an invalid URL), then it doesn't try to print the sanitized URL at all.

## 📚 Documentation

- **Improve wording of persisted queries documentation - @Meschreiber,
#1760**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants