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

13 views
Skip to first unread message

Danny Trunk

unread,
Oct 18, 2020, 10:18:21 AM10/18/20
to jenkins...@googlegroups.com
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.
Reply all
Reply to author
Forward
0 new messages