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

Add git safe directory to workaround github actions ownership issues #26

Merged
merged 8 commits into from
May 9, 2024

Conversation

djhoese
Copy link
Contributor

@djhoese djhoese commented May 8, 2024

Closes #25

As discussed in #25, new versions of git check ownership of .git directories. Until github/github actions change how docker-based actions are called, this will cause failures every time coverage/coveralls checks for metadata about the current commit. This PR is the simplest fix I could think of to accomplish this. The alternative would be to add a subprocess.run call in entrypoint.py to run the same command there. I figure since this repository is just a github action and nothing else that doing it in the Dockerfile would be fine.

When I use this on my own CI I see:

   File "/usr/local/lib/python3.12/site-packages/coveralls/api.py", line 301, in submit_report
    raise CoverallsException(
coveralls.exception.CoverallsException: Could not submit coverage: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs

I'm hoping this is just a hiccup or a threshold from coveralls that they are mad about me restarting the same CI job over and over again.

@djhoese
Copy link
Contributor Author

djhoese commented May 8, 2024

I'm not sure what I did but coveralls seems to be made at me.

@djhoese
Copy link
Contributor Author

djhoese commented May 9, 2024

@AndreMiras Is the failing test expected to fail?

 Running on Github Actions but GITHUB_TOKEN is not set. Add "env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}" to your step config.
Traceback (most recent call last):
  File "/src/entrypoint.py", line 176, in try_main
    main()
  File "/src/entrypoint.py", line 171, in main
    run_coveralls(repo_token, parallel, flag_name, base_path)
  File "/src/entrypoint.py", line 80, in run_coveralls
    coveralls = Coveralls(service_name=service_name, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/coveralls/api.py", line 47, in __init__
    self.ensure_token()
  File "/usr/local/lib/python3.12/site-packages/coveralls/api.py", line 54, in ensure_token
    raise CoverallsException(
coveralls.exception.CoverallsException: Running on Github Actions but GITHUB_TOKEN is not set. Add "env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}" to your step config.
ExitCode.FAILURE

I (my fork) doesn't have access to the COVERALLS_REPO_TOKEN secret, right?

@AndreMiras
Copy link
Owner

AndreMiras commented May 9, 2024

Thanks for the PR, it looks good to me. Indeed for the repo secret access
Edit: why did you make the change at build time in the Dockerfile and not at run time in the entrypoint.py by the way?

@djhoese
Copy link
Contributor Author

djhoese commented May 9, 2024

From the original description:

This PR is the simplest fix I could think of to accomplish this. The alternative would be to add a subprocess.run call in entrypoint.py to run the same command there. I figure since this repository is just a github action and nothing else that doing it in the Dockerfile would be fine.

Doing it in the entrypoint would require a subprocess call that just seemed uglier, but if you have strong feelings about it it doesn't matter much to me. I could do something as simple as a subprocess.check_call.

@AndreMiras
Copy link
Owner

Ok thanks for the context, no strong feelings at all. I was just curious about what made you change from your original implementation idea

@AndreMiras AndreMiras merged commit 65c1672 into AndreMiras:develop May 9, 2024
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

Source code issues with git and coveralls
2 participants