Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build cache is required, but could not be located #9309

Closed
chengjun opened this issue Dec 22, 2021 · 2 comments
Closed

Build cache is required, but could not be located #9309

chengjun opened this issue Dec 22, 2021 · 2 comments
Assignees
Labels
Milestone

Comments

@chengjun
Copy link

chengjun commented Dec 22, 2021

What version of Hugo are you using (hugo version)?

$ hugo version 

0.91.0

Run peaceiris/actions-hugo@v2
Hugo version: 0.91.0
/usr/bin/tar xz --warning=no-unknown-keyword -C /home/runner/actions_hugo/_temp -f /home/runner/work/_temp/f496a467-32a5-47a2-81a4-8b300f6e61b7
/home/runner/actions_hugo/bin/hugo version
hugo v0.91.0-D1DC0E9A+extended linux/amd64 BuildDate=2021-12-17T09:50:20Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

I guess yes!

https://github.com/chengjun/starter-hugo-academic/runs/4603137806?check_suite_focus=true

Run hugo --gc --minify
build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined
Error: failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined
 *errors.errorString
hugo: collected modules in 897 ms
Total in 898 ms
Error: Process completed with exit code 255.

I run hugo within github action:

name: Deploy to chengjun.github.io
on:
  push:
    branches:
      - master  # Set a branch name to trigger deployment
  pull_request:

jobs:
  deploy:
    runs-on: ubuntu-latest
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'
          extended: true 

      - name: Build
        run: hugo --gc --minify

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
          external_repository: chengjun/chengjun.github.io
          publish_branch: main  # default: gh-pages
          publish_dir: ./public

Update

When I downgrade the version to 0.90.0, it works well. I guess it is the problem of the new version.

@bep
Copy link
Member

bep commented Dec 22, 2021

What's the go version used here?

You can probably work around this by setting the env var HUGO_SECURITY_EXEC_OSENV=.*. The permanent solution to this issue is probably to set GOCACHE (we do set GOPATH, which should be a fine fall back, but does not work on GH action for some odd reason (missing $HOME?).

@bep bep self-assigned this Dec 22, 2021
@bep bep added the Bug label Dec 22, 2021
@bep bep added this to the v0.91.1 milestone Dec 22, 2021
bep added a commit to bep/hugo that referenced this issue Dec 22, 2021
This was introduced in Go 1.15. We do set the GOPATH, which should be enough, but gohugoio#9309 indicate that's not the case on every platform (GitHub Actions).

Closes gohugoio#9309
bep added a commit to bep/hugo that referenced this issue Dec 22, 2021
@bep bep closed this as completed in 0016e21 Dec 22, 2021
vk0xOrg added a commit to vk0xOrg/floss2ua that referenced this issue Dec 22, 2021
latest version of 'go' somehow fails to build pages; here is some explatations -> gohugoio/hugo#9309; and changed to main
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants