为了在 Argo 中获取像 20201008
这样的日期,在模板中格式化日期的最佳方法是什么?
这似乎有效,但相当冗长,并且为 "%Y-%m-%dT%H:%M:%SZ"
创建字符串将会变得非常困难供其他人阅读。
"{{workflow.creationTimestamp.Y}}{{workflow.creationTimestamp.m}}{{workflow.creationTimestamp.d}}"
我认为这些是相关文档:https://github.com/argoproj/argo/blob/master/docs/variables.md 。我尝试了 "{{workflow.creationTimestamp.Ymd}}"
但没有成功。
最佳答案
自 Argo 3.1 起,支持一些模板,因此现在可以使用:
"{{=sprig.date('20060102', workflow.creationTimestamp)}}"
关于argo-workflows - 在 Argo 中设置日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64268801/