无法找到项目根。期望在项目root中找到一个主机。

发布于 2025-02-05 01:26:04 字数 874 浏览 4 评论 0原文

作为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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

检查存储库的默认工作目录是/opt/opt/atlassian/pipelines/agent/build

它不是/opt/atlassian/pipelines/agent,所以请注意任何cd ..> pushd .. 您可能会发出的指令在此之前的脚本中。

您可以尝试使用popdcd-甚至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 any cd .. or pushd .. instructions you might be issuing in your script before that point.

You could try to fix the situation with a popd or cd - or even pushd $BITBUCKET_CLONE_DIR but I would advise to avoid changing the working directory altogether unless it was indispensable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文