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

Scan v2 #662

Merged
merged 67 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c426137
Remove build record store
pditommaso Sep 22, 2024
df2b4ac
Fix failing tests
pditommaso Sep 25, 2024
ae5aea2
Normalise scan state handling
pditommaso Sep 25, 2024
dc5535d
Fix tests
pditommaso Sep 25, 2024
bd77ad6
fix failing tests
pditommaso Sep 25, 2024
9698d39
Make fields final
pditommaso Sep 25, 2024
56450fd
Rename Redis package
pditommaso Sep 25, 2024
3841544
Rename to state package
pditommaso Sep 25, 2024
5a9cbc7
wip
pditommaso Sep 25, 2024
097c71c
wip2
pditommaso Sep 25, 2024
11b279b
wip3
pditommaso Sep 25, 2024
79a753a
wip4
pditommaso Sep 25, 2024
cbff515
wip5
pditommaso Sep 25, 2024
3bbb39e
wip6
pditommaso Sep 25, 2024
1eb1d9f
wip7
pditommaso Sep 25, 2024
0e382df
wip8
pditommaso Sep 25, 2024
beae140
wip9
pditommaso Sep 25, 2024
e6128d4
wip
pditommaso Sep 26, 2024
1115288
[release] bump version 1.13.0-B1
pditommaso Sep 26, 2024
09a7cce
wip
pditommaso Sep 26, 2024
0e0da54
Fix test class name
pditommaso Sep 26, 2024
ea10890
wip
pditommaso Sep 26, 2024
597ab7b
wip
pditommaso Sep 26, 2024
e39e1e3
Fix build succeded & status response
pditommaso Sep 26, 2024
e64f56e
Simulate xclaim delay with local stream
pditommaso Sep 26, 2024
c0e3afa
[release] bump version 1.13.0-B2
pditommaso Sep 26, 2024
ae90c85
Merge branch 'remove-build-record-store' into scan-v2
pditommaso Sep 26, 2024
8f41b01
wip
pditommaso Sep 26, 2024
c8afbdb
Merge branch 'master' into scan-v2
pditommaso Sep 26, 2024
82aa93e
Add support container status
pditommaso Sep 29, 2024
5237596
ContainerRequest refactor
pditommaso Sep 29, 2024
8cb544c
Remove findByRequestId method
pditommaso Sep 29, 2024
8c6ae95
wip
pditommaso Sep 30, 2024
b4967d8
Minor change
pditommaso Sep 30, 2024
28e839a
wip
pditommaso Sep 30, 2024
10e4cf4
wip
pditommaso Sep 30, 2024
3c8d80a
wip
pditommaso Sep 30, 2024
a253149
Simplify build, scan and mirror id
pditommaso Sep 30, 2024
940f43c
wip
pditommaso Sep 30, 2024
ad9baab
wip
pditommaso Sep 30, 2024
a397e46
Minor [ci skip]
pditommaso Oct 1, 2024
2b251b9
Merge branch 'master' into scan-v2
pditommaso Oct 1, 2024
ffd0e3c
Make scanId digest aware
pditommaso Oct 1, 2024
988c867
Merge branch 'master' into scan-v2
pditommaso Oct 3, 2024
9b5e366
Fix failing tests
pditommaso Oct 3, 2024
4cf7ac4
wip
pditommaso Oct 3, 2024
0f8b03b
wip
pditommaso Oct 4, 2024
b42f385
Improve test
pditommaso Oct 4, 2024
62d2e36
wip
pditommaso Oct 4, 2024
601c0de
wip
pditommaso Oct 4, 2024
73cdc60
fix failing tests
pditommaso Oct 4, 2024
977996f
Fix failing tests
pditommaso Oct 4, 2024
ccce7d6
Refactor consts
pditommaso Oct 4, 2024
c4b0601
Fix typo
pditommaso Oct 4, 2024
688c1da
Add user info to mirror result
pditommaso Oct 4, 2024
88004ce
wip
pditommaso Oct 4, 2024
91bf7ed
Minor changes
pditommaso Oct 5, 2024
0d0904f
Merge branch 'scan-v2' into scan-build-count
pditommaso Oct 5, 2024
acb25d4
wip
pditommaso Oct 5, 2024
810b612
wip
pditommaso Oct 5, 2024
88a85e1
Run ci tests
pditommaso Oct 5, 2024
599684e
wip
pditommaso Oct 5, 2024
62e7bfd
Update default scanMode
pditommaso Oct 5, 2024
501c575
Add comment [ci skip]
pditommaso Oct 5, 2024
02f2d61
Bump [email protected]
pditommaso Oct 5, 2024
c42b02b
Fix typo [ci skip]
pditommaso Oct 5, 2024
7276bf7
Fix failing tests
pditommaso Oct 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
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
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:wave-api:0.12.0'
api 'io.seqera:wave-api:0.13.0'
api 'io.seqera:wave-utils:0.13.1'

