jenkinsci / java-client-api

A Jenkins API client for Java
MIT License
901 stars 470 forks source link

Failed to get build details when job is Pipeline Job #408

Open alexanderm2018 opened 5 years ago

alexanderm2018 commented 5 years ago

I tried to get consoleOutPutText for build.details.cosoleOutPutText and got 404 this job was created with the option below. Regular job was working fine. this is the first time when I deal with pipeline job. I really use your client a lot so hopefully I will get it fixed.

Pipeline Orchestrates long-running activities that can span multiple build agents. Suitable for building pipelines (formerly known as workflows) and/or organizing complex activities that do not easily fit in free-style job type.

khmarbaise commented 5 years ago

Do you have a complete example how you wrote the code? Which version of jenkins-api have you used and which Jenkins version?

alexanderm2018 commented 5 years ago

Jenkins ver. 2.177 Api is the latest from maven repo

com.offbytwo.jenkins jenkins-client 0.3.8
public String getConsoleOutPutAsTextByBuildNumber( String jobName, String buildNumber){
    String consoleText = null;
    try{
        consoleText = jenkinsServer.getJob(jobName).getBuildByNumber(Integer.valueOf(buildNumber)).details().getConsoleOutputText();
    }
    catch (Exception e) {
        logger.info("Failed to fetch cosole output {}", e.getLocalizedMessage());
    }
    return consoleText;
}
alexanderm2018 commented 5 years ago

Let me know if you need more information? Also is there is a help needed for the project?