Skip to content

Commit

Permalink
Merge branch 'master' into 789-capture-wave-metrics-by-container-arch…
Browse files Browse the repository at this point in the history
…itecture
  • Loading branch information
munishchouhan authored Jan 31, 2025
2 parents b0c8bfb + e59e9d3 commit d0402a0
Show file tree
Hide file tree
Showing 22 changed files with 224 additions and 41 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/typespec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ on:
- '**'
paths :
- 'typespec/**'
- VERSION
pull_request:
types: [opened, reopened, synchronize]
paths:
- 'typespec/**'
- VERSION

permissions:
contents: read
Expand All @@ -30,11 +32,26 @@ jobs:
node-version : '20.9.0'

- name : Install tsp
run : npm install -g @typespec/compiler
run : npm install -g @typespec/compiler@0.64.0

- name : Validate tsp files
run : |
cd typespec
tsp install
tsp compile .
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{secrets.TOWER_CI_AWS_ACCESS}}
aws-secret-access-key: ${{secrets.TOWER_CI_AWS_SECRET}}
aws-region: eu-west-1

- name : Login to Amazon ECR
id : login-ecr
uses : aws-actions/amazon-ecr-login@v1

- name: Release OpenAPI docs
if: "contains(github.event.head_commit.message, '[release]')"
run: |
bash typespec/tag-and-push-openapi.sh
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.8
1.17.0
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ dependencies {
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.2.1'
api 'io.seqera:lib-pool:1.0.0'
api 'io.seqera:wave-api:0.14.0'
api 'io.seqera:wave-utils:0.15.0'
implementation 'io.seqera:lib-mail:1.2.1'
implementation 'io.seqera:lib-pool:1.0.0'
implementation 'io.seqera:wave-api:0.14.0'
implementation 'io.seqera:wave-utils:0.15.0'
implementation 'io.seqera:lib-crypto:1.0.0'
implementation 'io.micronaut:micronaut-http-client'
implementation 'io.micronaut:micronaut-jackson-databind'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ repositories {
}

java {
// these settings apply to all jvm tooling, including groovy
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

compileJava {
options.release.set(17)
}

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

group = 'io.seqera'
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ repositories {
}

java {
// these settings apply to all jvm tooling, including groovy
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

compileJava {
options.release.set(17)
}

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

test {
Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Wave changelog
1.17.0 - 30 Jan 2025
- Ignore URI dependencies in Conda envs when generating image hash (#786) [c097c8a2]
- Render html from openapi spec generated by typespec (#707) [d3dfee9a]
- Disable proxy cache by default [c91fc31f]
- Update gradle deps [8a2e4209]
- Bump buildkit to version 0.18.2 (#787) [facbf99c]
- Bump java settings [1f6b94da]

1.16.8 - 20 Jab 2025
- Add TraceContextFilter logging context propagation [396c10c2]
- Improve Proxy cache configuration [163e605f]
Expand Down
6 changes: 3 additions & 3 deletions configuration.md → docs/configuration.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Wave Application Configuration

Set Wave configuration values using environment variables or in [`config.yml`](./config.yml) configuration file
Set Wave configuration values using environment variables or in [`config.yml`](https://github.com/seqeralabs/wave/blob/master/config.yml) configuration file

### config.yml configuration

Declare YAML configuration values in [`config.yml`](./config.yml)
Declare YAML configuration values in [`config.yml`](https://github.com/seqeralabs/wave/blob/master/config.yml)
```
wave:
mail:
Expand Down Expand Up @@ -39,7 +39,7 @@ The generic format for the attributes is `wave.registries.<registry_name>.userna
You need to specify all the repositories you will use in the respective wave installation.
Below are the standard format for known registries, but you can change registry name `(azurecr.io)` to specific one like `seqeralabs.azurecr.io `.

**Note**: Container registry credentials can be defined in [`config.yml`](./config.yml) too. These configurations are important for the wave authentication to the repositories used to push or pull artifacts.
**Note**: Container registry credentials can be defined in [`config.yml`](https://github.com/seqeralabs/wave/blob/master/config.yml) too. These configurations are important for the wave authentication to the repositories used to push or pull artifacts.

- **`wave.registries.default`**: the default Docker registry for Wave. The default is `docker.io`, and it represents the Docker Hub. *Optional*.

Expand Down
4 changes: 1 addition & 3 deletions docs/metrics.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
title: Usage metrics
---
# Usage metrics

Wave uses Redis to store its usage metrics for a specific date and/or a specific organization.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TraceElapsedTimeInterceptor implements MethodInterceptor<Object,Object> {
finally {
final delta = System.currentTimeMillis() - begin
if( delta>=threshold ) {
log.warn(msg(delta,context,result))
log.debug(msg(delta,context,result))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ProxyCacheConfig {
@Value('${wave.proxy-cache.max-size:10000}')
private int maxSize

@Value('${wave.proxy-cache.enabled:true}')
@Value('${wave.proxy-cache.enabled:false}')
private boolean enabled

Duration getDuration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,9 @@ class ServiceInfoController {
: HttpResponse.badRequest()
}

@Get(uri = "/openapi")
HttpResponse getOpenAPI() {
HttpResponse.redirect(URI.create("/openapi/"))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void onComplete() {
protected void traceResponse(HttpResponse<?> response) {
final long delta = System.currentTimeMillis()-begin;
if( delta>=duration.toMillis() )
log.warn("Slow request detected - elapsed time: {}\n{}", Duration.ofMillis(delta), dumpRequest(request,response));
log.debug("Slow request detected - elapsed time: {}\n{}", Duration.ofMillis(delta), dumpRequest(request,response));
}

@CompileStatic
Expand Down
3 changes: 3 additions & 0 deletions src/main/groovy/io/seqera/wave/util/ContainerHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ class ContainerHelper {
//strip `pip:` prefix
if( it.startsWith('pip:') && it.length()>4 && it[4]!=':')
it = it.substring(4)
// ignore http based dependencies
if( it.startsWith('https://') || it.startsWith('http://'))
continue
// strip channel prefix
final int p=it.indexOf('::')
if( p!=-1 )
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Wave, containers provisioning service
* Copyright (c) 2024, Seqera Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package io.seqera.wave.controller

import spock.lang.Specification

import io.micronaut.http.HttpResponse
import io.micronaut.http.HttpStatus

/**
*
* @author Munish Chouhan <[email protected]>
*/
class ServiceInfoControllerTest extends Specification {

def 'should redirect to /openapi/'() {
given:
def controller = new ServiceInfoController()

when:
HttpResponse response = controller.getOpenAPI()

then:
response.status == HttpStatus.MOVED_PERMANENTLY
response.header('Location') == '/openapi/'
}

}
32 changes: 32 additions & 0 deletions src/test/groovy/io/seqera/wave/util/ContainerHelperTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,27 @@ class ContainerHelperTest extends Specification {
- pandas==2.2.2
- numpy=1.0
'''.stripIndent(true)
@Shared def GIT1 = '''\
channels:
- bioconda
- conda-forge
dependencies:
- pip
- pip:
- "https://github.com/seqeralabs/seqera-kit/archive/dev.zip"
'''.stripIndent(true)
@Shared def GIT2 = '''\
channels:
- bioconda
- conda-forge
dependencies:
- bwa
- pip
- pip:
- "https://github.com/seqeralabs/seqera-kit/archive/dev.zip"
- "https://github.com/seqeralabs/seqera-kit/archive/dev2.zip"
- "https://github.com/seqeralabs/seqera-kit/archive/dev3.zip"
'''.stripIndent(true)

@Unroll
def 'should make request target with name strategy' () {
Expand Down Expand Up @@ -546,6 +567,16 @@ class ContainerHelperTest extends Specification {
'DOCKER' | 'foo.com/build' | '123' | PIP2 | 'tagPrefix' | 'foo.com/build:pip_pandas-2.2.2_numpy-1.0--123'
'DOCKER' | 'foo.com/build' | '123' | PIP2 | 'imageSuffix' | 'foo.com/build/pip_pandas_numpy:123'
'DOCKER' | 'foo.com/build' | '123' | PIP2 | 'none' | 'foo.com/build:123'
and:
'DOCKER' | 'foo.com/build' | '123' | GIT1 | null | 'foo.com/build:pip--123'
'DOCKER' | 'foo.com/build' | '123' | GIT1 | 'tagPrefix' | 'foo.com/build:pip--123'
'DOCKER' | 'foo.com/build' | '123' | GIT1 | 'imageSuffix' | 'foo.com/build/pip:123'
'DOCKER' | 'foo.com/build' | '123' | GIT1 | 'none' | 'foo.com/build:123'
and:
'DOCKER' | 'foo.com/build' | '123' | GIT2 | null | 'foo.com/build:bwa_pip--123'
'DOCKER' | 'foo.com/build' | '123' | GIT2 | 'tagPrefix' | 'foo.com/build:bwa_pip--123'
'DOCKER' | 'foo.com/build' | '123' | GIT2 | 'imageSuffix' | 'foo.com/build/bwa_pip:123'
'DOCKER' | 'foo.com/build' | '123' | GIT2 | 'none' | 'foo.com/build:123'

}

Expand All @@ -571,4 +602,5 @@ class ContainerHelperTest extends Specification {
thrown(BadRequestException)

}

}
10 changes: 10 additions & 0 deletions typespec/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM nginxinc/nginx-unprivileged:alpine

# Copy index.html and openapi.yaml to the Nginx html directory
COPY index.html /usr/share/nginx/html/openapi/index.html
COPY tsp-output/@typespec/openapi3/openapi.yaml /usr/share/nginx/html/openapi/openapi.yaml

# Expose port 8080
EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]
28 changes: 28 additions & 0 deletions typespec/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Wave API Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css">
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function() {
const ui = SwaggerUIBundle({
url: "openapi.yaml",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
layout: "BaseLayout"
});
window.ui = ui;
};
</script>
</body>
</html>
1 change: 1 addition & 0 deletions typespec/main.tsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/openapi3";
import "@typespec/versioning";
import "./routes.tsp";
12 changes: 6 additions & 6 deletions typespec/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "wave",
"version": "1.8.2",
"version": "1.16.7",
"type": "module",
"dependencies": {
"@typespec/compiler": "latest",
"@typespec/http": "latest",
"@typespec/rest": "latest",
"@typespec/openapi3": "latest"
"@typespec/compiler": "0.64.0",
"@typespec/http": "0.64.0",
"@typespec/openapi3": "0.64.0",
"@typespec/rest": "0.64.0"
},
"private": true
}
}
11 changes: 9 additions & 2 deletions typespec/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ import "./models/models.tsp";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@versioned(wave.Versions)
@service({
title: "Wave service",
title: "Wave service"
})
@server("https://wave.seqera.io", "wave endopint")
@server("https://wave.dev-tower.net", "wave dev endpoint")
@server("https://wave.stage-seqera.io", "wave stage endpoint")
@server("https://wave.seqera.io", "wave prod endpoint")
namespace wave {
enum Versions {
v1: "0.0.0",
}
@route("/v1alpha2/container")
interface ContainerService {

Expand Down
Loading

0 comments on commit d0402a0

Please sign in to comment.