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

Require Jenkins 2.414.3 or newer #1016

Merged
merged 6 commits into from
Nov 17, 2023

Conversation

car-roll
Copy link
Contributor

@car-roll car-roll commented Sep 12, 2023

Require Jenkins 2.414.3 or newer

Also removes tests that relied on an empty cloud name being allowed.

was originally downstream of jenkinsci/jenkins#8310 but that has now been abandoned

since Jenkins 2.403, it is no longer possible to create a cloud with an empty name. This fixes tests that create empty clouds.

Testing done

N/A - changes only in test automation are well covered by ci.jenkins.io

Submitter checklist

@@ -58,34 +58,14 @@ public void testConstructor_0_10_2() {

private static final String LOG_MESSAGE = "Docker cloud requires a non-blank name after Jenkins 2.402";

@Issue("JENKINS-70729") // Warn if cloud name is empty
Copy link
Contributor Author

@car-roll car-roll Sep 13, 2023

Choose a reason for hiding this comment

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

@MarkEWaite I removed these two tests because the base class (Cloud) now throws an IllegalArgumentException that does not allow the creation of DockerCloud. The warning log message will now never be generated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @car-roll ! Has the base class been extended to handle upgrades on systems that already have a Docker cloud named with an empty string? If not, that seems like it will be needed in order to not break upgrades.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the base class has not been extended to support empty string Cloud names, but support is still there as I did not touch the readResolve in DockerCloud.

Just to clarify what I meant, I believe the code that these two tests are testing (testConstructorWithEmptyName and testConstructorWithNullName) are testing the constructor itself

public DockerCloud(String name, DockerAPI dockerApi, List<DockerTemplate> templates) {

However, with this new jenkins version, we are now failing on the super(name) call, so that log message will now never be called. Test-wise, I do not think I can reproduce this scenario with the new Jenkins version.

The only time now we will have to deal with a null name constructor should be in existing cloud names, which is tested in testCopyConstructor.

@Issue("JENKINS-70729") // Handle null or empty cloud name
@Test
public void testCopyConstructor() {
lr.record(DockerCloud.class.getName(), Level.ALL).capture(16);
DockerCloud cloud =
new DockerCloud(null, new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of());
new DockerCloud("tmp", new DockerAPI(new DockerServerEndpoint("uri", "credentialsId")), List.of());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarkEWaite I kept the CopyConstructor test since it covers backwards compatibility, but I had to modify it to allow an "empty" named DockerCloud

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @car-roll . That makes sense to me. Assigning directly to the name attribute is a nice technique. I would not have thought of that.

@car-roll car-roll changed the title [JENKINS-71737] remove cloud name from config page [JENKINS-71737] refactor to support dedicated cloud rename page Sep 13, 2023
@car-roll car-roll closed this Nov 17, 2023
@car-roll car-roll reopened this Nov 17, 2023
@car-roll
Copy link
Contributor Author

Note: jenkinsci/jenkins#8310 has now been closed, but i think the test changes for this PR will be needed whenever the jenkins version is bumped past 2.403. This is when cloud name is not allowed to be empty
https://github.com/jenkinsci/jenkins/blob/5665665b6b7bf45cc3102338477540029a4d8f62/core/src/main/java/hudson/slaves/Cloud.java#L121

@car-roll car-roll changed the title [JENKINS-71737] refactor to support dedicated cloud rename page Update jenkins version Nov 17, 2023
@car-roll car-roll changed the title Update jenkins version Remove tests with empty cloud name Nov 17, 2023
@car-roll car-roll marked this pull request as ready for review November 17, 2023 19:45
@car-roll car-roll requested a review from a team as a code owner November 17, 2023 19:45
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Thanks!

@MarkEWaite MarkEWaite changed the title Remove tests with empty cloud name Require Jenkins 2.414.3 or newer Nov 17, 2023
@MarkEWaite MarkEWaite added the chore Reduce effort required to maintain label Nov 17, 2023
@MarkEWaite
Copy link
Contributor

@car-roll I assume this does not require a new release but can be included in the next release whenever that happens. Is that correct?

@MarkEWaite MarkEWaite merged commit fd7fbc8 into jenkinsci:master Nov 17, 2023
16 checks passed
@car-roll
Copy link
Contributor Author

@MarkEWaite yes, that's correct. It was more about just not having someone else going through resolving those same issues I went through if I closed this PR completely

@car-roll car-roll deleted the dedicated-cloud-rename-page branch November 17, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Reduce effort required to maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants