René's URL Explorer Experiment
Title: Test in Docker with Alpine Linux on CI by EliahKagan · Pull Request #1826 · gitpython-developers/GitPython · GitHub
Open Graph Title: Test in Docker with Alpine Linux on CI by EliahKagan · Pull Request #1826 · gitpython-developers/GitPython
X Title: Test in Docker with Alpine Linux on CI by EliahKagan · Pull Request #1826 · gitpython-developers/GitPython
Description: As suggested in #1745 (comment), this adds a test job that runs the tests inside a Docker container.
This can be done with Ubuntu in the container, but instead I used Alpine Linux in the container. This provides a greater variety of platforms GitPython tests on, potentially uncovering some bugs that would otherwise go undetected. In particular, Alpine Linux does not satisfy some of the assumptions that are sometimes made about platforms, as it does not, by default, have bash; its ps and related tools are not procps; it does not have GNU coreutils or GNU libc; and so forth.
No tests had to be marked xfail for this. In particular, as noted in #1745 (comment), we have no tests for #1756, so that ps is not procps in Alpine Linux does not currently result in any failures (and if there were such a test then the existing macOS jobs would still be sufficient for that).
This adds only one test job, testing only one version of Python. Currently that version is Python 3.11, since the Alpine Linux python3 apk package provides 3.11 at this time. The specified Docker image is alpine:latest, and the version will presumably advance to Python 3.12 eventually. I added only one job for two reasons:
This is easiest, since one version of Python 3 is packaged officially in Alpine Linux's downstream repositories, and it makes sense to test with that.
I don't want to create an excessive number of new jobs, since it seems likely that some more jobs covering interesting cases might be added, or at least might be worth considering, in the future. (One possible such case is discussed below.)
I was able to use the container key to do this, so that the workflow is still expressed in separate steps in the same style as the other test workflows, such that the operations that are analogous are represented by steps written in the same (or very similar) way across all workflows. I think the benefit of readability and comparability justifies this at this time, but depending what is done in the future, it might end up being changed to pack most of the work into a smaller number of steps (maybe one) that use uses: docker://..., or run: docker run ... or docker-run-action, or something else.
Specific reasons for existing design and implementation decisions, including for the strange and somewhat hacky sudo usage, are detailed in commit messages.
I've proposed this job as its own pull request, rather than waiting and attempting to introduce it with others, because I think this makes sense to review by itself (and I can incorporate any feedback into future changes), and because if I understand #1745 (comment) correctly it seems to be valued as a feature by itself (which I do agree with). I think that even if there are to be more Docker test jobs, they are better added in a subsequent PR.
However, I'm even more motivated by a goal that this PR does not itself achieve: testing on a bigendian architecture. Because GitPython uses git for most of its work, it shouldn't have a problem with that, but maybe some parts of gitdb/smmap that GitPython uses (for which GitPython's use is under test), or more importantly some seemingly innocuous aspects of encoding and decoding, might inadvertently assume little-endianness.
The good news is that no such bugs appear to be present. I have not yet gotten this to work on CI, but on my local amd64 system I am able to enable emulation and run s390x images. This is with no hardware acceleration, and some of the performance tests are too slow for me even to have waited for them to finish (which does not mean they would have a problem on an actual s390x machine). But when I tell pytest to deselect the performance tests, the remaining tests run in a reasonable time and all pass.
I'd like to do that on CI, which is not hard to do. If possible I'd like to use a workflow of this form, with the container key, and have it be a matrix job with both architectures, with special logic for enabling emulation and for skipping the performance tests for non-amd64 architectures (which would, initially and also probably forever, be just the one other architecture, s390x). I haven't managed to get it working that way, though. Using container:, the container is supposed to be able to start before any steps run. Even if I can manage to get emulation enabled without being able to easily run commands directly on the runner, I suspect I can't get that to happen early enough that using container: is both effective and reasonable.
If Docker test jobs for both amd64 and s390x architectures are to exist, I would want both to be written the same way, even if it makes the amd64 one less nice than in this PR. That way, it would be easier to compare their output to troubleshoot any future failures (as well as to understand how they are set up). If you have thoughts on whether or not this could be valuable, and also how much of a problem (if any) it would be to end up later converting the workflow to look more like that with fewer steps and not using container:, then that can guide me. However, whether or not you have guidance about that, I think this PR itself can probably stand on its own.
(I considered posting this section of the PR description as an issue instead, but I figured I'd put it here in case requested changes to this PR would substantially affect it or make it moot. and also because it provides a possible reason, beyond that discussed in #1745 (comment), to have Docker jobs like this one in the first place.)
Open Graph Description: As suggested in #1745 (comment), this adds a test job that runs the tests inside a Docker container.
This can be done with Ubuntu in the container, but instead I used Alpine Linux in the container....
X Description: As suggested in #1745 (comment), this adds a test job that runs the tests inside a Docker container.
This can be done with Ubuntu in the container, but instead I used Alpine Linux in the container....
Opengraph URL: https://github.com/gitpython-developers/GitPython/pull/1826
X: @github
direct link
Domain: redirect.github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:36bfc432-1524-740c-93d3-eaca453b190b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8812:23D54C:68C2AE:8BD116:69731113 |
| html-safe-nonce | c9f1f23b5b4c238dfbb608f6632174da21cfddb564f70e1cd0a638caee2b776d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODEyOjIzRDU0Qzo2OEMyQUU6OEJEMTE2OjY5NzMxMTEzIiwidmlzaXRvcl9pZCI6IjYzMDg5MjQzODk2NzYyMjQ3ODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 33c80a9634b0e7a278bd7930d70140d8d96240d6b296433f63a64c4e330a01dc |
| hovercard-subject-tag | pull_request:1728457145 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1826/files |
| twitter:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1771172?s=400&v=4 |
| og:image:alt | As suggested in #1745 (comment), this adds a test job that runs the tests inside a Docker container.
This can be done with Ubuntu in the container, but instead I used Alpine Linux in the container.... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#start-of-content |
|
| https://redirect.github.com/ |
|
Sign in
| https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F1826%2Ffiles |
| GitHub CopilotWrite better code with AI | https://github.com/features/copilot |
| GitHub SparkBuild and deploy intelligent apps | https://github.com/features/spark |
| GitHub ModelsManage and compare prompts | https://github.com/features/models |
| MCP RegistryNewIntegrate external tools | https://github.com/mcp |
| ActionsAutomate any workflow | https://github.com/features/actions |
| CodespacesInstant dev environments | https://github.com/features/codespaces |
| IssuesPlan and track work | https://github.com/features/issues |
| Code ReviewManage code changes | https://github.com/features/code-review |
| GitHub Advanced SecurityFind and fix vulnerabilities | https://github.com/security/advanced-security |
| Code securitySecure your code as you build | https://github.com/security/advanced-security/code-security |
| Secret protectionStop leaks before they start | https://github.com/security/advanced-security/secret-protection |
| Why GitHub | https://github.com/why-github |
| Documentation | https://docs.github.com |
| Blog | https://github.blog |
| Changelog | https://github.blog/changelog |
| Marketplace | https://github.com/marketplace |
| View all features | https://github.com/features |
| Enterprises | https://github.com/enterprise |
| Small and medium teams | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| App Modernization | https://github.com/solutions/use-case/app-modernization |
| DevSecOps | https://github.com/solutions/use-case/devsecops |
| DevOps | https://github.com/solutions/use-case/devops |
| CI/CD | https://github.com/solutions/use-case/ci-cd |
| View all use cases | https://github.com/solutions/use-case |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| View all industries | https://github.com/solutions/industry |
| View all solutions | https://github.com/solutions |
| AI | https://github.com/resources/articles?topic=ai |
| Software Development | https://github.com/resources/articles?topic=software-development |
| DevOps | https://github.com/resources/articles?topic=devops |
| Security | https://github.com/resources/articles?topic=security |
| View all topics | https://github.com/resources/articles |
| Customer stories | https://github.com/customer-stories |
| Events & webinars | https://github.com/resources/events |
| Ebooks & reports | https://github.com/resources/whitepapers |
| Business insights | https://github.com/solutions/executive-insights |
| GitHub Skills | https://skills.github.com |
| Documentation | https://docs.github.com |
| Customer support | https://support.github.com |
| Community forum | https://github.com/orgs/community/discussions |
| Trust center | https://github.com/trust-center |
| Partners | https://github.com/partners |
| GitHub SponsorsFund open source developers | https://github.com/sponsors |
| Security Lab | https://securitylab.github.com |
| Maintainer Community | https://maintainers.github.com |
| Accelerator | https://github.com/accelerator |
| Archive Program | https://archiveprogram.github.com |
| Topics | https://github.com/topics |
| Trending | https://github.com/trending |
| Collections | https://github.com/collections |
| Enterprise platformAI-powered developer platform | https://github.com/enterprise |
| GitHub Advanced SecurityEnterprise-grade security features | https://github.com/security/advanced-security |
| Copilot for BusinessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/premium-support |
| Pricing | https://github.com/pricing |
| Search syntax tips | https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax |
| documentation | https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax |
|
Sign in
| https://redirect.github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F1826%2Ffiles |
|
Sign up
| https://redirect.github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=gitpython-developers%2FGitPython |
| Reload | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
| Reload | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
| Reload | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
|
gitpython-developers
| https://redirect.github.com/gitpython-developers |
| GitPython | https://redirect.github.com/gitpython-developers/GitPython |
| Please reload this page | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
|
Notifications
| https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython |
|
Fork
964
| https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython |
|
Star
5k
| https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython |
|
Code
| https://redirect.github.com/gitpython-developers/GitPython |
|
Issues
170
| https://redirect.github.com/gitpython-developers/GitPython/issues |
|
Pull requests
8
| https://redirect.github.com/gitpython-developers/GitPython/pulls |
|
Discussions
| https://redirect.github.com/gitpython-developers/GitPython/discussions |
|
Actions
| https://redirect.github.com/gitpython-developers/GitPython/actions |
|
Security
3
| https://redirect.github.com/gitpython-developers/GitPython/security |
|
Insights
| https://redirect.github.com/gitpython-developers/GitPython/pulse |
|
Code
| https://redirect.github.com/gitpython-developers/GitPython |
|
Issues
| https://redirect.github.com/gitpython-developers/GitPython/issues |
|
Pull requests
| https://redirect.github.com/gitpython-developers/GitPython/pulls |
|
Discussions
| https://redirect.github.com/gitpython-developers/GitPython/discussions |
|
Actions
| https://redirect.github.com/gitpython-developers/GitPython/actions |
|
Security
| https://redirect.github.com/gitpython-developers/GitPython/security |
|
Insights
| https://redirect.github.com/gitpython-developers/GitPython/pulse |
| Sign up for GitHub
| https://redirect.github.com/signup?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://redirect.github.com/login?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose |
| Byron | https://redirect.github.com/Byron |
| gitpython-developers:main | https://redirect.github.com/gitpython-developers/GitPython/tree/main |
| EliahKagan:docker | https://redirect.github.com/EliahKagan/GitPython/tree/docker |
|
Conversation
3
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826 |
|
Commits
10
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits |
|
Checks
0
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/checks |
|
Files changed
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
| Please reload this page | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
|
Test in Docker with Alpine Linux on CI
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#top |
|
Show all changes
10 commits
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
|
44b8562
Test Alpine Linux on CI
EliahKagan Feb 8, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/44b856268d7c8259e4cce0d5ba560130201610c9 |
|
cefb53e
Work around different ownership in container
EliahKagan Feb 8, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/cefb53e32e814eb120b0e7d0405f7baa7bf8d8f1 |
|
a45d0b0
Use venv on Alpine Linux
EliahKagan Feb 13, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/a45d0b07509b40ac0701ba72d9d892c46b9ec386 |
|
5de954a
Run tests as non-root user in Alpine Linux
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/5de954a35d2953ca873eacaa0ce63525f7134914 |
|
ab37ae7
Add back safe.directory step
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/ab37ae7eb6d23e9d74178915ec9e072f67f0cfd1 |
|
46e4234
Debug ownership
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/46e4234116949b820741322eaedaee4389390934 |
|
20780cb
Take ownership of cloned repository
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/20780cb98db6d30a42ef7432ed065ea92325588e |
|
b32932f
Bring back venv
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/b32932f63e013413fb5150d881b67707ee650f22 |
|
bad545a
Re-remove safe.directory step
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/bad545ab36d37a1f89bb1dbb587130539498bc64 |
|
4b427c9
Factor venv activation into the venv creation step
EliahKagan Feb 14, 2024
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/commits/4b427c994833e1a2781c028ac80a11e1a6a64997 |
|
Clear filters
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
| Please reload this page | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
| Please reload this page | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files |
|
alpine-test.yml
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#diff-efd10bfc61f6e81e7ddbeefd3bdeeca82753c13039eef6bd293827199b7f0f4f |
|
test_util.py
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245 |
| .github/workflows/alpine-test.yml | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#diff-efd10bfc61f6e81e7ddbeefd3bdeeca82753c13039eef6bd293827199b7f0f4f |
|
View file
| https://redirect.github.com/EliahKagan/GitPython/blob/4b427c994833e1a2781c028ac80a11e1a6a64997/.github/workflows/alpine-test.yml |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/{{ revealButtonHref }} |
| test/test_util.py | https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245 |
|
View file
| https://redirect.github.com/EliahKagan/GitPython/blob/4b427c994833e1a2781c028ac80a11e1a6a64997/test/test_util.py |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/{{ revealButtonHref }} |
|
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245 |
|
| https://redirect.github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245 |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |
Viewport: width=device-width
URLs of crawlers that visited me.