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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages 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 Developers" 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-dev/M3FEIQ.X40JKJN2UW843%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

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

Baptiste MATHUS
Hi,

Please use the users mailing list for such questions.

This list is dedicated to Jenkins development itself. Developing plugins or Jenkins Core itself 

Thank you

Thank you

Le dim. 18 oct. 2020 à 16:10, Danny Trunk <[hidden email]> a écrit :
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 Developers" 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-dev/M3FEIQ.X40JKJN2UW843%40gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/CANWgJS62whWj9SM_c0pk2YHfwTQR-O6S_YzjJry%2BHvSQe5GCSQ%40mail.gmail.com.