Skip to content

Add cascading package settings to GraphQL

What does this MR do and why?

Adds GraphQL support for querying and updating the newest namespace package settings for package forwarding:

# For querying and updating
      mavenPackageRequestsForwarding
      lockMavenPackageRequestsForwarding
      npmPackageRequestsForwarding
      lockNpmPackageRequestsForwarding
      pypiPackageRequestsForwarding
      lockPypiPackageRequestsForwarding

# For querying only
      mavenPackageRequestsForwardingLocked
      npmPackageRequestsForwardingLocked
      pypiPackageRequestsForwardingLocked

These settings were added in !99274 (merged). They are implemented in the package logic in !99285 (merged). A separate MR will use this GraphQL update to expose these settings in the UI.

Database

The queries related to these GraphQL endpoints do not change, we just allow for reading and updating these new fields. Thus, I have not requested a database review.

Screenshots or screen recordings

Screen_Shot_2022-10-10_at_2.40.58_PM

Screen_Shot_2022-10-07_at_10.31.44_PM

How to set up and validate locally

You will need the full path of a group and to be logged in with a user that has Owner access to that group.

In the graphql explorer (http://gdk.test:3000/-/graphql-explorer) query the settings:

query {
  namespace(fullPath: "<group_full_path>") {
    packageSettings {
      mavenPackageRequestsForwarding
      lockMavenPackageRequestsForwarding
      npmPackageRequestsForwarding
      lockNpmPackageRequestsForwarding
      pypiPackageRequestsForwarding
      lockPypiPackageRequestsForwarding
      mavenPackageRequestsForwardingLocked
      npmPackageRequestsForwardingLocked
      pypiPackageRequestsForwardingLocked
    }
  }
}

Update the settings:

mutation  updateNamespacePackageSettingsMutation ($namespacePackageSettings: UpdateNamespacePackageSettingsInput!) {
  updateNamespacePackageSettings(input:$namespacePackageSettings) {
    packageSettings {
      mavenPackageRequestsForwarding
      lockMavenPackageRequestsForwarding
      npmPackageRequestsForwarding
      lockNpmPackageRequestsForwarding
      pypiPackageRequestsForwarding
      lockPypiPackageRequestsForwarding
    }
  }
}

With these query variables:

{
  "namespacePackageSettings": {
    "namespacePath": "<group_full_path>",
    "mavenPackageRequestsForwarding": false,
    "lockMavenPackageRequestsForwarding": true,
    "npmPackageRequestsForwarding": false,
    "lockNpmPackageRequestsForwarding": true,
    "pypiPackageRequestsForwarding": false,
    "lockPypiPackageRequestsForwarding": true
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #360267 (closed)

Edited by Steve Abrams

Merge request reports

Loading