File: dump_graphql_schema

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (25 lines) | stat: -rwxr-xr-x 834 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash

GITLAB_DIR="$(cd "$(dirname "$0")/.." || exit ; pwd -P)"
DOCKER_IMAGE="registry.gitlab.com/gitlab-org/gitlab-build-images:apollo"
CONFIG_FILE="config/apollo.config.js"
SCHEMA_DUMP_PATH="tmp/tests/graphql/gitlab_schema_apollo.graphql"

if [ "$CI" = true ]; then
  echo "Not dumping the GraphQL schema in CI"
else
  echo "Dumping GraphQL schema"
  cd "$GITLAB_DIR" || exit 1
  if command -v docker >/dev/null; then
    bundle exec rake gitlab:graphql:schema:dump &&
      docker run --rm -it \
        -v "$GITLAB_DIR/config":/config \
        -v "$GITLAB_DIR/tmp":/tmp \
        -v "$GITLAB_DIR/app":/app \
        -v "$GITLAB_DIR/ee":/ee \
        "$DOCKER_IMAGE" client:download-schema --config="$CONFIG_FILE" "$SCHEMA_DUMP_PATH"
  else
    echo "Docker must be installed to run this script."
    exit 1
  fi
fi