implementation("io.micronaut:micronaut-http-client")
Expand Down Expand Up @@ -72,6 +72,7 @@ dependencies {
implementation 'software.amazon.awssdk:ses'
implementation 'org.yaml:snakeyaml:2.0'
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
implementation 'org.luaj:luaj-jse:3.0.1'
//object storage dependency
implementation("io.micronaut.objectstorage:micronaut-object-storage-aws")
// include sts to allow the use of service account role - https://stackoverflow.com/a/73306570
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
#

micronautVersion=3.10.3
micronautEnvs=dev,h2,mail,aws-ses
micronautEnvs=dev,h2,mail,aws-ses,redis
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class ScanConfig {
@Value('${wave.scan.status.duration:1h}')
Duration statusDuration

@Value('${wave.scan.id.duration:7d}')
Duration scanIdDuration

String getScanImage() {
return scanImage
}
Expand All @@ -86,6 +89,11 @@ class ScanConfig {
return result
}

@Memoized
Path getWorkspace() {
Path.of(buildDirectory).toAbsolutePath()
}

String getRequestsCpu() {
return requestsCpu
}
Expand Down
29 changes: 4 additions & 25 deletions src/main/groovy/io/seqera/wave/controller/BuildController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ import io.micronaut.http.server.types.files.StreamedFile
import io.micronaut.scheduling.TaskExecutors
import io.micronaut.scheduling.annotation.ExecuteOn
import io.seqera.wave.api.BuildStatusResponse
import io.seqera.wave.exception.BadRequestException
import io.seqera.wave.service.builder.ContainerBuildService
import io.seqera.wave.service.logs.BuildLogService
import io.seqera.wave.service.mirror.ContainerMirrorService
import io.seqera.wave.service.mirror.MirrorRequest
import io.seqera.wave.service.persistence.WaveBuildRecord
import jakarta.inject.Inject
/**
Expand All @@ -51,12 +48,9 @@ class BuildController {
@Inject
private ContainerBuildService buildService

@Inject
private ContainerMirrorService mirrorService

@Inject
@Nullable
BuildLogService logService
private BuildLogService logService

@Get("/v1alpha1/builds/{buildId}")
HttpResponse<WaveBuildRecord> getBuildRecord(String buildId) {
Expand All @@ -79,25 +73,10 @@ class BuildController {

@Get("/v1alpha1/builds/{buildId}/status")
HttpResponse<BuildStatusResponse> getBuildStatus(String buildId) {
final resp = buildResponse0(buildId)
resp != null
? HttpResponse.ok(resp)
final build = buildService.getBuildRecord(buildId)
build != null
? HttpResponse.ok(build.toStatusResponse())
: HttpResponse.<BuildStatusResponse>notFound()
}

protected BuildStatusResponse buildResponse0(String buildId) {
if( !buildId )
throw new BadRequestException("Missing 'buildId' parameter")
// build IDs starting with the `mr-` prefix are interpreted as mirror requests
if( buildId.startsWith(MirrorRequest.ID_PREFIX) ) {
return mirrorService
.getMirrorEntry(buildId)
?.toStatusResponse()
}
else {
return buildService
.getBuildRecord(buildId)
?.toStatusResponse()
}
}
}
Loading