-
Notifications
You must be signed in to change notification settings - Fork 658
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
feat(artifacts): Add type parameter to ArtifactService #821
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,18 +46,20 @@ public ArtifactController(ArtifactServices artifactServices) { | |
public List<String> getVersions( | ||
@PathVariable("provider") String provider, | ||
@PathVariable("name") String name, | ||
@RequestParam(value = "releaseStatus", required = false) String releaseStatus) { | ||
@RequestParam(value = "releaseStatus", required = false) List<String> releaseStatuses, | ||
@RequestParam(value = "type", required = false, defaultValue = "deb") String type) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this as a request param and not a path variable because it would cause a conflict with between the path patterns in |
||
ArtifactService artifactService = getService(provider); | ||
return artifactService.getArtifactVersions(name, releaseStatus); | ||
return artifactService.getArtifactVersions(type, name, releaseStatuses); | ||
} | ||
|
||
@GetMapping("/{provider}/{name}/{version:.+}") | ||
public Artifact getArtifact( | ||
@PathVariable("provider") String provider, | ||
@PathVariable("name") String name, | ||
@PathVariable("version") String version) { | ||
@PathVariable("version") String version, | ||
@RequestParam(value = "type", required = false, defaultValue = "deb") String type) { | ||
ArtifactService artifactService = getService(provider); | ||
return artifactService.getArtifact(name, version); | ||
return artifactService.getArtifact(type, name, version); | ||
} | ||
|
||
private ArtifactService getService(String serviceName) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
import com.netflix.spinnaker.igor.model.ArtifactServiceProvider; | ||
import com.netflix.spinnaker.kork.artifacts.model.Artifact; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.annotation.Nonnull; | ||
|
||
|
@@ -33,9 +34,19 @@ public interface ArtifactService { | |
|
||
/** Used to populate the manual trigger dropdown with options */ | ||
@Nonnull | ||
List<String> getArtifactVersions(@Nonnull String name, String releaseStatus); | ||
default List<String> getArtifactVersions( | ||
@Nonnull String type, @Nonnull String name, String releaseStatus) { | ||
List<String> releaseStatuses = new ArrayList<>(); | ||
releaseStatuses.add(releaseStatus); | ||
return getArtifactVersions(type, name, releaseStatuses); | ||
} | ||
|
||
/** Used to populate the manual trigger dropdown with options */ | ||
@Nonnull | ||
List<String> getArtifactVersions( | ||
@Nonnull String type, @Nonnull String name, List<String> releaseStatuses); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was previously limiting the ability to query artifacts with multiple statuses. |
||
|
||
/** Used to fetch a specific artifact for decorating a trigger */ | ||
@Nonnull | ||
Artifact getArtifact(@Nonnull String name, @Nonnull String version); | ||
Artifact getArtifact(@Nonnull String type, @Nonnull String name, @Nonnull String version); | ||
luispollo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was previously limiting the ability to query artifacts matching multiple statuses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change backwards compatible with the manual trigger dropdown only sending one status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because the way this is encoded in query parameters when it's a list is to have multiple occurrences of
releaseStatus=<status>
in the query string. This works for 1 to N.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it, so great!