Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-54346] && [JENKINS-55505] #56

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

roel0
Copy link

@roel0 roel0 commented Jan 9, 2019

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 roel0 changed the title [JENKINS-54346] tee keeps file open [JENKINS-54346] && [JENKINS-55505] Jan 10, 2019
@roel0
Copy link
Author

roel0 commented Jan 16, 2019

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.

@rsandell rsandell requested a review from jglick February 1, 2019 15:53
@tolnaisz
Copy link

tolnaisz commented Feb 6, 2019

Can you please have a look at #62 and give me your thoughts whether that solution will work for you as well?

@dia38
Copy link

dia38 commented Feb 8, 2019

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

@@ -49,15 +49,15 @@
import org.jenkinsci.plugins.workflow.steps.StepExecution;
import org.kohsuke.stapler.DataBoundConstructor;

public class TeeStep extends Step {
public class TeeStep extends Step implements Serializable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes no sense AFAICT, but anyway I think was due to be superseded by #62?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants