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

Adaptive Agent Manager #3339

Open
skobyda opened this issue May 31, 2023 · 15 comments
Open

Adaptive Agent Manager #3339

skobyda opened this issue May 31, 2023 · 15 comments
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci needs-fix security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request

Comments

@skobyda
Copy link

skobyda commented May 31, 2023

Repository URL

https://github.com/skobyda/jenkins-agent-manager/

New Repository Name

adaptive-agent-manager-plugin

Description

This plugin enables users to perform different administrative, maintenance, setup (pre-build), or cleanup (post-build) tasks on a specific agent each time a build is executed.

It functions differently from several similar plugins that typically allow users to define tasks
These plugins usually define these tasks as build-steps, therefore ties them only to a specific job. These tasks are then run everytime a build of this job is executed, regardless of the agent which executes it.

Adaptive Jenkins Agent plugin takes an opposite approach by allowing users to specify tasks to be run on a particular agent every time it executes a build, regardless of what build is being executed.

To accomplish this, the plugin allows users to define various tasks that should be executed on the agent before, during, or after any build. Users can also set conditions for these tasks, ensuring that they are only performed on the agent if the specified conditions are met.

GitHub users to have commit permission

@skobyda
@judovana

Jenkins project users to have release permission

skobyda
judovana

Issue tracker

GitHub issues

@skobyda skobyda added the hosting-request Request to host a component in jenkinsci label May 31, 2023
@github-actions
Copy link

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.

  • ⛔ Required: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.332.4</jenkins.version> to at least 2.361.4 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.41' should be at least '4.64' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @judovana (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @judovana (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: 'New Repository Name' must end with "-plugin" (disregard if you are not requesting hosting of a plugin)

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

@github-actions
Copy link

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.

  • ⛔ Required: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.332.4</jenkins.version> to at least 2.361.4 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.41' should be at least '4.64' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: 'New Repository Name' must end with "-plugin" (disregard if you are not requesting hosting of a plugin)

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

@github-actions
Copy link

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.

  • ⛔ Required: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.332.4</jenkins.version> to at least 2.361.4 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.41' should be at least '4.64' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)

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

1 similar comment
@github-actions
Copy link

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.

  • ⛔ Required: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.332.4</jenkins.version> to at least 2.361.4 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.41' should be at least '4.64' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)

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

@skobyda
Copy link
Author

skobyda commented May 31, 2023

/hosting re-check

@github-actions
Copy link

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.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: skobyda (reports are re-synced hourly, wait to re-check for a bit after logging in)

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

@jenkins-cert-app
Copy link
Collaborator

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 🎉.
  • /audit-skip => the audit is not necessary, the hosting can continue 🎉.
  • /audit-findings => the audit reveals some issues that require corrections ✏️.

Anyone:

  • /request-security-scan => the findings from the [Jenkins Security Scan](https://www.jenkins.io/doc/developer/security/scan/) were corrected, this command will re-scan your repository 🔍.
  • /audit-review => the findings from the audit were corrected, this command will ping the security team to review the findings 👀. It's only applicable when the previous audit required changes.

Only one command can be requested per comment.

(automatically generated message, version: 1.17.22)

@jenkins-cert-app jenkins-cert-app added the security-audit-todo The security team needs to audit the hosting request code label Jun 1, 2023
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan discovered 4 finding(s) 🔍.
For each of them, either apply the recommended correction, suppress the warning or provide a justification.

Once you're done, either re-run the scan with /request-security-scan or request the Security team to review your justifications with /audit-review.


Stapler: Missing POST/RequirePOST annotation

You can find detailed information about this finding here.

DuringBuildEntry.java#44
Potential CSRF vulnerability: If DescriptorImpl#doFillUnitItems connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
DurationPostBuild.java#26
Potential CSRF vulnerability: If DescriptorImpl#doFillUnitItems connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST

Stapler: Missing permission check

You can find detailed information about this finding here.

DuringBuildEntry.java#44
Potential missing permission check in DescriptorImpl#doFillUnitItems
DurationPostBuild.java#26
Potential missing permission check in DescriptorImpl#doFillUnitItems

@jenkins-cert-app jenkins-cert-app added security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request and removed security-audit-todo The security team needs to audit the hosting request code labels Jun 1, 2023
@skobyda
Copy link
Author

skobyda commented Jun 1, 2023

/hosting re-check

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

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 github-actions bot added bot-check-complete Automated hosting checks passed and removed needs-fix labels Jun 1, 2023
@NotMyFault
Copy link
Member

Hey @skobyda,

I have some feedback regarding your hosting request:

@mawinter69
Copy link
Contributor

Have you tested this plugin with pipeline jobs? I only see an implementation of a RunListener, this will never catch executions of node steps within a pipeline.
The implementation of onCompleted in the runlistener has a chance of causing strange problems. Unless you set an ordinal with a high negative number, there are chances that other runlisteners are run after yours.
The reboot action seems to be very dangerous. I don't see a sense to reboot an agent. Also the implementation via the shutdown command implies that the agent is running as user root(unix) or with admin priviliges (windows), something unlikely (at least on unix). Also I don't understand the purpose why one should want to reboot the agent. It will make 100% sure that all running jobs on that machine will fail.

@mawinter69
Copy link
Contributor

The gracefulreboot can't work in the way it is currently implemented.
You're waiting for the to runs to leave the isBuilding state. Now this method is called from the onCompleted method in your runlistener. At that point in time, the run is still in the isBuilding state. Thus for this particular run the isBuilding is always true and it will run forever until you manually kill the job.

@judovana
Copy link
Contributor

hi! I'm afraid original opener disappeared. He is not even responding to request to transfer ownership gh issue. Also I'm afraid the plugin was never trully testd in real environment, so from taht point I doubt it ever seen pipelines. however the idea is cool (especially due to its own extension points), I'm afraid the plugin is sentenced to fall to oblivion

@judovana
Copy link
Contributor

judovana commented Jan 14, 2024

I don't see a sense to reboot an agent. Also the implementation via the shutdown command implies that the agent is running as > user root(unix) or with admin priviliges (windows), something unlikely (at least on unix). Also I don't understand the purpose why > one should want to reboot the agent. It will make 100% sure that all running jobs on that machine will fail.

the reboot is necessary part of workflow, where you need both of - really real HW, and really change the running kernel. Once those two conditions are met, thy are quite hard to control.

In such envireonemt you usually have one job per node, or at least the jobs keeps communicating, so the reboot is "agreed".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci needs-fix security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request
Projects
None yet
Development

No branches or pull requests

5 participants