gpt4 book ai didi

bash - 防止在 Concourse CI 中记录特定命令

转载 作者:行者123 更新时间:2023-11-29 09:25:10 27 4
gpt4 key购买 nike

我有一个基于 shell 的 concourse 任务,它在其中一个命令中使用半敏感凭据(测试服务器的 key )。我想避免将其记录在任务输出中。

管道的要点是:

jobs:
- name: foobar
plan:
<...>
- task: build
config:
platform: linux
image_resource:
type: docker-image
source:
repository: ubuntu
<...>
run:
path: bash
args:
- -exc
- |
command-which-is-ok-to-print
foobar {{my-secret-data}} # <-- hide this one!
another-command-which-is-ok-to-print

当前输出显示为:

+ command-which-is-ok-to-print
results of first command which are OK to print
+ foobar "oh-no-secret-data-here!" <-- hide this one!
more results which are OK to print
+ another-command-which-is-ok-to-print
even more results which are OK to print

有没有办法禁止打印这一行?

最佳答案

我认为 -exc 实际上设置了标志 ex (我假设它是 执行!

-x 是导致命令被回显的原因(通过 bash 本身而不是 concourse),所以这成功地阻止了执行单个命令:

  <...>
run:
path: bash
args:
- -exc
- |
command-which-is-ok-to-print
set +x
foobar {{my-secret-data}}
set -x
another-command-which-is-ok-to-print

关于bash - 防止在 Concourse CI 中记录特定命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46193257/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com