continuous-integration - 在drone.io 中的步骤之间共享变量
问题描述
在我看来,drone.io 不跨管道步骤共享参数。是否可以从文件中读取插件的参数,例如类似于已经存在的“from_secret”的“from_file”指令?这就是人们可以使用它的方式:
kind: pipeline
name: default
steps:
- name: get_repo_name
image: alpine
commands:
- echo "hello" > .repo_name
- name: docker
image: plugins/docker
settings:
repo:
from_file: .repo_name
username:
from_secret: docker_username
password:
from_secret: docker_password
解决方案
从文件读取输入的能力更多是插件作者的选择,但是创建插件是一件非常简单的事情,因为您的大多数变量只需要被调用,PLUGIN_VARIABLE
然后您就可以提供这些东西。
为了显示一些插件确实从文件中读取,一个这样的例子是drone-github-comment:
steps:
- name: github-comment
image: jmccann/drone-github-comment:1.2
settings:
message_file: file_name.txt
when:
status:
- success
- failure
FWIW,看看你的例子,你似乎只是想传递 repo_name?这些变量都存在于管道中,当然取决于您使用的运行器,但对于 Docker,您可以获得所有这些:
推荐阅读
- java - java.lang.NoSuchMethodError: org.openqa.selenium.support.ui.FluentWait.until(Lcom/google/common/base/Function;)Ljava/lang/Object;
- php - 将查询 whereClause 条件读取为 JSON 并将其转换为 PHP Laravel 中的 SQL 查询
- tensorflow - 使用 Keras Model API 和 TensorFlow Estimator API 训练相同的模型会产生不同的准确度
- c# - Visual Studio 组件导入在 vsix 项目 (MEF) 中为空
- java - 生成“假”流数据。卡夫卡-Flink
- ios - 像在 WhatsApp 上一样在 iPhone 上压缩图像
- php - 在删除类别之前更新相关帖子
- swift - 如何为 CAGradientLayer 色点设置动画?
- gradle - 复制任务将预先存在的文件清零
- oauth-2.0 - 使用 oauth2 和 JWT 的无状态微服务架构