Gitlab管道:Firebase部署403

时间:2018-12-11 12:09:05

标签: node.js firebase gitlab-ci firebase-hosting firebase-cli

我有一个gitlab项目,想将master分支部署到我的生产firebase项目,并将develop分支部署到另一个开发firebase项目

master分支部署到firebase的工作原理。但是,将开发部署到Firebase并非如此

这是我的gitlab-ci.yml

image: node:10

before_script:
  - npm install
  - npm install -g @angular/cli
  - npm install -g firebase-tools

cache:
  paths:
    - node_modules/

stages:
  - prod
  - test

deploy-prod:
  stage: prod
  environment:
    name: production
    url: https://my.chronery.app
  only:
    - master
  script:
    - npm run build-prod
    - npm run deploy-prod

deploy-test:
  stage: test
  environment:
    name: development
    url: https://chronery-dev.firebaseapp.com
  only:
    - develop
  script:
    - npm run build-dev
    - npm run deploy-dev

因此deploy-test是无效的。 这是我的package.json的脚本:

"build-dev": "ng build --prod --build-optimizer --extract-css false --source-map",
"build-prod": "ng build --prod --build-optimizer --extract-css false",
"deploy-dev": "firebase deploy --token=$FIREBASE_TOKEN -P dev",
"deploy-prod": "firebase deploy --token=$FIREBASE_TOKEN -P prod",

当管道要将其部署到开发人员时失败。 所以这个脚本:deploy-dev

这是错误:

Error: HTTP Error: 403, Request had insufficient authentication scopes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project@0.0.1 deploy-dev: `firebase deploy --token=$FIREBASE_TOKEN -P dev`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-project@0.0.1 deploy-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

有人知道出什么问题吗?

谢谢!

1 个答案:

答案 0 :(得分:1)

微小变化:

firebase deploy --token $FIREBASE_TOKEN -P dev

希望您在gitlab中创建了FIREBASE_TOKEN