jenkins-infra / repository-permissions-updater

Artifactory permissions synchronization tool and data set
79 stars 1.05k forks source link

Job Environment Variables Status Sync #4104

Closed kun303-cloud closed 1 month ago

kun303-cloud commented 1 month ago

Repository URL

https://github.com/kun303-cloud/environment-variables-status-sync

New Repository Name

environment-variables-status-sync-plugin

Description

The plugin offers a seamless integration framework for developers across various platforms, enabling them to effortlessly monitor and engage with Jenkins pipelines. This plugin facilitates external systems to:

By adopting this plugin, platform developers can significantly enhance their continuous integration and continuous deployment (CI/CD) processes, all with minimal configuration overhead. All that's required is to specify the request URL and pertinent details within the Jenkins system settings, and the plugin seamlessly manages the communication bridge between Jenkins and external platforms, streamlining integration and collaboration.

GitHub users to have commit permission

@kun303-cloud

Jenkins project users to have release permission

thomson_519

Issue tracker

Jira

github-actions[bot] commented 1 month ago

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

jenkins-cert-app commented 1 month ago

Security audit, information and commands

The security team is auditing all the hosting requests, to ensure a better security by default.

This message informs you that a Jenkins Security Scan was triggered on your repository. It takes ~10 minutes to complete.

Commands The bot will parse all comments, and it will check if any line start with a command. Security team only:
  • /audit-ok => the audit is complete, the hosting can continue :tada:.
  • /audit-skip => the audit is not necessary, the hosting can continue :tada:.
  • /audit-findings => the audit reveals some issues that require corrections :pencil2:.
Anyone:
  • /request-security-scan => the findings from the Jenkins Security Scan were corrected, this command will re-scan your repository :mag:.
  • /audit-review => the findings from the audit were corrected, this command will ping the security team to review the findings :eyes:. It's only applicable when the previous audit required changes.
Only one command can be requested per comment.

(automatically generated message, version: 1.29.12)

github-actions[bot] commented 1 month ago

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

jenkins-cert-app commented 1 month ago

The Jenkins Security Scan discovered 1 finding(s) :mag:.

Please follow the instructions below for every identified issues:

After addressing the findings through one of the above methods:


Jenkins: Plaintext password storage

You can find detailed information about this finding here.

HttpHeader.java#18 ``` Field should be reviewed whether it stores a password and is serialized to disk: headerKey ```
github-actions[bot] commented 1 month ago

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

kun303-cloud commented 1 month ago

/request-security-scan

kun303-cloud commented 1 month ago

/audit-review

kun303-cloud commented 1 month ago

/hosting host

jenkins-cert-app commented 1 month ago

The Jenkins Security Scan did not find anything dangerous with your plugin, congratulations! :tada:


:bulb: The Security team recommends that you are setting up the scan in your repository by following our guide.

kun303-cloud commented 1 month ago

/hosting host

mawinter69 commented 1 month ago

Please use a dedicated package for you classes and don't put it directly under io.jenkins.plugins e.g. io.jenkins.plugins.env_variables_status_sync or whatever you prefer.

kun303-cloud commented 1 month ago

@mawinter69 I have made the requested changes:

Moved my classes to a dedicated package io.jenkins.plugins.env_variables_status_sync. Removed the unnecessary dependency from the POM file, as it is provided by the parent POM. Also removed the version from the dependency since it is managed via the BOM. Please let me know if further changes are needed.

kun303-cloud commented 1 month ago

/hosting host

github-actions[bot] commented 1 month ago

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

github-actions[bot] commented 1 month ago

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

timja commented 1 month ago

Hi, a bit of feedback, nothing too major:

  1. Lombok should be provided not compile scope https://github.com/kun303-cloud/environment-variables-status-sync/blob/main/pom.xml#L73, see https://projectlombok.org/setup/maven
  2. I don't see any code for handling proxies, should use the Jenkins ProxyConfiguration class : https://github.com/kun303-cloud/environment-variables-status-sync/blob/main/src/main/java/io/jenkins/plugins/env_variables_status_sync/utils/HttpClient.java
  3. I don't think you need to call save() in both configure and the settters, I would just do it in the configure method: https://github.com/kun303-cloud/environment-variables-status-sync/blob/main/src/main/java/io/jenkins/plugins/env_variables_status_sync/JobRunListenerSysConfig.java#L53
  4. This could be simplified by using something like f:select and adding doFillxxxItems on the server side, see https://weekly.ci.jenkins.io/design-library/Select/
mawinter69 commented 1 month ago

1.Regarding the save() you might want to use BulkChange and keep the save() in each setter

try (BulkChange bc = new BulkChange(this)) {
        requestUrl = json.getString(FORM_KEY_REQUEST_URL);
        setRequestUrl(requestUrl);
        // 读取并设置httpHeaders
        httpHeaders = req.bindJSONToList(HttpHeader.class, json.get(FORM_KEY_REQUEST_HEADERS));
        setHttpHeaders(httpHeaders);
        String requestMethodOption = json.getString(FORM_KEY_REQUEST_METHOD);
        setRequestMethod(HttpMethod.valueOf(requestMethodOption));
        bc.commit();
} catch (IOException e) {
      LOGGER.log(Level.WARNING, "Failed to save " + getConfigFile(), e);
}

This avoids that save is called several times during configure but also allows to call the setters from somewhere else and the config is properly saved to disk

kun303-cloud commented 1 month ago

@mawinter69 I have made the requested changes:

Please let me know if further changes are needed. Thank you for your feedback!

timja commented 1 month ago

/hosting host

jenkins-infra-bot commented 1 month ago

Hosting request complete, the code has been forked into the jenkinsci project on GitHub as https://github.com/jenkinsci/environment-variables-status-sync-plugin

A Jira component named [environment-variables-status-sync-plugin](https://issues.jenkins.io/issues/?jql=project+%3D+JENKINS+AND+component+%3D+ environment-variables-status-sync-plugin)has also been created with thomson_519 as the default assignee for issues.

A pull request has been created against the repository permissions updater to setup release permissions. Additional users can be added by modifying the created file.

Please delete your original repository (if there are no other forks), under 'Danger Zone', so that the jenkinsci organization repository is the definitive source for the code. If there are other forks, please contact GitHub support to make the jenkinsci repo the root of the fork network (mention that Jenkins approval was given in support request 569994). Also, please make sure you properly follow the documentation on documenting your plugin so that your plugin is correctly documented.

You will also need to do the following in order to push changes and release your plugin:

Welcome aboard!