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-50392] Get the exit code the correct way #300

Merged
merged 10 commits into from
Jun 13, 2018

Conversation

carlossg
Copy link
Contributor

Use the error websocket stream to get the info

Depends on fabric8io/kubernetes-client#1045

@carlossg carlossg changed the title [WIP] [JENKINS-50392] Get the exit code the correct way [JENKINS-50392] Get the exit code the correct way Mar 26, 2018
@giannello
Copy link

@carlossg would you mind letting me know when this is ready to be tested?

@carlossg
Copy link
Contributor Author

All tests passing, it's ready with the fabric8 PR

@giannello
Copy link

Awesome, will give it a spin. Thanks!

@giannello
Copy link

@carlossg confirmed working!

11:39:35 Executing shell script inside container [maven] of pod [maven-docker-jdbt4-j7rdt]
11:39:36 Executing command: "printenv" "MAVEN_HOME" 
11:39:36 exit
11:39:36 /usr/share/maven
11:39:36 [withMaven] using Maven installation provided by the build agent with the environment variable MAVEN_HOME=/usr/share/maven

No more stray EXITCODE, thanks for the amazingly quick fix!

@carlossg carlossg self-assigned this Apr 6, 2018
@balihb
Copy link

balihb commented May 2, 2018

anything I can help with this?

@carlossg
Copy link
Contributor Author

carlossg commented May 2, 2018

something you can help with is test and +1 at fabric8io/kubernetes-client#1045

@carlossg
Copy link
Contributor Author

carlossg commented May 2, 2018

@balihb
Copy link

balihb commented May 15, 2018

works great!!!

my test cases:

    cxnBuildStage ('env chk') {
      withEnv(['VARTOPRINT=vartoprint']) {
        if(sh(script: "echo \$VARTOPRINT", returnStdout: true).trim() != 'vartoprint') {
          error('env var not propagated to shell')
        }
      }
    }

    cxnBuildStage ('sshagent chk') {
      sshagent(['ssh-user']) {
        if(sh(script: "ssh -o StrictHostKeyChecking=no ssh-user@sshserver 'echo something'", returnStdout: true).trim() != 'something') {
          error('nothing printed via ssh')
        }
      }
    }

    cxnBuildStage ('withRun') {
      docker.image('mysql:5').withRun('-e "MYSQL_ROOT_PASSWORD=my-secret-pw"') { c ->
        def mysqlIp = sh(script: "docker inspect -f {{.NetworkSettings.IPAddress}} ${c.id}", returnStdout: true).trim()
        timeout(1) {
          sh "while ! mysqladmin ping -h${mysqlIp} --silent; do sleep 1; done"
        }
      }
    }

    cxnBuildStage ('build') {
      sh './gradlew build'
    }

@jenkinsci jenkinsci deleted a comment from balihb May 23, 2018
@carlossg
Copy link
Contributor Author

To @balihb and others that received his comment, please do not disclose security issues publicly, use https://issues.jenkins-ci.org/browse/SECURITY
That said, there is already one filed.

@balihb
Copy link

balihb commented May 23, 2018

this is a security issue with this PR.

@carlossg
Copy link
Contributor Author

carlossg commented Jun 4, 2018

The security issue is now public and fixed in 1.7.1, it was not just with this PR
https://github.com/jenkinsci/kubernetes-plugin/blob/master/CHANGELOG.md#171

@carlossg carlossg removed the on hold label Jun 12, 2018
@carlossg carlossg merged commit c08dad8 into master Jun 13, 2018
@carlossg carlossg deleted the JENKINS-50392-exit-code branch June 13, 2018 12:11
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.

3 participants