- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何从 Travis-CI 的 after_script
命令中获取build_number(以及其他构建元数据)?
已经尝试过的内容:
documentation on build configuration在 IRC 通知部分中这样说:
You also have the possibility to customize the message that will be sent to the channel(s) with a template:
notifications:
irc:
channels:
- "irc.freenode.org#travis"
- "irc.freenode.org#some-other-channel"
template:
- "%{repository} (%{commit}) : %{message} %{foo} "
- "Build details: %{build_url}"You can interpolate the following variables:
- repository: your GitHub repo URL.
- build_number: build number.
- branch: branch build name.
- commit: shorten commit SHA
- author: commit author name.
- message: travis message to the build.
- compare_url: commit change view URL.
- build_url: URL of the build detail.
尝试让它在 after_script
命令中工作,如下所示,根本不起作用:
language: java
after_script:
- git commit -a -m "Committed by Travis-CI build number: %{build_number}"
它的行为就像 .travis.yml
文件不存在/无效(即使它确实通过了 Travis-CI YAML 验证 here )。
看起来这应该是可行的,但找不到任何可以做到这一点的示例。
有人能指出我正确的方向吗?
最佳答案
不幸的是,您可以对 IRC 输出进行的字符串替换只能在此处起作用。它们仅用于一般通知、自定义输出,但目前仅适用于 IRC。
还有一种方法可以通过访问 TRAVIS_JOB_ID 环境变量来获取当前的内部版本号。如果将脚本更改为以下行,事情应该按预期工作:
after_success:
- git commit -a -m "Committed by Travis-CI build number: $TRAVIS_JOB_ID"
关于build - 如何在 after_script 命令中获取 Travis-CI build_number,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12643018/
我在 .gitlab-ci.yml 写了几篇工作我的问题与此类似 SO Question .但是,提供和接受的答案不适用于我的场景。 该作业有一个 after_script 部分,它在主任务完成或失败
如何从 Travis-CI 的 after_script 命令中获取build_number(以及其他构建元数据)? 已经尝试过的内容: documentation on build configur
我知道 committer_email、author_name 和其他变量的加载是通知事件的一部分。是否可以在 before_script、after_script 等早期事件中访问它们? 我想访问这
我正在使用Gitlab CI ,所以一直在研究一个相当复杂的 .gitlab-ci.yml文件。该文件有一个 after_script 部分,该部分在主任务完成或主任务因某种原因失败时运行。问题:我需
我是一名优秀的程序员,十分优秀!