-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
165 additions
and
5 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...ava/org/jfrog/artifactory/client/model/repository/settings/HelmOciRepositorySettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.jfrog.artifactory.client.model.repository.settings; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public interface HelmOciRepositorySettings extends DockerRepositorySettings { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...frog/artifactory/client/model/repository/settings/impl/HelmOciRepositorySettingsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jfrog.artifactory.client.model.repository.settings.impl; | ||
|
||
import org.jfrog.artifactory.client.model.PackageType; | ||
import org.jfrog.artifactory.client.model.impl.PackageTypeImpl; | ||
import org.jfrog.artifactory.client.model.repository.settings.OciRepositorySettings; | ||
|
||
public class HelmOciRepositorySettingsImpl extends DockerRepositorySettingsImpl implements OciRepositorySettings { | ||
public static String defaultLayout = "simple-default"; | ||
|
||
public PackageType getPackageType() { | ||
return PackageTypeImpl.helmoci; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (!(o instanceof HelmOciRepositorySettingsImpl)) { | ||
return false; | ||
} | ||
return super.equals(o); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
services/src/main/resources/artifactory.client.release.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version=2.18.0 | ||
version=2.18.x-SNAPSHOT |
129 changes: 129 additions & 0 deletions
129
...ces/src/test/groovy/org/jfrog/artifactory/client/HelmOciPackageTypeRepositoryTests.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
package org.jfrog.artifactory.client | ||
|
||
import org.hamcrest.CoreMatchers | ||
import org.jfrog.artifactory.client.model.RepositoryType | ||
import org.jfrog.artifactory.client.model.repository.settings.RepositorySettings | ||
import org.jfrog.artifactory.client.model.repository.settings.docker.DockerApiVersion | ||
import org.jfrog.artifactory.client.model.repository.settings.impl.HelmOciRepositorySettingsImpl | ||
import org.testng.annotations.BeforeMethod | ||
import org.testng.annotations.Test | ||
|
||
/** | ||
* test that client correctly sends and receives repository configuration with `helmoci` package type | ||
* | ||
*/ | ||
class HelmOciPackageTypeRepositoryTests extends BaseRepositoryTests { | ||
|
||
HelmOciPackageTypeRepositoryTests() { | ||
remoteRepoUrl = "https://registry-1.docker.io" | ||
} | ||
|
||
@Override | ||
RepositorySettings getRepositorySettings(RepositoryType repositoryType) { | ||
def settings = new HelmOciRepositorySettingsImpl() | ||
|
||
settings.with { | ||
// local | ||
dockerApiVersion = DockerApiVersion.V2 | ||
dockerTagRetention = Math.abs(rnd.nextInt()) | ||
|
||
// remote | ||
enableTokenAuthentication = rnd.nextBoolean() | ||
listRemoteFolderItems = rnd.nextBoolean() | ||
} | ||
|
||
return settings | ||
} | ||
|
||
@BeforeMethod | ||
protected void setUp() { | ||
storeArtifactsLocallyInRemoteRepo = true | ||
super.setUp() | ||
} | ||
|
||
@Test(groups = "helmOciPackageTypeRepo") | ||
void testOciLocalRepo() { | ||
artifactory.repositories().create(0, localRepo) | ||
def expectedSettings = localRepo.repositorySettings | ||
|
||
def resp = artifactory.repository(localRepo.getKey()).get() | ||
assertThat(resp, CoreMatchers.notNullValue()) | ||
assertThat(resp.repoLayoutRef, CoreMatchers.is(HelmOciRepositorySettingsImpl.defaultLayout)) | ||
resp.getRepositorySettings().with { | ||
assertThat(packageType, CoreMatchers.is(expectedSettings.getPackageType())) | ||
assertThat(repoLayout, CoreMatchers.is(expectedSettings.getRepoLayout())) | ||
|
||
// local | ||
assertThat(dockerApiVersion, CoreMatchers.is(expectedSettings.getDockerApiVersion())) | ||
assertThat(dockerTagRetention, CoreMatchers.is(expectedSettings.getDockerTagRetention())) | ||
|
||
// remote | ||
assertThat(enableTokenAuthentication, CoreMatchers.is(CoreMatchers.nullValue())) | ||
assertThat(listRemoteFolderItems, CoreMatchers.is(CoreMatchers.nullValue())) | ||
} | ||
} | ||
|
||
@Test(groups = "helmOciPackageTypeRepo") | ||
void testOciFederatedRepo() { | ||
artifactory.repositories().create(0, federatedRepo) | ||
def expectedSettings = federatedRepo.repositorySettings | ||
|
||
def resp = artifactory.repository(federatedRepo.getKey()).get() | ||
assertThat(resp, CoreMatchers.notNullValue()) | ||
assertThat(resp.repoLayoutRef, CoreMatchers.is(HelmOciRepositorySettingsImpl.defaultLayout)) | ||
resp.getRepositorySettings().with { | ||
assertThat(packageType, CoreMatchers.is(expectedSettings.getPackageType())) | ||
assertThat(repoLayout, CoreMatchers.is(expectedSettings.getRepoLayout())) | ||
|
||
// local | ||
assertThat(dockerApiVersion, CoreMatchers.is(expectedSettings.getDockerApiVersion())) | ||
|
||
// remote | ||
assertThat(enableTokenAuthentication, CoreMatchers.is(CoreMatchers.nullValue())) | ||
assertThat(listRemoteFolderItems, CoreMatchers.is(CoreMatchers.nullValue())) | ||
} | ||
} | ||
|
||
@Test(groups = "helmOciPackageTypeRepo") | ||
void testOciRemoteRepo() { | ||
artifactory.repositories().create(0, remoteRepo) | ||
def expectedSettings = remoteRepo.repositorySettings | ||
|
||
def resp = artifactory.repository(remoteRepo.getKey()).get() | ||
assertThat(resp, CoreMatchers.notNullValue()) | ||
assertThat(resp.repoLayoutRef, CoreMatchers.is(HelmOciRepositorySettingsImpl.defaultLayout)) | ||
resp.getRepositorySettings().with { | ||
assertThat(packageType, CoreMatchers.is(expectedSettings.getPackageType())) | ||
assertThat(repoLayout, CoreMatchers.is(expectedSettings.getRepoLayout())) | ||
|
||
// local | ||
assertThat(dockerApiVersion, CoreMatchers.is(expectedSettings.getDockerApiVersion())) | ||
// always in resp payload | ||
|
||
// remote | ||
assertThat(enableTokenAuthentication, CoreMatchers.is(expectedSettings.getEnableTokenAuthentication())) | ||
assertThat(listRemoteFolderItems, CoreMatchers.is(expectedSettings.getListRemoteFolderItems())) | ||
} | ||
} | ||
|
||
@Test(groups = "helmOciPackageTypeRepo") | ||
void testDockerVirtualRepo() { | ||
artifactory.repositories().create(0, virtualRepo) | ||
def expectedSettings = virtualRepo.repositorySettings | ||
|
||
def resp = artifactory.repository(virtualRepo.getKey()).get() | ||
assertThat(resp, CoreMatchers.notNullValue()) | ||
assertThat(resp.repoLayoutRef, CoreMatchers.is(HelmOciRepositorySettingsImpl.defaultLayout)) | ||
resp.getRepositorySettings().with { | ||
assertThat(packageType, CoreMatchers.is(expectedSettings.getPackageType())) | ||
assertThat(repoLayout, CoreMatchers.is(expectedSettings.getRepoLayout())) | ||
|
||
// local | ||
assertThat(dockerApiVersion, CoreMatchers.is(expectedSettings.getDockerApiVersion())) | ||
|
||
// remote | ||
assertThat(enableTokenAuthentication, CoreMatchers.is(CoreMatchers.nullValue())) | ||
assertThat(listRemoteFolderItems, CoreMatchers.is(CoreMatchers.nullValue())) | ||
} | ||
} | ||
} |