【发布时间】:2023-02-01 18:24:07
【问题描述】:
我试图在 jetbrains 空间自动化中的 shellScript 中使用 bash 变量但没有成功。
我的 .space.kts 如下;
job("mvn compile"){
container(displayName="mvn", image="maven:3.8.5-eclipse-temurin-17"){
shellScript {
content = """
FOO="bar"
echo $FOO
"""
}
}
}
在上面我期望“bar”被回显,但是当它试图运行时我得到了以下错误;
Dsl file '/tmp/16487320722162400386/.space.kts' downloaded in 1736 ms
Compiling DSL script /tmp/16487320722162400386/.space.kts...
downloading /home/pipelines-config-dsl-compile-container/space-automation-runtime.jar ...
[SUCCESSFUL ] com.jetbrains#space-automation-runtime;1.1.100932!space-automation-runtime.jar (71ms)
Compilation failed in 8.652797664s.
ERROR Unresolved reference: FOO (.space.kts:9:23)
Cleaned up the output folder: /tmp/16487320722162400386
DSL processing failed: Compilation exited with non zero exit code: 2. Exit code: 102
我曾计划从 JB_SPACE_GIT_BRANCH 解析分支名称并将其存储在一个变量中以用于调用 mvn 以使用 Jib 构建和标记容器
无论如何,我可以在 shellScript 的内容中使用变量吗?或者应该/可以以不同的方式完成吗?
【问题讨论】:
标签: jetbrains-space-automation jetbrains-space