Skip to content

Commit

Permalink
feat(helm): Allow downloading of Helm repo index using a Helm account (
Browse files Browse the repository at this point in the history
…#4773)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
jcavanagh and mergify[bot] committed Sep 23, 2020
1 parent 3937b78 commit a8e36f5
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -38,10 +38,15 @@
final class HelmArtifactCredentials extends BaseHttpArtifactCredentials<HelmArtifactAccount>
implements ArtifactCredentials {
@Getter private final String name;
@Getter private final ImmutableList<String> types = ImmutableList.of("helm/chart");
@Getter private final ImmutableList<String> types = ImmutableList.of("helm/chart", "helm/index");

@JsonIgnore private final IndexParser indexParser;

@Override
public boolean handlesType(String type) {
return types.contains(type);
}

HelmArtifactCredentials(HelmArtifactAccount account, OkHttpClient okHttpClient) {
super(okHttpClient, account);
this.name = account.getName();
Expand All @@ -52,6 +57,10 @@ final class HelmArtifactCredentials extends BaseHttpArtifactCredentials<HelmArti
public InputStream download(Artifact artifact) throws IOException {
InputStream index = downloadIndex();

if ("helm/index".equals(artifact.getType())) {
return index;
}

List<String> urls = indexParser.findUrls(index, artifact.getName(), artifact.getVersion());
ResponseBody downloadResponse;
for (String url : urls) {
Expand Down

0 comments on commit a8e36f5

Please sign in to comment.