【问题标题】:Git log - GitlabCI - saving to file with variable in name from git logGit 日志 - GitlabCI - 从 git 日志中保存到名称为变量的文件
【发布时间】:2021-01-22 12:18:02
【问题描述】:

在 gitlab.ci.yml - 试图在最后一个标签之后检查 gitlog 上的提交消息,它的工作原理:

$ git log  --oneline -- "instruction/1.0/" $(git describe --tags --abbrev=0 @^)
00:00
5cee88f Add new file - new instruction
26f5e26 Added new blablabla

当我尝试将结果保存在文件中时,它仍然可以正常工作,我们在文件夹中有 test.log

   git log  --oneline -- "instruction/1.0/" $(git describe --tags --abbrev=0 @^) > test.log
   ls
   test.log

但是如果我们尝试在文件名中包含 CI var,我们不会得到任何结果(此剧本中其他模块中使用了 $SYSTEM_NAME,一切正常)

git log  --oneline -- "instruction/1.0/" $(git describe --tags --abbrev=0 @^) > $SYSTEM_NAME.log

还有其他方法可以在 gitlog 输出中动态使用文件名吗?

【问题讨论】:

    标签: git gitlab gitlab-ci


    【解决方案1】:

    我相信它认为$SYSTEM_NAME 末尾的.log 是变量的一部分,而不是评估变量后的扩展。尝试像这样将变量与字符串分开: ${SYSTEM_NAME}.log

    【讨论】:

      猜你喜欢
      • 2012-04-21
      • 2014-11-22
      • 1970-01-01
      • 1970-01-01
      • 2021-11-21
      • 2011-08-10
      • 1970-01-01
      • 2012-08-14
      • 1970-01-01
      相关资源
      最近更新 更多