gpt4 book ai didi

macos - 为什么 faSTLane 工作目录与我设置的不同

转载 作者:行者123 更新时间:2023-12-03 17:56:31 25 4
gpt4 key购买 nike

使用 Jenkins 的 faSTLane。 Jenkins 将密码设置为一个目录,我们称之为 directory1,它具有标准的 Fastfile 和 faSTLane 子文件夹,如下所示:

MacBook-Pro:directory1 user$ tree

├── fastlane
│   ├── Deliverfile
│  
├── Fastfile

Jenkins 然后从该目录执行 faSTLane。使用需要路径的 faSTLane 操作时,如果我使用假设工作目录为 directory1 的路径,则一切正常。但我不明白的是,为什么当我从 faSTLane 查询 pwd 时,无论是使用 sh 操作还是直接使用 Ruby Dir.pwd,都会给我值/MacBook-Pro/directory1/faSTLane 而不是工作目录我设置了/MacBook-Pro/directory1。我对 faSTLane 在这里对目录所做的事情有什么误解?

最佳答案

在使用 sh() 运行 shell 命令时,FaSTLane 有一些时髦的目录行为。 .解决方法是更改​​目录,或在路径前面加上 ..当你运行 shell 命令时,比如 pwd .

根据 official docs :

...every action and every plugin's code runs in the root of the project, while all user code from the Fastfile runs inside the ./fastlane directory. This is important to consider when migrating existing code from your Fastfile into your own action or plugin. To change the directory manually you can use standard Ruby blocks:

Dir.chdir("..") do
# code here runs in the parent directory
end

This behavior isn't great, and has been like this since the very early days of fastlane. As much as we'd like to change it, there is no good way to do so, without breaking thousands of production setups, so we decided to keep it as is for now.

关于macos - 为什么 faSTLane 工作目录与我设置的不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42426612/

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