#640  持续部署时如何选定Volume
Closed
xs opened 2 years ago

您好,项目需要带入配置文件以及运行时产出的一些数据(比如log),因此需要运行Container时设置Volume。 我看了过往的一些Docker部署相关的issue,也没有看到指定Volume的。 我看Run Container Step没有指定的方式。

image.png image_2.png 我也尝试过Command Step 以完整命令方式运行,在物理机能运行的命令在这里面失败了。

请问如何在启动Container的时候设置指定目录的Volume呢?

xs commented 2 years ago

image_3.png 是因为不能用@tag@吗?

Robin Shen commented 2 years ago

构建任务中不支持访问本机目录,因为这样会导致构建依赖环境,会带来很多问题,比如构建不能在其他节点运行,事后可能不能重复运行,也会带来潜在的并发访问问题。

实在要访问的话,可以将这些配置文件放在git仓库中,然后在任务开始加一个Checkout Step,并在你自己的容器内通过访问环境变量$ONEDEV_WORKSPACE指向的目录来访问Checkout出来的文件。

另外我创建了Issue #641 来支持mount指定的Job workspace下的目录到容器内,这样容器就可以不用依赖$JOB_WORKSPACE环境变量。

xs commented 2 years ago

我明白了,感谢您的回答

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Question
Priority
Minor
Assignee
Issue Votes (0)
Watchers (4)
Reference
onedev/server#640
Please wait...
Page is in error, reload to recover