根据git分支更改服务器。

发布于 2025-01-19 06:25:09 字数 335 浏览 3 评论 0原文

我有一个使用 bitbucket ci/cd 设置的 nodejs 项目 - 有没有什么方法可以以编程方式将阶段从 dev 更改为我所在的 git 分支?

Serverless.yml:

stage: ${opt:stage, "dev"}

我尝试使用这个包 (https://www.npmjs.com/package/serverless-plugin-git-variables) 但它似乎不起作用。

I have a nodejs project set up with bitbucket ci/cd - is there any way to programmatically change the Stage from dev to what ever git branch I am on?

Serverless.yml:

stage: ${opt:stage, "dev"}

I have tried to use this package (https://www.npmjs.com/package/serverless-plugin-git-variables)
but it doesn't seem to be working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱,才寂寞 2025-01-26 06:25:09

简介

嗨,git repo 是由存储库本身中存在的隐藏 .git 目录定义的,如果您使用的是基于 Linux 的系统,您可以使用以下命令找到该文件夹在项目内的终端中 在

ls -al 

.git 内,您可以找到一个名为 HEAD 的文件,其中包含项目的当前头分支
IE:
ref: refs/heads/3-implement-some feature

结论

基本上我的意思是您可以在项目中访问此文件并定义所需的自定义逻辑。
我希望这能以某种方式帮助你。

Introduction

Hi, a git repo is defined by the hidden .git directory present inside the repo itself, if you are on linux based system you can find the folder using the following command in your terminal inside your project

ls -al 

Inside the .git you can find a file called HEAD that contains the current head branch for the project
ie:
ref: refs/heads/3-implement-some feature

Conlcusion

Basically what i mean is that you can access to this file inside your project and define your desired custom logic.
I hope this can help you in some way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文