Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

gitlab - Git log - GitlabCI - saving to file with variable in name from git log

in gitlab.ci.yml - ill trying to check gitlog on commits messages after last tag, and its worked:

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

when i try to save result in file, its still work fine, we have test.log in folder

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

but if we try to include CI var in file name, we dont have any result ($SYSTEM_NAME used in this playbook in other modules and everything is ok)

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

is it any other methods to use dynamically filename in gitlog output?

question from:https://stackoverflow.com/questions/65845054/git-log-gitlabci-saving-to-file-with-variable-in-name-from-git-log

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I believe it's thinking that the .log at the end of $SYSTEM_NAME is part of the variable, not an extension after it evaluates the variable. Try separating the variable from the string like this: ${SYSTEM_NAME}.log


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...