pipeline-utility-steps-plugin
pipeline-utility-steps-plugin copied to clipboard
[JENKINS-54346] && [JENKINS-55505]
This pull requests fixed two jira tickets that were raised because of issues with the TeeStep on Windows. Both issues were caused by the fact that the outputstream to the file opened by the Tee step, was never closed.
The last sha1 seems to fix all the issues I'v seen, but it's a ugly dirty hack but for now the only possible way to be 100% sure, that after leaving the tee block, the output file is 100% closed. Maybe someone with more experience in the core architecture of Jenkins has a better solution.
Issues I've encoutered:
- The stream is opened multiple times and never closed
- When a statement in the tee code block, moves code execution to a slave node, the tee output file is reopened on that node, and you lose the possibility of closing that stream.
Can you please have a look at https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/62 and give me your thoughts whether that solution will work for you as well?
I'm test on my jenkins infra :
- master on jenkins 2.150.2 on red hat
- slave node windows
With it's script and Clean after checkout
enable .
pipeline
{
agent none
stages
{
stage('Build 1')
{
agent {
label 'windows'
}
steps
{
tee('Log1.txt')
{
sh 'ls -la'
echo "Build 1"
sleep 5
echo "Build 2"
}
}
}
stage('Build 2')
{
agent {
label 'windows'
}
steps
{
tee('Log2.txt')
{
sh 'ls -la'
echo "Build 3"
sleep 5
echo "Build 4"
}
}
}
}
}
With defect, in second stage (build 2
)
Log1.txt is corrupt
And Now ok