Problem with Jenkins CI due to "sys.stdin.isatty" check
See original GitHub issueWhen using gitlint on Jenkins it doesn’t work as it does locally simply by executing “gitlint” to check the latest commit.
gitlint
Since on Jenkins there is not tty present the command simply fails with several cryptical warnings (probably because stdin is empty). When using the -d
option it tells me DEBUG: gitlint.lint Linting commit [SHA UNKNOWN]
which was even more confusing.
After reading the code and re-reading the documentation I ended up sucessfully using this:
git log -1 --pretty=%B | gitlint
This is a little cumbersome and it seems unecessary to base the decision whether to perform GitContext.from_local_repository
depending on if there is a TTY present or not.
Suggestions:
- Always use
from_local_repository
if there is a local repository AND (stdin is empty OR not tty). Use stdin in other cases. - Alternatively or additionally document this more clearly. Maybe a doc section on how to use gitlint with CI tools.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (8 by maintainers)
Top Results From Across the Web
python - sys-stdin-isatty not working in unittest using Popen
In my python script I use sys.stdin.isatty() to tell if there are lines to read from standard input (False means there are lines...
Read more >Python Examples of os.isatty - ProgramCreek.com
This page shows Python examples of os.isatty.
Read more >Jenkins hangs due to "Running CpsFlowExecution ...
When I check syslog, I see errors like this: Jun 30 16:07:18 jenkins [jenkins]: Jun 30, 2018 4:07:18 PM org.jenkinsci.plugins.workflow.support.concurrent.
Read more >Auto-generated output from python-black · 4d90c187a9 - jenkins-job ...
for job in jobs: # python-jenkins stores the folder and name as 'fullname'. # Check if the job was deleted when his parent...
Read more >PyInstaller Documentation - Read the Docs
Note: If you cannot use the pyinstaller command due to the scripts ... To verify that the installed python version supports execution in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great @pbregener, thanks! I’ll see if I can wrap this patch up properly over the weekend.
I can confirm that it works in GitLab CI, too, @jorisroovers! 👍 Let me know if you need more details, I might have some time tomorrow…