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

fix(jenkins): Enable properties and artifacts with job name as query parameter (backport #4661) #4677

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ public Map<String, Object> getBuild(Integer buildNumber, String master, String j

public Map<String, Object> getPropertyFile(
Integer buildNumber, String fileName, String master, String job) {
return igorService.getPropertyFile(buildNumber, fileName, master, encode(job));
return this.igorFeatureFlagProperties.isJobNameAsQueryParameter()
? igorService.getPropertyFileWithJobAsQueryParam(buildNumber, fileName, master, encode(job))
: igorService.getPropertyFile(buildNumber, fileName, master, encode(job));
}

public List<Artifact> getArtifacts(
Integer buildNumber, String fileName, String master, String job) {
return igorService.getArtifacts(buildNumber, fileName, master, encode(job));
return this.igorFeatureFlagProperties.isJobNameAsQueryParameter()
? igorService.getArtifactsWithJobAsQueryParam(buildNumber, fileName, master, encode(job))
: igorService.getArtifacts(buildNumber, fileName, master, encode(job));
}

public Response updateBuild(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ Map<String, Object> getPropertyFile(
@Path("master") String master,
@Path(encode = false, value = "job") String job);

@GET("/builds/properties/{buildNumber}/{fileName}/{master}")
Map<String, Object> getPropertyFileWithJobAsQueryParam(
@Path("buildNumber") Integer buildNumber,
@Path("fileName") String fileName,
@Path("master") String master,
@Query(value = "job") String job);

@GET("/{repoType}/{projectKey}/{repositorySlug}/compareCommits")
List compareCommits(
@Path("repoType") String repoType,
Expand All @@ -93,6 +100,13 @@ List<Artifact> getArtifacts(
@Path("master") String master,
@Path(value = "job", encode = false) String job);

@GET("/builds/artifacts/{buildNumber}/{master}")
List<Artifact> getArtifactsWithJobAsQueryParam(
@Path("buildNumber") Integer buildNumber,
@Query("propertyFile") String propertyFile,
@Path("master") String master,
@Query(value = "job") String job);

@POST("/gcb/builds/create/{account}")
GoogleCloudBuild createGoogleCloudBuild(
@Path("account") String account, @Body Map<String, Object> job);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ class BuildServiceSpec extends Specification {
1 * igorService.getPropertyFile(BUILD_NUMBER, FILENAME, MASTER, JOB_NAME_ENCODED)
}

void 'getPropertyFile method with job in query when flag is true'() {
IgorFeatureFlagProperties igorFeatureFlagProperties = new IgorFeatureFlagProperties()
igorFeatureFlagProperties.setJobNameAsQueryParameter(true)
buildService = new BuildService(igorService, igorFeatureFlagProperties)

when:
buildService.getPropertyFile(BUILD_NUMBER, FILENAME, MASTER, JOB_NAME)

then:
1 * igorService.getPropertyFileWithJobAsQueryParam(BUILD_NUMBER, FILENAME, MASTER, JOB_NAME_ENCODED)
}

void 'stop method sends job name in path when flag is false'() {
IgorFeatureFlagProperties igorFeatureFlagProperties = new IgorFeatureFlagProperties()
igorFeatureFlagProperties.setJobNameAsQueryParameter(false)
Expand Down
Loading