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

Add spotVM and maxRunDuration feature to VM provisioning #492

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

gbhat618
Copy link

@gbhat618 gbhat618 commented Dec 11, 2024

Summary

This PR aims to enhance the VM provisioning capabilities of the google-compute-engine-plugin by introducing support for Spot VMs and maxRunDuration. This effort seeks to address the issues reported in #408, #473, and #358.

Enhancements

  • Spot VM Support: Incorporates the option to use Spot VMs, providing a cost-effective and efficient alternative to preemptible VMs without the automatic deletion after 24 hours.
  • maxRunDuration: Implements the maxRunDuration feature, enabling the automatic deletion of VMs after a specified duration to optimize resource utilization and cost.

Rationale

Although this plugin already has a background cleanup job for leftover orphan agent VMs, setting the maxRunDuration ensures that VMs deletion still happens even if the Jenkins controller itself has crashed. Besides this is an optional setting with no defaults enforced, so this feature is not trying to replace/interfere with the existing background job.

Technical Background

The plugin now supports the following VM options:

  • Standard VMs: Regular VM instances with guaranteed availability by GCP SLA and standard pricing. Also supports maxRunDuration.
  • Spot VMs: An updated version of Preemptible VMs, offering exactly same cost benefits without the restriction of automatic deletion after 24 hours.
  • Preemptible VMs: Cost-effective VM instances with limited availability, reclaimed by GCE after 24 hours.
Why Maintain Support for Both Spot and Preemptible VMs?

Despite the similarities between Spot and Preemptible VMs, retaining support for both options is essential for the following reasons:

  • Non-Deprecation by GCP: Google Cloud Platform does not plan to deprecate Preemptible VMs.
  • Backward Compatibility: Many Jenkins controllers are configured to use Preemptible VMs. Dropping support will disrupt existing setups.
  • Clear Differentiation: Retaining both options avoids confusion and simplifies the user experience, requiring no changes upon plugin upgrade.

Testing Status

Manual Tests: Screen recording and screenshots

User experience configuration page

provisioning_type_impl_2.mov

VM Provisioned in GCP

Description Content
Spot VM provisioned with max run duration 1200s
Standard VM provisioned with max run duration 600s
Preemptible VM as before

→ Unit tests for the scheduling() method, ensuring the compatibility with the old and new configurations.

