Skip to content
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

upgraded micronaut to 4 #318

Merged
merged 135 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 120 commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
0a5e5fe
upgraded micronaut to 4
munishchouhan Oct 16, 2023
b9875f7
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 17, 2023
4762bcb
minor change
munishchouhan Oct 17, 2023
98aa3b3
Merge remote-tracking branch 'origin/314-update-to-micronaut-41' into…
munishchouhan Oct 17, 2023
4c1dc4f
JUnitPlatform added
munishchouhan Oct 17, 2023
04d974c
minor change
munishchouhan Oct 17, 2023
a36bbc7
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 18, 2023
0ee7d23
Error fixed
munishchouhan Oct 18, 2023
6c775cd
updated to groovy 4
munishchouhan Oct 19, 2023
675b74b
removed useJUnitPlatform()
munishchouhan Oct 19, 2023
4868771
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 30, 2023
6179552
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Nov 3, 2023
1c8ff4d
updated more dependencies
munishchouhan Nov 3, 2023
9c8ac3a
fixed UTs
munishchouhan Nov 13, 2023
733146b
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Nov 13, 2023
ff509a5
added useJUnitPlatform()
munishchouhan Nov 13, 2023
bab69a3
Merge remote-tracking branch 'origin/314-update-to-micronaut-41' into…
munishchouhan Nov 13, 2023
ed33297
master merged
munishchouhan Nov 17, 2023
78821ee
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Nov 20, 2023
611eba7
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Nov 21, 2023
460be25
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Nov 27, 2023
0b435e6
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jan 3, 2024
6085dc1
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jan 11, 2024
70bfb73
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jan 16, 2024
b8a8f99
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jan 26, 2024
66a8e88
added micronaut-reactor-http-client
munishchouhan Mar 11, 2024
ec249fe
Merge remote-tracking branch 'origin/master' into 314-update-to-micro…
munishchouhan Mar 11, 2024
6145e2c
fixed api changes
munishchouhan Mar 11, 2024
fa3fdf7
master merged
munishchouhan Apr 22, 2024
0c5b2f4
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan May 27, 2024
181a671
fixed build error
munishchouhan May 27, 2024
d06a265
fixed dependency
munishchouhan May 27, 2024
f718b0e
fixed gradle
munishchouhan May 27, 2024
0f31d25
minor change
munishchouhan May 28, 2024
8d79675
Bump MN 4.4.3
pditommaso Jun 5, 2024
8d2cda2
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jun 5, 2024
47680fe
bump lib-mail@1.1.0 + wave-api@0.11.0 + wave-utils@0.13.0
pditommaso Jun 5, 2024
cc90d46
fixed auth
munishchouhan Jun 5, 2024
b3cb5e1
fixed container and inspect tests
munishchouhan Jun 5, 2024
fc3e7ef
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jun 10, 2024
55e668b
Fixed ProxyClient and ValidateController
munishchouhan Jun 10, 2024
a235a24
added objenesis for mocking
munishchouhan Jun 10, 2024
f64f9f6
minor changes
munishchouhan Jun 11, 2024
92b4fc1
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jun 11, 2024
af9c751
fixed BuildControllerTest
munishchouhan Jun 12, 2024
f681b5d
fixed Credentials and registry test
munishchouhan Jun 12, 2024
69ba612
removed @NotNull
munishchouhan Jun 12, 2024
f244bbc
[release] test 1.9.0-A0
munishchouhan Jun 12, 2024
aa9f414
update dependencies
munishchouhan Jun 12, 2024
9975952
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jun 13, 2024
2d363fa
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jun 13, 2024
16d499d
Fix MN redict issue with temporary hack
pditommaso Jun 17, 2024
515460f
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jun 17, 2024
46b5209
bump micronaut@4.5.0
munishchouhan Jun 17, 2024
fbb51e4
fixed tests
munishchouhan Jun 17, 2024
1b1493e
fixed tests
munishchouhan Jun 17, 2024
c957142
fixed tests
munishchouhan Jun 18, 2024
1b19d5b
fixed tests
munishchouhan Jun 18, 2024
137a17e
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jun 18, 2024
cf0ab16
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jun 26, 2024
ca1f64d
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jul 1, 2024
190e04d
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jul 1, 2024
cbc81ef
Fix failint test
pditommaso Jul 1, 2024
56f5141
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jul 1, 2024
7facb22
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jul 3, 2024
57ef583
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jul 4, 2024
bc6667a
updated dependencies
munishchouhan Jul 4, 2024
ef10122
fix k8s errors
munishchouhan Jul 4, 2024
0519112
Revert "updated dependencies"
munishchouhan Jul 5, 2024
a8ae2cd
Revert "fix k8s errors"
munishchouhan Jul 5, 2024
5beb8c0
updated commons-compress:1.26.0
munishchouhan Jul 5, 2024
7ab7263
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jul 9, 2024
5f39954
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jul 12, 2024
a8d52ac
fixed tests
munishchouhan Jul 12, 2024
961532a
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jul 14, 2024
ae79952
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Jul 22, 2024
1a9238f
fixed error
munishchouhan Jul 22, 2024
fdc6521
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Jul 26, 2024
6fa92af
Merge branch '314-update-to-micronaut-41' of github.com:seqeralabs/wa…
pditommaso Jul 26, 2024
d3896e6
Bump MN 4.5.1
pditommaso Jul 26, 2024
b5a7e0c
Remove empty body hack
pditommaso Jul 26, 2024
dc9b513
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Aug 6, 2024
05bb02a
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Aug 14, 2024
4fabe36
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Aug 30, 2024
4b30524
Bump Micronaut 4.6
pditommaso Sep 3, 2024
e179edc
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Sep 11, 2024
a6d40bb
Fix failing type checks
pditommaso Sep 11, 2024
fe8121f
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Sep 13, 2024
f2dd5ab
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Sep 16, 2024
be6ff5f
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Sep 18, 2024
acad0e0
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Sep 19, 2024
a3b45e1
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Sep 23, 2024
633f141
fixed getCacheDirectory()
munishchouhan Sep 24, 2024
a88a8f9
fixed tests
munishchouhan Sep 24, 2024
592b727
reverted 633f141
munishchouhan Sep 24, 2024
cf25844
added 'wave.scan.cache.enabled'
munishchouhan Sep 24, 2024
359cf86
fixed tests
munishchouhan Sep 24, 2024
c049a02
Revert "fixed tests"
munishchouhan Sep 24, 2024
bda9324
Revert "added 'wave.scan.cache.enabled'"
munishchouhan Sep 24, 2024
dd105e0
fixed tests
munishchouhan Sep 24, 2024
b59fca2
fixed tests
munishchouhan Sep 24, 2024
8857f96
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Sep 26, 2024
65cbf3d
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 1, 2024
19587a9
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 2, 2024
23f3323
fixed tests
munishchouhan Oct 2, 2024
0c35bb0
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 4, 2024
f6c4991
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Oct 8, 2024
8378276
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 8, 2024
c90c410
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 9, 2024
f295c4e
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 9, 2024
2138744
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 10, 2024
3e1d318
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Oct 14, 2024
d030af6
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 16, 2024
0348fe8
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 17, 2024
bd69c2f
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Oct 21, 2024
fc8e6eb
Merge branch 'master' into 314-update-to-micronaut-41
munishchouhan Oct 22, 2024
0aa277a
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Oct 28, 2024
e112a7a
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Nov 1, 2024
9038a8e
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Nov 2, 2024
b56e04f
Update src/test/groovy/io/seqera/wave/controller/BuildControllerTest.…
pditommaso Nov 2, 2024
fd70ad1
Bump MN 4.6.3
pditommaso Nov 2, 2024
318f589
Minor changes
pditommaso Nov 2, 2024
45f3c89
Cleanup tests
pditommaso Nov 2, 2024
d9b9bf0
Fix tests
pditommaso Nov 2, 2024
cfa4e23
Fix tests
pditommaso Nov 2, 2024
2e5fb96
Improve tests
pditommaso Nov 2, 2024
f2ca95d
Improve tests
pditommaso Nov 2, 2024
8335ccd
Remove blank [ci skip]
pditommaso Nov 2, 2024
d3efe1b
Merge pull request #733 from seqeralabs/mn-4.6
pditommaso Nov 2, 2024
488356f
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Nov 2, 2024
d7403cf
Minor change [ci skip]
pditommaso Nov 2, 2024
383b249
[release] bump version 1.14.0-B1
pditommaso Nov 2, 2024
fba684c
Update VERSION [ci skipped]
pditommaso Nov 5, 2024
a664565
Update src/test/groovy/io/seqera/wave/service/CredentialsServiceTest.…
pditommaso Nov 5, 2024
efa08ae
Merge branch 'master' into 314-update-to-micronaut-41
pditommaso Nov 5, 2024
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
21 changes: 12 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter

