Skip to content

Commit

Permalink
fix(artifactory): correctly construct Artifactory URL (#446)
Browse files Browse the repository at this point in the history
Previously we got the base URL from the client which unintuitively removed the context root for us. Now we grab it from the search which has the artifactory base URLs that Igor is configured with.
We also provide a more specific URL that identifies a particular pom, rather than just the directory of the group, artifact, and version.
  • Loading branch information
claymccoy authored and jkschneider committed May 23, 2019
1 parent 1bd149e commit c6b96e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected ArtifactPollingDelta generateDelta(PollContext ctx) {
aqlResponse.parseBody(ArtifactoryQueryResults.class).getResults();
return new ArtifactPollingDelta(
search.getName(),
client.getUri(),
search.getBaseUrl(),
search.getPartitionName(),
Collections.singletonList(
new ArtifactDelta(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

@Data
public class ArtifactoryItem {
private String name;
private String repo;
private String path;
private List<ArtifactoryArtifact> artifacts;
Expand All @@ -44,7 +45,7 @@ public Artifact toMatchableArtifact(ArtifactoryRepositoryType repoType, String b
String location = null;
if (baseUrl != null) {
location =
baseUrl + "/artifactory/webapp/#/artifacts/browse/tree/General/" + repo + "/" + path;
baseUrl + "/webapp/#/artifacts/browse/tree/General/" + repo + "/" + path + "/" + name;
}

final Artifact.ArtifactBuilder artifactBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ArtifactoryItemTest {
@Test
void toMatchableArtifact() {
ArtifactoryItem artifact = new ArtifactoryItem();
artifact.setName("1.0.1.pom");
artifact.setPath("io/pivotal/spinnaker/demo/0.1.0-dev.20+d9a14fb");
artifact.setRepo("libs-demo-local");

Expand All @@ -41,8 +42,8 @@ void toMatchableArtifact() {
assertThat(matchableArtifact.getName()).isEqualTo("io.pivotal.spinnaker:demo");
assertThat(matchableArtifact.getLocation())
.isEqualTo(
"http://localhost:8080/artifactory/webapp/#/artifacts/browse/tree/General/libs-demo-local/io/pivotal"
+ "/spinnaker/demo/0.1.0-dev.20+d9a14fb");
"http://localhost:8080/webapp/#/artifacts/browse/tree/General/libs-demo-local/io/pivotal"
+ "/spinnaker/demo/0.1.0-dev.20+d9a14fb/1.0.1.pom");
}

@Test
Expand Down

0 comments on commit c6b96e1

Please sign in to comment.