New integration test for the Spot VM with Max Duration: logs
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.google.jenkins.plugins.computeengine.integration.SpotVmProvisioningWithMaxRunDurationCasCIT
=== Starting com.google.jenkins.plugins.computeengine.integration.SpotVmProvisioningWithMaxRunDurationCasCIT
   0.042 [id=20]	INFO	o.jvnet.hudson.test.WarExploder#explode: Exploding /Users/gbhat/.m2/repository/org/jenkins-ci/main/jenkins-war/2.452.3/jenkins-war-2.452.3.war into /Users/gbhat/CBProjects/google-compute-engine-plugin/target/jenkins-for-test
   1.309 [id=20]	INFO	o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:51223/jenkins/
   1.508 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
   2.139 [id=34]	WARNING	hudson.ClassicPluginStrategy#createClassJarFromWebInfClasses: Created /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/powershell/WEB-INF/lib/classes.jar; update plugin to a version created with a newer harness
   2.156 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/jakarta-mail-api.jpi
   2.168 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/mailer.jpi
   2.174 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/jakarta-activation-api.jpi
   2.182 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/display-url-api.jpi
   2.185 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/instance-identity.jpi
   2.192 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/matrix-auth.jpi
   2.219 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/echarts-api.jpi
   2.465 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/junit.jpi
   2.473 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/jquery3-api.jpi
   2.480 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/matrix-project.jpi
   2.490 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/checks-api.jpi
   2.496 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/command-launcher.jpi
   2.501 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/jdk-tool.jpi
   2.509 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/mina-sshd-api-common.jpi
   2.520 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/mina-sshd-api-core.jpi
   2.532 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/sshd.jpi
   2.540 [id=34]	INFO	hudson.PluginManager#considerDetachedPlugin: Loading a detached plugin as a dependency: /var/folders/80/w8mmdy513sb3y9fp5fr7vvqc0000gn/T/jenkins14574315334497078044/plugins/javax-mail-api.jpi
   2.797 [id=52]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
   2.804 [id=33]	INFO	j.b.api.BouncyCastlePlugin#start: /Users/gbhat/CBProjects/google-compute-engine-plugin/target/tmp/j h5062213579381787349/plugins/bouncycastle-api/WEB-INF/optional-lib not found; for non RealJenkinsRule this is fine and can be ignored.
   3.590 [id=38]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
   3.595 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
   3.595 [id=53]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
   3.983 [id=50]	INFO	jenkins.InitReactorRunner$1#onAttained: System config loaded
   4.013 [id=47]	INFO	jenkins.InitReactorRunner$1#onAttained: System config adapted
   4.013 [id=47]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
   4.013 [id=51]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
   4.080 [id=43]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
   4.122 [id=20]	INFO	c.g.j.p.c.i.SpotVmProvisioningWithMaxRunDurationCasCIT#init: init
   5.526 [id=20]	INFO	c.g.j.p.c.i.SpotVmProvisioningWithMaxRunDurationCasCIT#init: init complete
   5.588 [id=20]	WARNING	i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class com.google.jenkins.plugins.computeengine.InstanceConfiguration#sshKeyCredential: type is abstract but not Describable.
   5.596 [id=20]	WARNING	i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class com.google.jenkins.plugins.computeengine.InstanceConfiguration#sshKeyCredential: type is abstract but not Describable.
   5.611 [id=20]	INFO	c.g.j.p.c.ComputeEngineCloud#provision: Provisioning node from configs [com.google.jenkins.plugins.computeengine.InstanceConfiguration@11481013] for excess workload of 1 units of label 'integration'
   6.874 [id=20]	INFO	c.g.j.p.c.ComputeEngineCloud#availableNodeCapacity: Found capacity for 10 nodes in cloud integration
   6.879 [id=20]	INFO	c.g.j.p.c.InstanceConfiguration#instance: User selected to use an autogenerated ssh key pair
   9.585 [id=20]	INFO	c.g.j.p.c.InstanceConfiguration#provision: Sent insert request for instance configuration [max-run-duration]
   9.591 [id=103]	INFO	c.g.j.p.c.ComputeEngineComputerLauncher#launch: Launch will wait 300000 for operation operation-1734697519485-629b2bd7113b5-957566d9-cc39c8ba to complete...
   9.607 [id=106]	INFO	c.g.j.p.c.ComputeEngineCloud#lambda$getPlannedNodeFuture$0: Waiting 300000ms for node max-run-duration-sddftg to connect
  24.746 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Launching instance: max-run-duration-sddftg
  24.747 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: bootstrap
  24.748 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Getting keypair...
  24.749 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Using autogenerated ssh keypair
  24.750 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Authenticating as jenkins
  26.246 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connecting to 35.231.237.125 on port 22, with timeout 10000.
  30.549 [id=103]	WARNING	c.g.j.p.c.ComputeEngineCloud#log: An error occured: There was a problem while connecting to 35.231.237.125:22
  37.223 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connecting to 35.231.237.125 on port 22, with timeout 10000.
  37.481 [id=103]	WARNING	c.g.j.p.c.ComputeEngineCloud#log: An error occured: There was a problem while connecting to 35.231.237.125:22
  44.066 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connecting to 35.231.237.125 on port 22, with timeout 10000.
  46.164 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connected via SSH.
  47.342 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Verifying: /usr/bin/java -fullversion
  49.386 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Copying agent.jar to: /tmp
  52.834 [id=103]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Launching Jenkins agent via plugin SSH: /usr/bin/java -jar /tmp/agent.jar
  87.375 [id=103]	INFO	c.g.j.p.c.ComputeEngineComputer#onConnected: Instance max-run-duration-sddftg is preemptive, setting up preemption listener
  87.394 [id=106]	INFO	c.g.j.p.c.ComputeEngineCloud#lambda$getPlannedNodeFuture$0: 77788ms elapsed waiting for node max-run-duration-sddftg to connect
