question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with Jenkins CI due to "sys.stdin.isatty" check

See original GitHub issue

When 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisrooverscommented, Mar 30, 2018

Great @pbregener, thanks! I’ll see if I can wrap this patch up properly over the weekend.

0reactions
pbregenercommented, Mar 30, 2018

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found