Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
GO_VERSION: 1.25.10
GO_VERSION: 1.26.7

jobs:
build-all:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*'

env:
GO_VERSION: 1.25.10
GO_VERSION: 1.26.7

jobs:
release:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: '0 2 * * *' # Every day at 2am

env:
GO_VERSION: 1.25.10
GO_VERSION: 1.26.7

jobs:
snapshots:
Expand Down
10 changes: 7 additions & 3 deletions helm-java/src/test/java/com/marcnuri/helm/HelmPushTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ void tearDown() {
void pushUnauthorizedThrowsException() {
final PushCommand pushCommand = Helm.push()
.withChart(packagedChart)
.withRemote(URI.create("oci://" + remoteServer));
.withRemote(URI.create("oci://" + remoteServer))
.plainHttp();
assertThatIllegalStateException()
.isThrownBy(pushCommand::call)
.extracting(IllegalStateException::getMessage)
Expand All @@ -74,6 +75,7 @@ void pushUnauthorizedWithDebugThrowsExceptionWithDetail() {
final PushCommand pushCommand = Helm.push()
.withChart(packagedChart)
.withRemote(URI.create("oci://" + remoteServer))
.plainHttp()
.debug();
assertThatIllegalStateException()
.isThrownBy(pushCommand::call)
Expand All @@ -88,21 +90,23 @@ void pushUnauthorizedWithDebugThrowsExceptionWithDetail() {

@Test
void pushAuthorized() {
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).call();
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).plainHttp().call();
final String result = Helm.push()
.withChart(packagedChart)
.withRemote(URI.create("oci://" + remoteServer))
.plainHttp()
.call();
assertThat(result)
.contains("Pushed: ", "test:0.1.0", "Digest: ");
}

@Test
void pushWithDebugShowsDebugMessages() {
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).call();
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).plainHttp().call();
final String result = Helm.push()
.withChart(packagedChart)
.withRemote(URI.create("oci://" + remoteServer))
.plainHttp()
.debug()
.call();
assertThat(result)
Expand Down
12 changes: 6 additions & 6 deletions helm-java/src/test/java/com/marcnuri/helm/HelmRegistryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class Login {
@Test
void withValidCredentialsSucceeds() {
final String result = Helm.registry().login()
.withHost(remoteServer).withUsername("username").withPassword("password").call();
.withHost(remoteServer).withUsername("username").withPassword("password").plainHttp().call();
assertThat(result).startsWith("Login Succeeded");
}

@Test
void withDebugAndValidCredentialsSucceeds() {
final String result = Helm.registry().login()
.debug()
.withHost(remoteServer).withUsername("username").withPassword("password").call();
.withHost(remoteServer).withUsername("username").withPassword("password").plainHttp().call();
assertThat(result)
.containsPattern(Pattern.compile("^Login Succeeded$", Pattern.MULTILINE))
.contains("level=info msg=\"authorized request\"");
Expand All @@ -60,7 +60,7 @@ void withDebugAndValidCredentialsSucceeds() {
@Test
void withInvalidCredentialsFails() {
final RegistryCommand.LoginCommand loginCommand = Helm.registry().login()
.withHost(remoteServer).withUsername("username").withPassword("invalid");
.withHost(remoteServer).withUsername("username").withPassword("invalid").plainHttp();
assertThatThrownBy(loginCommand::call)
.isInstanceOf(IllegalStateException.class)
.hasMessageContainingAll(
Expand All @@ -72,7 +72,7 @@ void withInvalidCredentialsFails() {
void withDebugAndInvalidCredentialsFails() {
final RegistryCommand.LoginCommand loginCommand = Helm.registry().login()
.debug()
.withHost(remoteServer).withUsername("username").withPassword("invalid");
.withHost(remoteServer).withUsername("username").withPassword("invalid").plainHttp();
assertThatThrownBy(loginCommand::call)
.isInstanceOf(IllegalStateException.class)
.hasMessageContainingAll(
Expand All @@ -87,15 +87,15 @@ class Logout {

@Test
void withPreviousLoginSucceeds() {
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword("password").call();
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword("password").plainHttp().call();
final String result = Helm.registry().logout()
.withHost(remoteServer).call();
assertThat(result).startsWith("Removing login credentials for " + remoteServer);
}

@Test
void withDebugAndPreviousLoginSucceeds() {
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword("password").call();
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword("password").plainHttp().call();
final String result = Helm.registry().logout()
.debug()
.withHost(remoteServer).call();
Expand Down
6 changes: 4 additions & 2 deletions helm-java/src/test/java/com/marcnuri/helm/HelmShowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ void setUp() {
final String password = UUID.randomUUID().toString(); // If default password is used, test is flaky ¯\_(ツ)_/¯
remoteServer = Helm.HelmLibHolder.INSTANCE.RepoOciServerStart(
new RepoServerOptions(null, null, password)).out;
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).call();
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).plainHttp().call();
helm.packageIt().withDestination(tempDir).call();
final Path packagedChart = tempDir.resolve("test-0.1.0.tgz");
Helm.push()
.withChart(packagedChart)
.withRemote(URI.create("oci://" + remoteServer))
.plainHttp()
.call();
}

Expand Down Expand Up @@ -172,12 +173,13 @@ void setUp() {
final String password = UUID.randomUUID().toString(); // If default password is used, test is flaky ¯\_(ツ)_/¯
remoteServer = Helm.HelmLibHolder.INSTANCE.RepoOciServerStart(
new RepoServerOptions(null, null, password)).out;
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).call();
Helm.registry().login().withHost(remoteServer).withUsername("username").withPassword(password).plainHttp().call();
helm.packageIt().withDestination(tempDir).call();
final Path packagedChart = tempDir.resolve("test-0.1.0.tgz");
Helm.push()
.withChart(packagedChart)
.withRemote(URI.create("oci://" + remoteServer))
.plainHttp()
.call();
}

Expand Down
1 change: 1 addition & 0 deletions native/internal/helm/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func RegistryLogin(options *RegistryOptions) (string, error) {
action.WithKeyFile(options.KeyFile),
action.WithCAFile(options.CaFile),
action.WithInsecure(options.InsecureSkipTLSverify),
action.WithPlainHTTPLogin(options.PlainHttp),
)
return appendToOutOrErr(debugBuffer, getRegistryClientOut().String(), err)
}
Expand Down
33 changes: 19 additions & 14 deletions native/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,17 @@ func TestPush(t *testing.T) {
})
_ = helm.Package(&helm.PackageOptions{Path: create, Destination: dir})
_, _ = helm.RegistryLogin(&helm.RegistryOptions{
Hostname: srv.RegistryURL,
Username: "username",
Password: "password",
Debug: true,
Hostname: srv.RegistryURL,
Username: "username",
Password: "password",
Debug: true,
CertOptions: helm.CertOptions{PlainHttp: true},
})
out, err := helm.Push(&helm.PushOptions{
Chart: path.Join(dir, "test-0.1.0.tgz"),
Remote: "oci://" + srv.RegistryURL,
Debug: true,
Chart: path.Join(dir, "test-0.1.0.tgz"),
Remote: "oci://" + srv.RegistryURL,
Debug: true,
CertOptions: helm.CertOptions{PlainHttp: true},
})
if err != nil {
t.Errorf("Expected push to succeed, got %s", err)
Expand Down Expand Up @@ -217,9 +219,10 @@ func TestRegistryLogin(t *testing.T) {
t.Errorf("Expected server to be started")
}
_, err = helm.RegistryLogin(&helm.RegistryOptions{
Hostname: srv.RegistryURL,
Username: "username",
Password: "password",
Hostname: srv.RegistryURL,
Username: "username",
Password: "password",
CertOptions: helm.CertOptions{PlainHttp: true},
})
if err != nil {
t.Errorf("Expected login to succeed, got %s", err)
Expand All @@ -246,16 +249,18 @@ func TestRegistryLogout(t *testing.T) {
defer helm.RepoServerStopAll()
srv, _ := helm.RepoOciServerStart(&helm.RepoServerOptions{})
_, err := helm.RegistryLogin(&helm.RegistryOptions{
Hostname: srv.RegistryURL,
Username: "username",
Password: "password",
Hostname: srv.RegistryURL,
Username: "username",
Password: "password",
CertOptions: helm.CertOptions{PlainHttp: true},
})
if err != nil {
t.Error("Expected initial login to succeed")
}
var out string
out, err = helm.RegistryLogout(&helm.RegistryOptions{
Hostname: srv.RegistryURL,
Hostname: srv.RegistryURL,
CertOptions: helm.CertOptions{PlainHttp: true},
})
if err != nil {
t.Errorf("Expected logout to succeed, got %s", err)
Expand Down