jenkins-rest icon indicating copy to clipboard operation
jenkins-rest copied to clipboard

ChangeSet not have value

Open ChenAdminChen opened this issue 3 years ago • 4 comments
trafficstars

jenkins version: Jenkins 2.357

I use java code, not have changeSet information

JenkinsClient client = JenkinsClient.builder()
                .endPoint("http://127.0.0.1:8080") // Optional. Defaults to http://127.0.0.1:8080
                .credentials("admin:admin") // Optional.
                .build();

        JobsApi jobsApi = client.api().jobsApi();

        BuildInfo buildInfo = jobsApi.buildInfo(null, "test", 36);
        System.out.println(buildInfo);
// buildInfo.changeSets is 0

I use rest api , have changeSet information

curl http://127.0.0.1:8080/job/test/36/api/json

result: { ....... "changeSet": { "_class": "hudson.scm.SubversionChangeLogSet", "items": [ { "_class": "hudson.scm.SubversionChangeLogSet$LogEntry", "affectedPaths": [ "test/src/main/resources/application-dev.yml" ], "author": { "absoluteUrl": "http://127.0.0.1:8080/user/admin", "fullName": "admin" }, "commitId": "450", "timestamp": 1655719517084, "date": "2022-06-20T10:05:17.084449Z", "msg": "+ 调整redis database", "paths": [....], ....... },

ChenAdminChen avatar Jul 05 '22 03:07 ChenAdminChen

@ChenAdminChen have a look at THIS CODE and see if that works out for you.

cdancy avatar Jul 06 '22 18:07 cdancy

I

@ChenAdminChen have a look at THIS CODE and see if that works out for you.

I found out the cause of the problem, the http://127.0.0.1:8080/job/test/36/api/json API return changeSet but not changeSets, and the changeSet is Object but not List Conllection

I pull code and adjust the code, is ok image

I use jenkins version is 2.357, I don't know if it's a version problem???

ChenAdminChen avatar Jul 07 '22 01:07 ChenAdminChen

i have the same problem , and i found it call "changeSet" in FreeStyleProject and call "changeSets" in WorkflowJob. maybe it should be become the same

dongxishaonian avatar Jan 12 '23 03:01 dongxishaonian

If someone would like to send in a PR for this quickfix I'd be more than happy to merge it and kick a new release.

cdancy avatar Jan 12 '23 14:01 cdancy