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

release failed when running in a container #50

Closed
dwisiswant0 opened this issue Aug 2, 2023 · 2 comments
Closed

release failed when running in a container #50

dwisiswant0 opened this issue Aug 2, 2023 · 2 comments

Comments

@dwisiswant0
Copy link

Hello, I intended to experiment with cross-compilation using goreleaser-cross within a container. However, I encountered an issue where goreleaser detected that the cwd is "not a git repository." I'm looking for any suggestions on why this might occur and if there's a possible workaround.

Below is the GitHub workflow snippet that only has two steps.

# SNIPPED
jobs:
  release:
    name: goreleaser-cross
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/goreleaser/goreleaser-cross:latest
    if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && (inputs.job == 'release' || inputs.job == 'both')) }}
    steps:
      - uses: actions/checkout@master
        with:
          ref: "${{ inputs.tag }}"
          fetch-depth: 0

      - run: goreleaser release
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
        working-directory: "${{ github.workspace }}"

Error occurred:

  goreleaser release
# shell: sh -e {0}
# env:
#   GITHUB_TOKEN: ***
  • starting release...
  • loading config file                              file=.goreleaser.yaml
  • loading environment variables
    • using token from "$GITHUB_TOKEN"
  • getting and validating git state
  ⨯ release failed after 0s                  error=current folder is not a git repository
Error: Process completed with exit code 1.

Thanks!

@dwisiswant0
Copy link
Author

So basically I did this experiment based on this article which is that it's running on the GitLab registry, so I wanted to try it on the GitHub action.

@dwisiswant0
Copy link
Author

Upon investigation, I discovered that the problem stemmed from the GitHub runner image, issue actions/runner-images#6775. The command git rev-parse --is-inside-work-tree was returning the error: "dubious ownership in repository at [...]".

To resolve this issue, I implemented a (temporary) workaround by adding this step (after checking out the repo):

- run: git config --global --add safe.directory "$(pwd)"

Interestingly, even though I noticed that the entrypoint was running the same command:

git config --global --add safe.directory "$(pwd)"

I'm unsure how the problem initially occurred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant