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: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:7a4e0cb5-5334-da91-1d6f-6bf4d892d7ba
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB528:288A3F:281839:38CD6E:6968D6CB
html-safe-nonce452823cd43c3b5b3d2a415efc08e603327a0d5f38113dedd3677446d41e15170
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTI4OjI4OEEzRjoyODE4Mzk6MzhDRDZFOjY5NjhENkNCIiwidmlzaXRvcl9pZCI6Ijc4MTUyNjQzNDc3NDk5MzA2OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac6bc8717bfcc1e6ca880e530670da98ed01a51ad9bc9bb2941728a1d6f5a22886
hovercard-subject-tagpull_request:1728457145
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/gitpython-developers/GitPython/pull/1826/files
twitter:imagehttps://avatars.githubusercontent.com/u/1771172?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1771172?s=400&v=4
og:image:altAs 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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3c4e9f2fc1db52c609205138be6a397cfde4574cb54d53015014de30dd49f27e
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126087
octolytics-dimension-repository_nwogitpython-developers/GitPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126087
octolytics-dimension-repository_network_root_nwogitpython-developers/GitPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1fb1ea11f8c37dd4dd50347cca70d89824e93788
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/gitpython-developers/GitPython/pull/1826/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F1826%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2FGitPython%2Fpull%2F1826%2Ffiles
Sign up https://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
Reloadhttps://github.com/gitpython-developers/GitPython/pull/1826/files
Reloadhttps://github.com/gitpython-developers/GitPython/pull/1826/files
Reloadhttps://github.com/gitpython-developers/GitPython/pull/1826/files
gitpython-developers https://github.com/gitpython-developers
GitPythonhttps://github.com/gitpython-developers/GitPython
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1826/files
Notifications https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Fork 964 https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Star 5k https://github.com/login?return_to=%2Fgitpython-developers%2FGitPython
Code https://github.com/gitpython-developers/GitPython
Issues 169 https://github.com/gitpython-developers/GitPython/issues
Pull requests 8 https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/gitpython-developers/GitPython/security
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1826/files
Insights https://github.com/gitpython-developers/GitPython/pulse
Code https://github.com/gitpython-developers/GitPython
Issues https://github.com/gitpython-developers/GitPython/issues
Pull requests https://github.com/gitpython-developers/GitPython/pulls
Discussions https://github.com/gitpython-developers/GitPython/discussions
Actions https://github.com/gitpython-developers/GitPython/actions
Security https://github.com/gitpython-developers/GitPython/security
Insights https://github.com/gitpython-developers/GitPython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgitpython-developers%2FGitPython%2Fissues%2Fnew%2Fchoose
Byronhttps://github.com/Byron
gitpython-developers:mainhttps://github.com/gitpython-developers/GitPython/tree/main
EliahKagan:dockerhttps://github.com/EliahKagan/GitPython/tree/docker
Conversation 3 https://github.com/gitpython-developers/GitPython/pull/1826
Commits 10 https://github.com/gitpython-developers/GitPython/pull/1826/commits
Checks 0 https://github.com/gitpython-developers/GitPython/pull/1826/checks
Files changed https://github.com/gitpython-developers/GitPython/pull/1826/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1826/files
Test in Docker with Alpine Linux on CI https://github.com/gitpython-developers/GitPython/pull/1826/files#top
Show all changes 10 commits https://github.com/gitpython-developers/GitPython/pull/1826/files
44b8562 Test Alpine Linux on CI EliahKagan Feb 8, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/44b856268d7c8259e4cce0d5ba560130201610c9
cefb53e Work around different ownership in container EliahKagan Feb 8, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/cefb53e32e814eb120b0e7d0405f7baa7bf8d8f1
a45d0b0 Use venv on Alpine Linux EliahKagan Feb 13, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/a45d0b07509b40ac0701ba72d9d892c46b9ec386
5de954a Run tests as non-root user in Alpine Linux EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/5de954a35d2953ca873eacaa0ce63525f7134914
ab37ae7 Add back safe.directory step EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/ab37ae7eb6d23e9d74178915ec9e072f67f0cfd1
46e4234 Debug ownership EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/46e4234116949b820741322eaedaee4389390934
20780cb Take ownership of cloned repository EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/20780cb98db6d30a42ef7432ed065ea92325588e
b32932f Bring back venv EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/b32932f63e013413fb5150d881b67707ee650f22
bad545a Re-remove safe.directory step EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/bad545ab36d37a1f89bb1dbb587130539498bc64
4b427c9 Factor venv activation into the venv creation step EliahKagan Feb 14, 2024 https://github.com/gitpython-developers/GitPython/pull/1826/commits/4b427c994833e1a2781c028ac80a11e1a6a64997
Clear filters https://github.com/gitpython-developers/GitPython/pull/1826/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1826/files
Please reload this pagehttps://github.com/gitpython-developers/GitPython/pull/1826/files
alpine-test.yml https://github.com/gitpython-developers/GitPython/pull/1826/files#diff-efd10bfc61f6e81e7ddbeefd3bdeeca82753c13039eef6bd293827199b7f0f4f
test_util.py https://github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245
.github/workflows/alpine-test.ymlhttps://github.com/gitpython-developers/GitPython/pull/1826/files#diff-efd10bfc61f6e81e7ddbeefd3bdeeca82753c13039eef6bd293827199b7f0f4f
View file https://github.com/EliahKagan/GitPython/blob/4b427c994833e1a2781c028ac80a11e1a6a64997/.github/workflows/alpine-test.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/1826/{{ revealButtonHref }}
test/test_util.pyhttps://github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245
View file https://github.com/EliahKagan/GitPython/blob/4b427c994833e1a2781c028ac80a11e1a6a64997/test/test_util.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/gitpython-developers/GitPython/pull/1826/{{ revealButtonHref }}
https://github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245
https://github.com/gitpython-developers/GitPython/pull/1826/files#diff-62b93f19eeb2c5ff6e26eaccf3f63ee6641e87f3a6ccfc2ffb0dec86925ae245
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.