Skip to content

Conversation

@lne3
Copy link
Contributor

@lne3 lne3 commented Dec 20, 2023

Fixing JENKINS-72436

When running on z/OS always use the system's encoding for reading file jenkins-result.txt. System's encoding is provided in system property ibm.system.encoding.
No change in behavior for any other operating system.

Testing done

Successfully tested on a z/OS node the following pipeline:

pipeline {
    agent{node('zOS-node')}
    stages {
        stage('example for bugreport')   {
            steps {
                sh(script:'''#!/bin/sh -e
                    echo "UTF-8 output" | iconv -f 1047 -t utf-8''', 
                    encoding:'UTF-8')
                sh 'echo "native output"'
            }
        }
    }
}

Test pipeline output:

[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (example for bugreport)
[Pipeline] sh
UTF-8 output
[Pipeline] sh
+ echo native output 
native output
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

No automated tests for z/OS.

### Submitter checklist
- [x] Make sure you are opening from a **topic/feature/bugfix branch** (right side) and not your main branch!
- [x] Ensure that the pull request title represents the desired changelog entry
- [x] Please describe what you did
- [x] Link to relevant issues in GitHub or Jira
- [ ] Link to relevant pull requests, esp. upstream and downstream changes
- [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue

@lne3 lne3 requested a review from a team as a code owner December 20, 2023 15:30
@lne3
Copy link
Contributor Author

lne3 commented Dec 20, 2023

Test failures on linux due to docker container not ramping up properly.

@car-roll car-roll added the bug label Dec 20, 2023
@jglick
Copy link
Member

jglick commented Dec 20, 2023

Please be sure to check also #28, #76, & #80.

@lne3
Copy link
Contributor Author

lne3 commented Dec 20, 2023

After looking at #28, #76 and #80 I believe that #28 and #76 have been superseded by #80 with a more general solution and should be considered obsolete. #28 has been a (my) first attempt in 2016 making pipelines work on z/OS nodes. #76 is only a kind of proof of concept far from being ready to merge.

This PR #199 is a fix to the z/OS support introduced with PR #80.

Some more background from our end:
Since durable-task plugin version 1.29 (this is PR #80) we have been using it on z/OS with either sh step’s encoding parameter set to IBM1047 or without setting this parameter relying on system defaults.
Things became more complex when Pipeline Maven Integration (https://plugins.jenkins.io/pipeline-maven/) had to be used, since it is also generating scripts and having charset issues on z/OS. However, ugly workarounds with iconv tool for output and script source did the job.
Recent bumping of Java and Maven versions at our end caused the maven output changing from IBM1047 encoding to UTF-8. That made the required iconv workarounds even uglier such that fixing things in the Jenkins plugins itself is considered the better alternative.

@lne3
Copy link
Contributor Author

lne3 commented Jan 2, 2024

@car-roll, @jglick, can you help sorting out the docker failures that made the checks fail? Or provide hints what to do about it?
I suspect a problem in the CI environment totally unrelated to the changes of this PR.

@lne3
Copy link
Contributor Author

lne3 commented Jan 4, 2024

#201 has a possible solution for the issue (JENKINS-72488) causing the failure of checks of this PR.

@jglick jglick changed the title [JENKINS-72436] fix sh step on z/OS with encoding parameter set to UTF-8 hanging when trying to read jenkins-result.txt [JENKINS-72436] sh step on z/OS with encoding set to UTF-8 hangs when trying to read jenkins-result.txt Jan 4, 2024
lne3 and others added 2 commits January 5, 2024 07:51
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
…ipt.java

Co-authored-by: Jesse Glick <jglick@cloudbees.com>
@lne3 lne3 requested a review from jglick January 5, 2024 07:40
@lne3
Copy link
Contributor Author

lne3 commented Jan 5, 2024

@jglick , I applied all your requested changes. Doing it with two commits right after each other caused Jenkins to abort the build for the first commit (https://ci.jenkins.io/job/Plugins/job/durable-task-plugin/job/PR-199/7/) as it has been superseded by build for the second commit (https://ci.jenkins.io/job/Plugins/job/durable-task-plugin/job/PR-199/8/). Hence, github got not aware of all the review changes applied and claims one pending although it is in the code.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

From code inspection, should not affect other platforms, so 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants