Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 130 forks source link

'No valid session' error when deploying with automate ci #386

Open marktani opened 6 years ago

marktani commented 6 years ago

Issue by chinclubi Thursday Nov 09, 2017 at 06:42 GMT Originally opened as https://github.com/graphcool/prisma/issues/1225


Current behavior

build: stage: build only:

Reproduction

  1. create graphcool project with graphcool init
  2. create a simple .graphcoolrc
    targets:
    dev: shared-ap-northeast-1/{{your-gl-project-id}}
    default: dev
    clusters:
    default: shared-ap--1
  3. create a .gitlab-ci.yml
    image: node:6
    before_script:
    - npm install -g graphcool
    stages:
    - deploy
    deploy:
    stage: deploy
    script:
    - graphcool login -T \"${GRAPHCOOL_TOKEN}\"
    - graphcool deploy -t test --force
  4. set GRAPHCOOL_TOKEN variable with your graphcool token >> gitlab ci docs
  5. commit&push your code to master branch
marktani commented 6 years ago

Comment by kbrandwijk Thursday Nov 09, 2017 at 10:06 GMT


You should skip graphcool login. When setting the env var GRAPHCOOL_TOKEN, you can call graphcool deploy directly.

marktani commented 6 years ago

Comment by chinclubi Wednesday Nov 15, 2017 at 17:58 GMT


@kbrandwijk According to #626, I have updated .gitlab-ci.yml and set the env var GRAPHCOOL_TARGET.

image: node:6
before_script:
- npm install -g graphcool
stages:
  - deploy
deploy:
  stage: deploy
  script:
    - graphcool deploy

I still got an error: image

marktani commented 6 years ago

Comment by nguansak Sunday Nov 26, 2017 at 18:04 GMT


I also try build ~/.graphcoolrc file with following script

image: node:6
before_script:
- npm install -g graphcool
stages:
  - deploy
deploy:
  stage: deploy
  script:
    - echo \"platformToken: ${GRAPHCOOL_TOKEN}\" > ~/.graphcoolrc
    - graphcool deploy -t test --force

but Gitlab CI Lint throw the error Status: syntax is incorrect Error: jobs:deploy:script config should be a string or an array of strings

BTW, I able to work around by using

- cp .graphcoolrc_global ~/.graphcoolrc

// .graphcoolrc_global

platformToken: >-
 <<YOUR_GRAPHCOOL_TOKEN>>

but not practical because you have to put the token into a file