pipeline-utility-steps-plugin icon indicating copy to clipboard operation
pipeline-utility-steps-plugin copied to clipboard

[JENKINS-54346] && [JENKINS-55505]

Open roel0 opened this issue 6 years ago • 3 comments

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.

roel0 avatar Jan 09 '19 13:01 roel0

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.

roel0 avatar Jan 16 '19 11:01 roel0

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?

tolnaisz avatar Feb 06 '19 14:02 tolnaisz

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) image Log1.txt is corrupt

And Now ok image

dia38 avatar Feb 08 '19 13:02 dia38