无法找到项目根。期望在项目root中找到一个主机。
作为Bitbucket管道的一部分,我正在运行一个函数,当我运行此命令
func azure azure functionApp发布时 - 从我的机器的终端上当地的charp sharp,该发布效果很好,但是当我试图从bitbucket运行它时管道,我遇到了一个错误,
Unable to find project root. Expecting to find one of host.json in project root.
我在管道中添加了以下行,只是为了查看bitbucket从何处执行此命令
pwd
ls -l
,然后返回以下
Deploying functions app code with func...
/opt/atlassian/pipelines/agent
total 16
drwxrwxrwx 2 root root 4096 Jun 7 09:16 artifact
drwxrwxrwx 5 root root 4096 Jun 7 09:16 build
drwxrwxrwx 2 root root 4096 Jun 7 09:16 cache
drwxrwxrwt 3 root root 100 Jun 7 09:16 data
drwxrwxrwt 3 root root 100 Jun 7 09:16 ssh
drwxrwxrwx 2 root root 4096 Jun 7 09:16 tmp
命令,所以确实,host。我认为它应该能够捡起它。当我从本地运行命令时,
pwd
ls -l
上面列出了我的项目目录和主机。
有没有办法获取Bitbucket管道来查找主机文件?
I am running a func as part of my bitbucket pipeline, when i run this command
func azure functionapp publish "" --csharp locally from a terminal of my machine, the publish works fine, however as I am attempting to run this from the BitBucket pipeline, I get an error
Unable to find project root. Expecting to find one of host.json in project root.
I added the following line to my pipeline just to see where BitBucket is executing this command from
pwd
ls -l
and it returns the below
Deploying functions app code with func...
/opt/atlassian/pipelines/agent
total 16
drwxrwxrwx 2 root root 4096 Jun 7 09:16 artifact
drwxrwxrwx 5 root root 4096 Jun 7 09:16 build
drwxrwxrwx 2 root root 4096 Jun 7 09:16 cache
drwxrwxrwt 3 root root 100 Jun 7 09:16 data
drwxrwxrwt 3 root root 100 Jun 7 09:16 ssh
drwxrwxrwx 2 root root 4096 Jun 7 09:16 tmp
so indeed, the host.json is missing from root, but this file is checked into my repo so i assumed it should be able to pick it up. When i run the command from a terminal locally, the
pwd
ls -l
the above lists my project directory and the host.json file is present so that makes sense as to why i am able to publish it locally and not as part of my pipeline.
is there a way to get Bitbucket pipeline to find the host file ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查存储库的默认工作目录是
/opt/opt/atlassian/pipelines/agent/build
。它不是
/opt/atlassian/pipelines/agent
,所以请注意任何cd ..
> pushd .. 您可能会发出的指令在此之前的脚本中。您可以尝试使用
popd
或cd-
甚至pushd $ bitbucket_clone_dir
来解决情况除非必不可少。The default working directory where your repository is checked out is
/opt/atlassian/pipelines/agent/build
.It is not
/opt/atlassian/pipelines/agent
, so watch out for anycd ..
orpushd ..
instructions you might be issuing in your script before that point.You could try to fix the situation with a
popd
orcd -
or evenpushd $BITBUCKET_CLONE_DIR
but I would advise to avoid changing the working directory altogether unless it was indispensable.