Skip to content

Commit

Permalink
chore(jenkins): get job name from constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelillo15 committed Dec 28, 2024
1 parent cdd7e00 commit 496c26e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public final class Constants {
public static final String JENKINS_BUILD_ID = "{{ jenkinsBuildId }}";
public static final String JENKINS_BUILD_URL = "{{ jenkinsBuildUrl }}";

public static final String JENKINS_JOB_NAME = "NookureStaff";

private Constants() {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nookure.staff.api.jenkins;

import com.nookure.staff.Constants;
import com.nookure.staff.api.jenkins.json.JenkinsJob;
import com.nookure.staff.api.jenkins.json.JenkinsRun;
import org.junit.jupiter.api.Test;
Expand All @@ -19,8 +20,8 @@ public void testGetJob() {
@Test
@EnabledIf("canRun")
public void testGetRun() {
final JenkinsJob jenkinsJob = jenkinsBaseClient.getJob("NookureStaff").join();
final JenkinsRun jenkinsRun = jenkinsBaseClient.getRun("NookureStaff", jenkinsJob.lastCompletedBuild().number()).join();
final JenkinsJob jenkinsJob = jenkinsBaseClient.getJob(Constants.JENKINS_JOB_NAME).join();
final JenkinsRun jenkinsRun = jenkinsBaseClient.getRun(jenkinsJob, jenkinsJob.lastCompletedBuild().number()).join();

assert jenkinsRun != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void checkVersion() {

JenkinsBaseClient jenkinsBaseClient = new JenkinsBaseClient(JENKINS_URL);

jenkinsBaseClient.getJob("NookureStaff").thenAccept(jenkinsJob -> {
jenkinsBaseClient.getJob(Constants.JENKINS_JOB_NAME).thenAccept(jenkinsJob -> {
if (jenkinsJob == null) {
getLogger().warning("Couldn't get the latest version from Jenkins.");
return;
Expand Down

0 comments on commit 496c26e

Please sign in to comment.