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

解决修改配置导致的中文乱码问题 #233

Merged
merged 3 commits into from
May 17, 2022

Conversation

songhanlin
Copy link
Contributor

Please do not create a Pull Request without first creating an ISSUE.
Any change needs to be discussed before proceeding.
Failure to do so may result in the rejection of the Pull Request.

Explain the details for making this change: What existing problem does the Pull Request solve? Why is this feature beneficial?

On adding new feautes/endpoints

No more than 1 endpoint should be coded within a Pull Request.
This alone requires enough code to review and adding more than 1 WILL result in your Pull Request either being ignored or rejected outright.

On adding Mock and Integ Tests

At least 2 mock tests and 2 integ tests are required prior to merging.
Each pair should should test what the success and failure of added change looks like.
More complicated additions will of course require more tests.

On CI testing (currently using travis)

Code will not be reviewed until CI passes.
Current CI does NOT exercise integ tests and so each Pull Request will have to be run manually by one of the maintainers to confirm it works as expected: please be patient.

On automtatic closing of ISSUES

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

@songhanlin
Copy link
Contributor Author

#166

@cdancy
Copy link
Owner

cdancy commented May 9, 2022

@songhanlin were you hitting an issue that made you want to incorporate this change?

EDIT: OK I see now ... instead of html should we be using xml?

@martinda
Copy link
Collaborator

martinda commented May 9, 2022

I tried to reproduce this locally by using Chinese characters but I could not. I also tried non-English latin characters and still no luck in reproducing. But the change proposed seems to have no negative impact in my limited testing.

@songhanlin
Copy link
Contributor Author

songhanlin commented May 10, 2022

first, sorry about my bad english;

  1. when I create a job, I get this:
    image
  2. I update this job's config and I get this
    image
  3. sorry, i forget xml, and i use @produces(MediaType.APPLICATION_XML + ";charset=UTF-8") to update config, and i get this
    image

Jenkins: i download it whit homebrew, and i didn't update chatset setting;

@songhanlin
Copy link
Contributor Author

My test code like this:

  1. create
public void testCreateJob() {
        JenkinsClient client = JenkinsClient.builder()
            .endPoint("http://127.0.0.1:8080")
            .credentials("admin:123456").build();

        String configXML = payloadFromResource("/freestyle-project.xml");
        JobsApi api = client.api().jobsApi();
        api.create(null,"DevTest", configXML);
    }
  1. update
public void testUpdateConfig() {
        JenkinsClient client = JenkinsClient.builder()
            .endPoint("http://127.0.0.1:8080")
            .credentials("admin:123456").build();

        String configXML = payloadFromResource("/freestyle-project.xml");
        JobsApi api = client.api().jobsApi();
        api.config(null,"DevTest", configXML);
    }

@duhuangwen
Copy link

我也遇到了这个问题,在使用Jenkins-rest 创建pipeline job 时,我的节点标签,参数,以及 stage 名称 都包含中文,可以正常创建job ,执行构建时,就一直卡在那。。。。jenkins-client 这个api 通过手动发起post 请求 可以暂时解决,但是我更希望用官方的api 来实现我的功能

@cdancy cdancy merged commit 4821ccc into cdancy:master May 17, 2022
@cdancy cdancy added this to the v1.0.1 milestone May 17, 2022
@cdancy
Copy link
Owner

cdancy commented May 17, 2022

Version 1.0.1 has been released.

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

Successfully merging this pull request may close these issues.

4 participants