在Bitbucket管道的各个步骤中使变量可见吗? [英] Make variable visible across steps in Bitbucket pipelines?

查看:52
本文介绍了在Bitbucket管道的各个步骤中使变量可见吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在两个步骤中共享一个变量.

I would like to share a variable across two steps.

我将其定义为:

- export MY_VAR="FOO-$BITBUCKET_BUILD_NUMBER"

但是当我尝试在其他步骤中打印它时:

but then when I try to print it in other step:

- echo $MY_VAR

它是空的.

我如何共享这样的变量?

How I can share such variable?

推荐答案

但是,似乎不可能从一个步骤到另一个步骤共享环境变量,但是您可以在设置的所有步骤中定义全局环境变量项目在 pipelines 类别下.

I'm afraid, but it seems impossible to share environment variable from one step to another, BUT you can define global environment variables for all steps in the settings of the project under pipelines category.

Settings -> Pipelines -> Repository Variables

这篇关于在Bitbucket管道的各个步骤中使变量可见吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