使用 bitbucket 和部署令牌作为变量部署在 Meteor galaxy 服务器上

Deploy on Meteor galaxy server with bitbucket and deployment token as variable

你好,我想使用 bitbucket 上的自动 deploymen 到带有部署令牌的 galaxy 服务器。

出于这个原因,我正在创建一个在存储库中提交的部署令牌。

https://galaxy-guide.meteor.com/deploy-guide.html#deployment-token

为了加强安全性,我想在 bitbucket 管道中使用 Repository 变量:

https://confluence.atlassian.com/bitbucket/environment-variables-794502608.html

并将 meteor 的部署令牌存储在变量中而不是文件中。

对于我们在命令中使用的部署:

METEOR_SESSION_FILE=deployment_token.json

我的问题是 - 有什么方法可以让我在使用令牌的地方使用一些变量(字符串),例如

METEOR_SESSION_DEPLOYMENT_TOKEN=$METEOR_TOKEN

而不是从文件中调用它?

感谢 this article 我弄明白了。

将 json 设置保存为环境变量,然后在部署过程中:

echo $DEPLOY_SESSION_FILE > deployment_token.json
METEOR_SESSION_FILE=deployment_token.json DEPLOY_HOSTNAME=galaxy.meteor.com meteor deploy --allow-superuser myApp-staging.meteorapp.com --settings config/staging/settings.json --owner username

一些研究,在遇到同样的问题后,将我带到 this article,它简单地解决了你不能在下面简单的环境变量中只喂养流星的问题 json方式:

通过将 json 文件内容添加为环境变量,然后在部署时将其回显到文件中。

echo $METEOR_TOKEN_FILE > deploy_token.json
METEOR_SESSION_FILE=deploy_token.json