Я пытаюсь настроить CI для сборки и развертывания моего сайта через GitLab.Мой сайт размещен на Firebase.
Я настроил поддомен для тестирования, чтобы он не мешал работе сайта.
Я могу использовать команду firebase deploy --only hosting:test --message "Release: $PACKAGE_VERSION"
длямоя локальная машина без проблем.
Когда я изменяю ее на firebase deploy --token $FIREBASE_TOKEN --only hosting:test --message "Release: $PACKAGE_VERSION"
, это дает мне ошибку Too many arguments
при запуске через CI.
Как я могу заставить это работать?
Firebase-tools в моих зависимостях dev находится на v6.6.0
Сообщение об ошибке:
> firebase deploy --token $FIREBASE_TOKEN --only hosting:test --message 'Version: $npm_package_version'
Error: Too many arguments. Run firebase help deploy for usage instructions
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admiralfeb-net@2019.3.1 deploy-test: `firebase deploy --token $FIREBASE_TOKEN --only hosting:test --message 'Version: $npm_package_version'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the admiralfeb-net@2019.3.1 deploy-test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-18T03_06_22_853Z-debug.log
ERROR: Job failed: exit code 1
Мои сценарии package.json
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"build-prod": "ng build --prod --aot",
"test": "ng test --watch=true",
"test-ci": "ng test --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox",
"e2e-ci": "ng e2e --protractor-config=e2e/protractor-ci.conf.js",
"lint": "ng lint",
"e2e": "ng e2e",
"deploy-test": "firebase deploy --token $FIREBASE_TOKEN --only hosting:test --message 'Version: $npm_package_version'",
"deploy-prod": "firebase deploy --token $FIREBASE_TOKEN --only hosting:prod --message 'Version: $npm_package_version'"
},
Mygitlab-ci.yml:
image: node:latest
stages:
- install
- build
- deploy-test
- deploy-prod
install-dependencies:
stage: install
cache:
policy: push
paths:
- node_modules/
script:
- npm install --quiet
only:
changes:
- package.json
build:
stage: build
cache:
policy: pull
paths:
- node_modules/
script:
- npm run build-prod
artifacts:
expire_in: 1 week
paths:
- dist/
deploy-test:
stage: deploy-test
environment:
name: test
url: $FIREBASE_URL_TEST
when: manual
dependencies:
- build
cache:
policy: pull
paths:
- node_modules/
script:
- npm run deploy-test
deploy-prod:
stage: deploy-prod
environment:
name: production
url: $FIREBASE_URL_PROD
only:
- master
when: manual
dependencies:
- build
cache:
policy: pull
paths:
- node_modules/
script:
- npm run deploy-prod
Мой firebase.json
{
"hosting": [{
"target": "prod",
"public": "dist/admiralfeb-net",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{
"target": "test",
"public": "dist/admiralfeb-net",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}]
}
и мой .firebaserc
{
"projects": {
"default": "admiralfebnet"
},
"targets": {
"admiralfebnet": {
"hosting": {
"test": [
"test-admiralfeb"
],
"prod": [
"admiralfebnet"
]
}
}
}
}