plugins {
id 'java-library'
id 'io.seqera.wave.java-library-conventions'
id 'io.seqera.wave.groovy-application-conventions'
id "com.github.johnrengelman.shadow" version "7.1.1"
id "io.micronaut.minimal.application" version "3.7.0"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "io.micronaut.minimal.application" version "4.1.1"
id "com.google.cloud.tools.jib" version "3.4.2"
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'jacoco'
Expand All @@ -29,12 +29,13 @@ repositories {
}

dependencies {
annotationProcessor("io.micronaut.validation:micronaut-validation-processor")
annotationProcessor("io.micronaut:micronaut-http-validation")
compileOnly("io.micronaut.data:micronaut-data-processor")
compileOnly("io.micronaut:micronaut-inject-groovy")
compileOnly("io.micronaut:micronaut-http-validation")
implementation("jakarta.persistence:jakarta.persistence-api:3.0.0")
api 'io.seqera:lib-mail:1.0.0'
api 'io.seqera:lib-mail:1.1.0'
api 'io.seqera:wave-api:0.13.3'
api 'io.seqera:wave-utils:0.14.1'
implementation("io.micronaut:micronaut-http-client")
Expand All @@ -43,13 +44,14 @@ dependencies {
implementation("io.micronaut.reactor:micronaut-reactor")
implementation("io.micronaut.reactor:micronaut-reactor-http-client")
implementation("jakarta.annotation:jakarta.annotation-api")
implementation("io.micronaut:micronaut-validation")
implementation("io.micronaut.validation:micronaut-validation")
implementation 'io.micronaut.security:micronaut-security'
implementation "org.codehaus.groovy:groovy-json"
implementation "org.codehaus.groovy:groovy-nio"
implementation "org.apache.groovy:groovy-json"
implementation "org.apache.groovy:groovy-nio"
implementation 'com.google.guava:guava:32.1.2-jre'
implementation 'dev.failsafe:failsafe:3.1.0'
implementation('io.projectreactor:reactor-core')
implementation 'io.micronaut.reactor:micronaut-reactor'
implementation 'io.micronaut.reactor:micronaut-reactor-http-client'
implementation("io.seqera:tower-crypto:22.4.0-watson") { transitive = false } // to be replaced with 22.4.0 once released
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation 'org.apache.commons:commons-lang3:3.12.0'
Expand All @@ -62,6 +64,7 @@ dependencies {
implementation 'com.squareup.moshi:moshi-adapters:1.14.0'
implementation 'redis.clients:jedis:5.0.2'
implementation "io.github.resilience4j:resilience4j-ratelimiter:0.17.0"
implementation("io.micronaut:micronaut-retry")
// caching deps
implementation("io.micronaut.cache:micronaut-cache-core")
implementation("io.micronaut.cache:micronaut-cache-caffeine")
Expand All @@ -85,7 +88,7 @@ dependencies {
testImplementation("org.testcontainers:mysql:1.17.3")

// --
implementation("ch.qos.logback:logback-classic:1.4.8")
implementation("ch.qos.logback:logback-classic:1.5.3")

// rate limit
implementation 'com.coveo:spillway:3.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {

group = 'io.seqera'

tasks.withType(Test) {
tasks.withType(Test).configureEach {
// note: "--enable-preview" is required to use virtual thread on Java 19 and 20
jvmArgs (["--enable-preview"])
jvmArgs(["--enable-preview"])
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ compileJava {
options.release.set(11)
}

tasks.withType(GroovyCompile) {
sourceCompatibility = '11'
targetCompatibility = '11'
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = '17'
targetCompatibility = '17'
}

group = 'io.seqera'
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ compileJava {
options.release.set(11)
}

tasks.withType(GroovyCompile) {
sourceCompatibility = '11'
targetCompatibility = '11'
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = '17'
targetCompatibility = '17'
}

test {
Expand All @@ -40,21 +40,21 @@ java {
}

dependencies {
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'org.slf4j:slf4j-api:2.0.13'

testImplementation 'ch.qos.logback:logback-core:1.2.11'
testImplementation 'ch.qos.logback:logback-classic:1.2.11'
testImplementation "org.codehaus.groovy:groovy:3.0.15"
testImplementation "org.codehaus.groovy:groovy-nio:3.0.15"
testImplementation ("org.codehaus.groovy:groovy-test:3.0.17")
testImplementation ("cglib:cglib-nodep:3.3.0")
testImplementation ("org.objenesis:objenesis:3.2")
testImplementation ("org.spockframework:spock-core:2.3-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('org.spockframework:spock-junit4:2.3-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation 'ch.qos.logback:logback-core:1.4.11'
testImplementation 'ch.qos.logback:logback-classic:1.4.11'
testImplementation 'org.apache.groovy:groovy:4.0.15'
testImplementation 'org.apache.groovy:groovy-nio:4.0.15'
testImplementation 'org.apache.groovy:groovy-test:4.0.15'
testImplementation 'org.objenesis:objenesis:3.4'
testImplementation 'net.bytebuddy:byte-buddy:1.14.17'
testImplementation 'org.spockframework:spock-core:2.3-groovy-4.0'
testImplementation 'org.spockframework:spock-junit4:2.3-groovy-4.0'
}

tasks.withType(Test) {
jvmArgs ([
tasks.withType(Test).configureEach {
jvmArgs([
'--enable-preview',
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

micronautVersion=3.10.3
micronautVersion=4.6.0
pditommaso marked this conversation as resolved.
Show resolved Hide resolved
micronautEnvs=dev,h2,mail,aws-ses
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,39 @@
package io.seqera.wave.auth

import groovy.util.logging.Slf4j
import io.micronaut.core.annotation.NonNull
import io.micronaut.core.annotation.Nullable
import io.micronaut.http.HttpRequest
import io.micronaut.security.authentication.AuthenticationProvider
import io.micronaut.security.authentication.AuthenticationFailureReason
import io.micronaut.security.authentication.AuthenticationRequest
import io.micronaut.security.authentication.AuthenticationResponse
import io.micronaut.security.authentication.provider.HttpRequestAuthenticationProvider
import io.seqera.wave.service.account.AccountService
import io.seqera.wave.util.StringUtils
import jakarta.inject.Inject
import jakarta.inject.Singleton
import org.reactivestreams.Publisher
import reactor.core.publisher.Flux
import reactor.core.publisher.FluxSink
/**
* Basic Authentication provider
*
* @author Munish Chouhan <munish.chouhan@seqera.io>
*/
@Slf4j
@Singleton
class BasicAuthenticationProvider implements AuthenticationProvider {
class BasicAuthenticationProvider<B> implements HttpRequestAuthenticationProvider<B> {

@Inject
private AccountService accountService

@Override
Publisher<AuthenticationResponse> authenticate(@Nullable HttpRequest<?> httpRequest, AuthenticationRequest<?, ?> authRequest) {
Flux.create(emitter -> {
final user = authRequest.identity?.toString()
final pass = authRequest.secret?.toString()
if (accountService.isAuthorised(user, pass)) {
log.trace "Auth request OK - user '$user'; password: '${StringUtils.redact(pass)}'"
emitter.next(AuthenticationResponse.success((String) authRequest.identity))
emitter.complete()
}
else {
log.trace "Auth request FAILED - user '$user'; password: '${StringUtils.redact(pass)}'"
emitter.error(AuthenticationResponse.exception())
}
}, FluxSink.OverflowStrategy.ERROR)
AuthenticationResponse authenticate(@Nullable HttpRequest<B> httpRequest, @NonNull AuthenticationRequest<String, String> authRequest) {
final user = authRequest.identity?.toString()
final pass = authRequest.secret?.toString()
if (accountService.isAuthorised(user, pass)) {
log.trace "Auth request OK - user '$user'; password: '${StringUtils.redact(pass)}'"
return AuthenticationResponse.success(authRequest.identity)
} else {
log.trace "Auth request FAILED - user '$user'; password: '${StringUtils.redact(pass)}'"
return AuthenticationResponse.failure(AuthenticationFailureReason.CREDENTIALS_DO_NOT_MATCH)
}
}
}
2 changes: 1 addition & 1 deletion src/main/groovy/io/seqera/wave/auth/RegistryConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RegistryConfig {
* io: [ ... ]
* ]
*/
private Map<String,Object> registries
Map<String,Object> registries

RegistryKeys getRegistryKeys(String registryName) {
final String defaultRegistry = registries.get('default')?.toString() ?: 'docker.io'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import io.micronaut.context.annotation.Value
import io.micronaut.core.annotation.Nullable
import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Delete
import io.micronaut.http.annotation.Error
Expand Down Expand Up @@ -181,13 +182,13 @@ class ContainerController {
@Deprecated
@Post('/container-token')
@ExecuteOn(TaskExecutors.IO)
CompletableFuture<HttpResponse<SubmitContainerTokenResponse>> getToken(HttpRequest httpRequest, SubmitContainerTokenRequest req) {
CompletableFuture<HttpResponse<SubmitContainerTokenResponse>> getToken(HttpRequest httpRequest, @Body SubmitContainerTokenRequest req) {
return getContainerImpl(httpRequest, req, false)
}

@Post('/v1alpha2/container')
@ExecuteOn(TaskExecutors.IO)
CompletableFuture<HttpResponse<SubmitContainerTokenResponse>> getTokenV2(HttpRequest httpRequest, SubmitContainerTokenRequest req) {
CompletableFuture<HttpResponse<SubmitContainerTokenResponse>> getTokenV2(HttpRequest httpRequest, @Body SubmitContainerTokenRequest req) {
return getContainerImpl(httpRequest, req, true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import groovy.util.logging.Slf4j
import io.micronaut.context.annotation.Value
import io.micronaut.core.annotation.Nullable
import io.micronaut.http.HttpResponse
import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Post
import io.micronaut.http.annotation.QueryValue
Expand Down Expand Up @@ -70,8 +71,7 @@ class InspectController {
private String serverUrl

@Post("/v1alpha1/inspect")
CompletableFuture<HttpResponse<ContainerInspectResponse>> inspect(ContainerInspectRequest req, @Nullable @QueryValue String platform) {

CompletableFuture<HttpResponse<ContainerInspectResponse>> inspect(@Body ContainerInspectRequest req, @Nullable @QueryValue String platform) {
if( !req.containerImage )
throw new BadRequestException("Missing 'containerImage' attribute")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

package io.seqera.wave.controller

import javax.validation.Valid

import io.micronaut.http.annotation.Body
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Post
import io.micronaut.scheduling.TaskExecutors
import io.micronaut.scheduling.annotation.ExecuteOn
import io.seqera.wave.auth.RegistryAuthService
import jakarta.inject.Inject
import jakarta.validation.Valid
import reactor.core.publisher.Mono

@ExecuteOn(TaskExecutors.IO)
Expand All @@ -35,7 +35,7 @@ class ValidateController {
@Inject RegistryAuthService loginService

@Post
Mono<Boolean> validateCreds(@Valid ValidateRegistryCredsRequest request){
Mono<Boolean> validateCreds(@Valid @Body ValidateRegistryCredsRequest request){
Mono.just(
loginService.validateUser(request.registry, request.userName, request.password)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

package io.seqera.wave.controller

import io.micronaut.core.annotation.Nullable
import javax.validation.constraints.NotBlank

import io.micronaut.core.annotation.Introspected
import jakarta.validation.constraints.NotBlank

@Introspected
class ValidateRegistryCredsRequest {
Expand Down
5 changes: 2 additions & 3 deletions src/main/groovy/io/seqera/wave/exchange/PairingRequest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

package io.seqera.wave.exchange

import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotNull

import groovy.transform.CompileStatic
import io.micronaut.core.annotation.Introspected
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.NotNull

/**
* Model the request for a remote service instance to register
Expand Down
6 changes: 3 additions & 3 deletions src/main/groovy/io/seqera/wave/proxy/ErrResponse.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ class ErrResponse<T> implements HttpResponse<T> {
}

static ErrResponse<String> forString(String msg, HttpRequest request) {
final head = HttpHeaders.of('Content-Type': ['text/plain'], {true})
final head = HttpHeaders.of('Content-Type': ['text/plain'], (a, b) -> true)
new ErrResponse<String>(statusCode: 400, body: msg, request: request, uri: request.uri(), headers: head)
}

static ErrResponse<InputStream> forStream(String msg, HttpRequest request) {
final head = HttpHeaders.of('Content-Type': ['text/plain'], {true})
final head = HttpHeaders.of('Content-Type': ['text/plain'], (a, b) -> true)
new ErrResponse<InputStream>(statusCode: 400, body: new ByteArrayInputStream(msg.bytes), request: request, uri: request.uri(), headers: head)
}

static ErrResponse<byte[]> forByteArray(String msg, HttpRequest request) {
final head = HttpHeaders.of('Content-Type': ['text/plain'], {true})
final head = HttpHeaders.of('Content-Type': ['text/plain'], (a, b) -> true)
new ErrResponse<byte[]>(statusCode: 400, body: msg.bytes, request: request, uri: request.uri(), headers: head)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@

package io.seqera.wave.ratelimit.impl

import javax.validation.constraints.NotNull

import com.coveo.spillway.storage.InMemoryStorage
import com.coveo.spillway.storage.LimitUsageStorage
import com.coveo.spillway.storage.RedisStorage
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import io.micronaut.context.annotation.Factory
import io.micronaut.context.annotation.Requires
import io.seqera.wave.configuration.RateLimiterConfig
import io.seqera.wave.configuration.RedisConfig
import jakarta.inject.Singleton
import jakarta.validation.constraints.NotNull
import redis.clients.jedis.JedisPool

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

package io.seqera.wave.ratelimit.impl

import javax.validation.constraints.NotNull

import com.coveo.spillway.Spillway
import com.coveo.spillway.SpillwayFactory
import com.coveo.spillway.limit.Limit
Expand All @@ -34,6 +32,7 @@ import io.seqera.wave.exception.SlowDownException
import io.seqera.wave.ratelimit.AcquireRequest
import io.seqera.wave.ratelimit.RateLimiterService
import jakarta.inject.Singleton
import jakarta.validation.constraints.NotNull
/**
* This class manage how many requests can be requested from an user during a configurable period
*
Expand All @@ -60,7 +59,7 @@ class SpillwayRateLimiter implements RateLimiterService {
init(storage, config)
}

protected void init(@NotNull LimitUsageStorage storage, @NotNull RateLimiterConfig config){
protected void init(LimitUsageStorage storage, RateLimiterConfig config){
SpillwayFactory spillwayFactory = new SpillwayFactory(storage)
initBuilds(spillwayFactory, config)
initPulls(spillwayFactory, config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import jakarta.annotation.PostConstruct
@ConfigurationProperties('wave')
class AccountServiceImpl implements AccountService {

private Map<String,String> accounts = Map.of()
Map<String,String> accounts = Map.of()

@PostConstruct
private dumpAccounts() {
Expand All @@ -45,6 +45,7 @@ class AccountServiceImpl implements AccountService {

@Override
boolean isAuthorised(String username, String password) {
log.info("accounts: $accounts")
if( !username || !password )
return false
if( !accounts.containsKey(username) )
Expand Down
Loading