Oryx icon indicating copy to clipboard operation
Oryx copied to clipboard

Hugo detection is too broad and can result in false positives

Open jkeech opened this issue 3 years ago • 0 comments

Bug Report

  • At what date and time did you most recently experience the problem? 2022-03-02 20:57:50.931Z

  • Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use. GitHub Codespaces

  • If your repo is publicly available please share its URL: https://github.com/jkeech/not-hugo

  • What happened? The Hugo detector looks for all yaml/toml/json files recursively under config/**/*. If you have a repo that has a non-Hugo config file such as config/foo/bar.yaml, but which happens to contain one of the keys that the Hugo detector is looking for, such as title, oryx build will incorrectly detect the repo as a Hugo repo.

Then when Oryx tries to build it, hugo says (correctly) that there is no hugo config file present.

  • What did you expect or want to happen? The Oryx Hugo detector should look for the same set of config files that hugo ends up looking for to reduce the chance of false positive detections.

It looks like Oryx only supports the default configuration for Hugo with no extra command line arguments specified when running hugo, so according to the docs, it should only look for the following files:

config.yaml
config.toml
config.json
config/_default/config.yaml
config/_default/config.toml
config/_default/config.json
config/production/config.yaml
config/production/config.toml
config/production/config.json
  • How can we reproduce it?
  1. Create a codespace on https://github.com/jkeech/not-hugo
  2. Connect to the codespace in VS Code and run Codespaces: View Creation Log
  3. Search for the line containing oryx build and the see the output with the detection as hugo and the subsequent hugo execution failing
  • Do you have log output? Please include between the backticks:
2022-03-02 20:57:50.931Z: $ oryx build --manifest-dir "/workspaces/.oryx" -p virtualenv_name=.venv --log-file "/workspaces/.oryx/build.log" "/workspaces/not-hugo"
2022-03-02 20:57:50.945Z: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
2022-03-02 20:57:50.958Z: You can report issues at https://github.com/Microsoft/Oryx/issues
2022-03-02 20:57:50.970Z: 
2022-03-02 20:57:50.983Z: Oryx Version: 0.2.20220120.1, Commit: 9b4b24ca97b5e87c9b8fcb65ef7adb88c6f709e6, ReleaseTagName: 20220120.1
2022-03-02 20:57:50.995Z: 
2022-03-02 20:57:51.008Z: Build Operation ID: |MhWDZ34B9U4=.9199757f_
2022-03-02 20:57:51.020Z: Repository Commit : f3c85a87154fa25d225a91164fedd6762cf0d32a
2022-03-02 20:57:51.032Z: 
2022-03-02 20:57:51.048Z: Detecting platforms...
2022-03-02 20:57:51.060Z: Detected following platforms:
2022-03-02 20:57:51.074Z:   hugo: 0.90.1
2022-03-02 20:57:51.086Z: 
2022-03-02 20:57:51.098Z: 
2022-03-02 20:57:51.110Z: Source directory     : /workspaces/not-hugo
2022-03-02 20:57:51.122Z: Destination directory: /workspaces/not-hugo
2022-03-02 20:57:51.134Z: 
2022-03-02 20:57:51.146Z: 
2022-03-02 20:57:51.158Z: Using Hugo version:
2022-03-02 20:57:51.170Z: hugo v0.90.1-48907889+extended linux/amd64 BuildDate=2021-12-10T10:56:41Z VendorInfo=gohugoio
2022-03-02 20:57:51.182Z: 
2022-03-02 20:57:51.195Z: Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
2022-03-02 20:57:51.208Z:        Run `hugo help new` for details.
2022-03-02 20:57:51.220Z: 
2022-03-02 20:57:51.233Z: Total in 1 ms
2022-03-02 20:57:51.729Z: oryx process exited with exit code 255

jkeech avatar Mar 02 '22 21:03 jkeech