英文:
FIREBASE_TOKEN deprecated in CI/CD gitlab
问题
我在部署我的Web应用时遇到了一个警告,Firebase告诉我令牌即将被弃用,建议使用Google凭据。
有关如何设置GitLab管道以使用Google凭据的建议吗?我没有找到相关指南。这是我的脚本。
目前,我已配置了一个包含令牌的GitLab环境变量,它能够工作(但会出现警告)。
我尝试在GitLab设置中设置了GOOGLE_APPLICATION_CREDENTIALS环境变量,但我不知道用于部署的Firebase命令是什么。
英文:
I encountered a warning while deploying my web app, firebase tells me that the token is about to be deprecated and I recommend using google credentials.
Do you have any advice on how to setup the gitlab pipeline to use google credentials? I have not found a guide on this. This is my script.
At the moment I have configured a gitlab environment variable containing the token and it works (with warning).
I tried setting the GOOGLE_APPLICATION_CREDENTIALS environment variable in gitlab settings but I don't know the firebase command to use to deploy.
答案1
得分: 1
I found the way to deploy from gitlab using the GOOGLE_APPLICATION_CREDENTIALS.
This is my script:
image: node:14.18.0-alpine
before_script:
- npm i -g firebase-tools
- echo $FIARD_PRIVATE_KEY > "/private-key.json"
- export GOOGLE_APPLICATION_CREDENTIALS="/private-key.json"
stages:
- staging
- production
deploy_staging:
stage: staging
when: manual
script:
- firebase use staging
- firebase deploy --only hosting:ineffe-business-site-staging
- echo "Deploying hosting staging finished!"
only:
- master
environment:
name: staging
url: https://staging-business-ineffe.firebaseapp.com/
deploy_production:
stage: production
when: manual
script:
- firebase use default
- firebase deploy --only hosting:ineffe-business-site-prod
- echo "Deploying hosting production finished!"
only:
- master
environment:
name: production
url: https://business-ineffe-com.firebaseapp.com/
I created the environment variable on gitlab based on the environment (staging and production) and it works.
The variables contain the authentication json provided by Google.
I posted this answer if it can be useful to someone.
英文:
I found the way to deploy from gitlab using the GOOGLE_APPLICATION_CREDENTIALS.
This is my script:
image: node:14.18.0-alpine
before_script:
- npm i -g firebase-tools
- echo $FIARD_PRIVATE_KEY > "/private-key.json"
- export GOOGLE_APPLICATION_CREDENTIALS="/private-key.json"
stages:
- staging
- production
deploy_staging:
stage: staging
when: manual
script:
- firebase use staging
- firebase deploy --only hosting:ineffe-business-site-staging
- echo "Deploying hosting staging finished!"
only:
- master
environment:
name: staging
url: https://staging-business-ineffe.firebaseapp.com/
deploy_production:
stage: production
when: manual
script:
- firebase use default
- firebase deploy --only hosting:ineffe-business-site-prod
- echo "Deploying hosting production finished!"
only:
- master
environment:
name: production
url: https://business-ineffe-com.firebaseapp.com/
I created the environment variable on gitlab based on the environment (staging and production) and it works.
The variables contain the authentication json provided by Google.
I posted this answer if it can be useful to someone.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论