[f#1]   90.163 Legacy code started this job.  No cause information is available
[f#1]   90.164 Running as SYSTEM
[f#1]   90.164 Building remotely on max-run-duration-sddftg (integration) in workspace /tmp/workspace/f
[f#1]  165.423 [f] $ /bin/sh -xe /tmp/jenkins9503169371396233840.sh
[f#1]  168.433 + echo hello world
[f#1]  168.434 hello world
[f#1]  181.484 Finished: SUCCESS

[p#1]  240.780 Started
[p#1]  240.783 [Pipeline] Start of Pipeline
[p#1]  240.785 [Pipeline] node
 244.038 [id=61]	INFO	c.g.j.p.c.ComputeEngineCloud#provision: Provisioning node from configs [com.google.jenkins.plugins.computeengine.InstanceConfiguration@11481013] for excess workload of 1 units of label 'integration'
 244.876 [id=61]	INFO	c.g.j.p.c.ComputeEngineCloud#availableNodeCapacity: Found capacity for 10 nodes in cloud integration
 244.876 [id=61]	INFO	c.g.j.p.c.InstanceConfiguration#instance: User selected to use an autogenerated ssh key pair
 247.427 [id=61]	INFO	c.g.j.p.c.InstanceConfiguration#provision: Sent insert request for instance configuration [max-run-duration]
 247.428 [id=172]	INFO	c.g.j.p.c.ComputeEngineComputerLauncher#launch: Launch will wait 300000 for operation operation-1734697757345-629b2cb9e8518-0b769e43-9cb4ae90 to complete...
 247.446 [id=175]	INFO	c.g.j.p.c.ComputeEngineCloud#lambda$getPlannedNodeFuture$0: Waiting 300000ms for node max-run-duration-cdfmzy to connect
 247.447 [id=61]	INFO	h.s.NodeProvisioner$StandardStrategyImpl#apply: Started provisioning max-run-duration-cdfmzy from gce-integration with 1 executors. Remaining excess workload: 0
[p#1]  254.840 Still waiting to schedule task
[p#1]  254.841 ‘max-run-duration-cdfmzy’ is offline
 262.440 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Launching instance: max-run-duration-cdfmzy
 262.442 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: bootstrap
 262.443 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Getting keypair...
 262.444 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Using autogenerated ssh keypair
 262.444 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Authenticating as jenkins
 263.914 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connecting to 34.23.6.230 on port 22, with timeout 10000.
 271.189 [id=172]	WARNING	c.g.j.p.c.ComputeEngineCloud#log: An error occured: There was a problem while connecting to 34.23.6.230:22
 277.733 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connecting to 34.23.6.230 on port 22, with timeout 10000.
 277.987 [id=172]	WARNING	c.g.j.p.c.ComputeEngineCloud#log: An error occured: There was a problem while connecting to 34.23.6.230:22
 284.579 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connecting to 34.23.6.230 on port 22, with timeout 10000.
 287.535 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Connected via SSH.
 288.664 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Verifying: /usr/bin/java -fullversion
 290.785 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Copying agent.jar to: /tmp
 294.120 [id=172]	INFO	c.g.j.p.c.ComputeEngineCloud#log: Launching Jenkins agent via plugin SSH: /usr/bin/java -jar /tmp/agent.jar
 323.282 [id=172]	INFO	c.g.j.p.c.ComputeEngineComputer#onConnected: Instance max-run-duration-cdfmzy is preemptive, setting up preemption listener
 323.303 [id=175]	INFO	c.g.j.p.c.ComputeEngineCloud#lambda$getPlannedNodeFuture$0: 75857ms elapsed waiting for node max-run-duration-cdfmzy to connect
[p#1]  327.132 Running on max-run-duration-cdfmzy in /tmp/workspace/p
[p#1]  329.140 [Pipeline] {
[p#1]  329.141 [Pipeline] sh
[p#1]  417.442 + date
[p#1]  417.443 Fri Dec 20 12:31:56 UTC 2024
[p#1]  418.447 [Pipeline] }
[p#1]  418.448 [Pipeline] // node
[p#1]  419.453 [Pipeline] End of Pipeline
[p#1]  419.454 Finished: SUCCESS
 420.139 [id=20]	INFO	hudson.lifecycle.Lifecycle#onStatusUpdate: Stopping Jenkins
 420.169 [id=20]	INFO	hudson.lifecycle.Lifecycle#onStatusUpdate: Jenkins stopped
 420.208 [id=20]	INFO	o.j.h.t.TemporaryDirectoryAllocator#dispose: deleting /Users/gbhat/CBProjects/google-compute-engine-plugin/target/tmp/j h5062213579381787349
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 421.0 s -- in com.google.jenkins.plugins.computeengine.integration.SpotVmProvisioningWithMaxRunDurationCasCIT
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]

(cloudbees internal ticket link for back reference)


Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@gbhat618
Copy link
Author

👋 @jglick , @Vlatombe , @nevingeorgesunny

@gbhat618
Copy link
Author

gbhat618 commented Dec 12, 2024

recording and screenshots moved to the summary at the top ⬆️

@gbhat618
Copy link
Author

gbhat618 commented Dec 12, 2024

I will work on the testing as,

  • check and update automated tests (or write new tests)
  • Jcasc based testing
  • what happens to agents in jenkins if the vm got deleted in GCP due to maxRunDuration (maybe jenkins will mark agent as non-available - but will test and update the notes).

Edit: all these points are completed ✔️ (automated tests are written both unittests and integration test). When maxRunDuration deletes the VM in GCP side, the controller also deletes the slave, which is correct no issues for builds ✅ (already covered in the integration test)

@@ -58,7 +58,7 @@ public static void teardown() throws IOException {

@Test
public void testGetImage() throws Exception {
Image image = client.getImage("debian-cloud", "debian-9-stretch-v20180820");
Image image = client.getImage("debian-cloud", "debian-12-bookworm-v20241210");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debian-9 is already deprecated, this is throwing 404 image not found errors,

➜  ~ gcloud compute images list --project=debian-cloud --no-standard-images --show-deprecated | grep debian-9-stretch-v20180820
debian-9-stretch-v20180820                         debian-cloud  debian-9            DEPRECATED  READY

? String.format(
"projects/%s/global/images/%s", BOOT_DISK_PROJECT_ID, System.getenv("GOOGLE_BOOT_DISK_IMAGE_NAME"))
: "projects/debian-cloud/global/images/family/debian-9";
: "projects/debian-cloud/global/images/family/debian-12";
Copy link
Author

@gbhat618 gbhat618 Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to support the GOOGLE_BOOT_DISK_PROJECT_ID and GOOGLE_BOOT_DISK_IMAGE_NAME even for linux too, because the base debian images don't have java installed.

See the new document file being added in this PR integration-tests.md

}
return null;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test credentials are created using this constructor, where it is passing an empty id.
https://github.com/jenkinsci/google-oauth-plugin/blob/5367a8a1b9c97e14a5188150f897fa91da1d9777/src/main/java/com/google/jenkins/plugins/credentials/oauth/GoogleRobotPrivateKeyCredentials.java#L65-L70

which ends up at https://github.com/jenkinsci/credentials-plugin/blob/1e306e8f6c54f8eeef973b3387b8c223bd60ae1c/src/main/java/com/cloudbees/plugins/credentials/common/IdCredentials.java#L87-L96
thus having a random uuid.

seems like at somepoint the google-credential-plugin might have got this behavior (or sending blank id, instead of projectid).

As the integration tests in this repository are not run often, this never got brought up..

@gbhat618 gbhat618 marked this pull request as ready for review December 16, 2024 18:19
@gbhat618
Copy link
Author

👋 Completed the PR from draft to ready, plz help review @jglick , @Vlatombe , @nevingeorgesunny

@jglick
Copy link
Member

jglick commented Dec 18, 2024

(@Artmorse has also worked on this plugin recently.)

@gbhat618 gbhat618 requested a review from rsandell December 18, 2024 14:26
gbhat618 and others added 4 commits December 19, 2024 08:54
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.recipes.WithTimeout;

/**
* Integration test suite for {@link ComputeEngineCloud}. Verifies that instances with preempted
* flag will be restarted when preempted.
*/
@Log
public class ComputeEngineCloudRestartPreemptedIT {
Copy link
Author

@gbhat618 gbhat618 Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there is more existing integration tests that are failing because of reasons like,

  • they are depending on the debian-9 image (in the casc bundle the image path is there like that)
  • and they are depending the JDK8 whose deb repository is not existing and giving 404 errors
    etc like that..

So I will create a separate PR and fix all the integration tests. I will remove the existing integration test fixing code from here.

Once I file the other PR, I will link back in this comment's follow-up

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration test update PR is created here
#495

-->
<div>
The maximum duration (in seconds) after which the VM will be automatically deleted by GCP.
See <a href="https://cloud.google.com/compute/docs/instances/limit-vm-runtime">Limit the run time of a VM</a> for more details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, links in help files for config forms automatically open in a new tab/window as per some magic in Jenkins core—there is no need to manually right-click and select Open in new tab or similar.

docs/integration-tests.md Outdated Show resolved Hide resolved
docs/integration-tests.md Outdated Show resolved Hide resolved
```
* Execute an integration test (example)
```bash
mvn clean test -Dtest=ComputeEngineCloudRestartPreemptedIT#testIfNodeWasPreempted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that instead of the Failsafe plugin and the *IT.java scheme, some plugins just use Surefire and use Assume to automatically skip tests requiring some environmental setup that has not been provided.

@@ -120,7 +124,7 @@ public class InstanceConfiguration implements Describable<InstanceConfiguration>
private String machineType;
private String numExecutorsStr;
private String startupScript;
private boolean preemptible;
private ProvisioningType provisioningType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: this class is using Lombok (not a good idea!):

@gbhat618 gbhat618 mentioned this pull request Dec 20, 2024
6 tasks
}

@SuppressWarnings("unused") // jelly
public FormValidation doCheckMaxRunDurationSeconds(@QueryParameter String value) {

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing POST/RequirePOST annotation Warning

Potential CSRF vulnerability: If DescriptorImpl#doCheckMaxRunDurationSeconds connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
}

@SuppressWarnings("unused") // jelly
public FormValidation doCheckMaxRunDurationSeconds(@QueryParameter String value) {

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing permission check Warning

Potential missing permission check in DescriptorImpl#doCheckMaxRunDurationSeconds
}

@SuppressWarnings("unused") // jelly
public FormValidation doCheckMaxRunDurationSeconds(@QueryParameter String value) {

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing POST/RequirePOST annotation Warning

Potential CSRF vulnerability: If DescriptorImpl#doCheckMaxRunDurationSeconds connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
}

@SuppressWarnings("unused") // jelly
public FormValidation doCheckMaxRunDurationSeconds(@QueryParameter String value) {

Check warning

Code scanning / Jenkins Security Scan

Stapler: Missing permission check Warning

Potential missing permission check in DescriptorImpl#doCheckMaxRunDurationSeconds
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<scope>test</scope>
</dependency>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These pom dependencies will be removed after merging #495

currently keeping here, otherwise compilation will fail in CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants