Jenkins Console Output: declarative pipeline + sh + python line-buffered

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Jenkins Console Output: declarative pipeline + sh + python line-buffered

Danny Trunk
Hello everybody,

I've set up a declarative pipeline job using the sh step to run repo (which is a tool written in python - more information: https://source.android.com/setup/develop#repo)
But I can't get stdout to be line-buffered.

I've already tried the following:
* `export PYTHONUNBUFFERED=1` in the sh block before calling repo.
* setting PYTHONUNBUFFERED=1 in the environment block
* using `stdbuf -i0 -e0 -o0 repo sync ...` instead of calling `repo sync ...` directly
* combined all of the above

I can't see any repo progress in the build console.

By running the command manually in a bash I'm getting this output:
```
root@jenkins-lineage:/var/jenkins_home/workspace/lineage# repo sync -j 2 --force-sync
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
Fetching projects:   0% (1/774) LineageOS/android_artremote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
Fetching projects:   0% (2/774) LineageOS/androidremote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
Fetching projects:   0% (3/774) LineageOS/android_bionicremote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
Fetching projects:   0% (5/774) platform/build/katiremote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
Fetching projects:   0% (6/774) LineageOS/android_build_blueprintremote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0        
Fetching projects:   1% (10/774) platform/developers/build^Caborted by user
```

Here's an example of how I call repo:
```
sh """#!/bin/bash
repo init -u ${REPOSITORY_URL} -b ${params.BRANCH} --depth=1
repo sync -j ${params.SYNC_THREADS} --force-sync
"""
```


So how I can get more information from repo in the Jenkins build console?

Danny.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ODIEIQ.TBP9FP8IA0TP2%40gmail.com.