Skip to content

Commit

Permalink
Run GraphQL CI step outside of docker
Browse files Browse the repository at this point in the history
Running each GraphQL sub-command in a separate docker container means
we don't need to have git installed in the app docker image.
  • Loading branch information
dannymidnight committed Nov 20, 2023
1 parent 8e0047b commit 16eca29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 0 additions & 10 deletions .buildkite/pipeline.graphql.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
steps:
- label: Update GraphQL docs
command: .buildkite/update_graphql_docs
plugins:
- docker-compose#v4.9.0:
run: app
mount-ssh-agent: true
mount-buildkite-agent: true
env:
- API_ACCESS_TOKEN
- GIT_NAME
- GIT_EMAIL
- GH_TOKEN
10 changes: 7 additions & 3 deletions .buildkite/update_graphql_docs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ set -euo pipefail
. bin/utils.sh

echo "+++ Fetch latest schema (via GraphQL introspection)"
rake graphql:fetch_schema >| data/graphql/schema.graphql
docker compose run \
--no-deps \
-e API_ACCESS_TOKEN \
app \
rake graphql:fetch_schema >| data/graphql/schema.graphql

echo "+++ Check for schema changes"
if git diff --exit-code --quiet data/graphql/schema.graphql; then
Expand All @@ -21,12 +25,12 @@ BRANCH=buildkite-docs-bot/graphql/$(git rev-parse --short :data/graphql/schema.g
PULL_REQUEST_NUMBER=$(get_branch_pull_request_number $BRANCH)

if [ -n "$PULL_REQUEST_NUMBER" ]; then
buildkite-agent annotate "Nothing to change, pull request [#$PULL_REQUEST_NUMBER](https://github.com/buildkite/docs/pull/$PULL_REQUEST_NUMBER) awaiting approval." --style "info"
buildkite-agent annotate "Nothing to change, pull request [#$PULL_REQUEST_NUMBER](https://github.com/buildkite/docs/pull/$PULL_REQUEST_NUMBER) awaiting approval." --style "info"
exit 0
fi

echo "+++ Generate GraphQL docs"
rake graphql:generate
docker compose run --no-deps app rake graphql:generate

echo "--- Commit and push changes"
git add .
Expand Down

0 comments on commit 16eca29

Please sign in to comment.