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

[TH2-5241] atomicity of page addition #6

Merged
merged 9 commits into from
Oct 4, 2024
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 Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM gradle:7.6-jdk11 AS build
FROM gradle:8.7-jdk11 AS build
ARG Prelease_version=0.0.0
COPY ./ .
RUN gradle clean build dockerPrepare -p cradle-admin-tool-http -Prelease_version=${Prelease_version}

FROM adoptopenjdk/openjdk11:alpine
ENV CRADLE_INSTANCE_NAME=instance1 \

Check warning on line 7 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-job / Build Docker image and push to ghcr.io / docker-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "CASSANDRA_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
CASSANDRA_DATA_CENTER=kos \
CASSANDRA_HOST=cassandra \
CASSANDRA_PORT=9042 \
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# th2-cradle-admin 1.11.0
# th2-cradle-admin 1.11.1

The th2-cradle-admin is a set of projects for managing books and pages in th2 storage.

Expand All @@ -15,7 +15,7 @@ metadata:
name: cradle-admin
spec:
imageName: ghcr.io/th2-net/th2-cradle-admin-tool
imageVersion: 1.9.0-dev
imageVersion: 1.11.1-dev
type: th2-conn
customConfig:
ip: 0.0.0.0
Expand Down Expand Up @@ -65,6 +65,14 @@ spec:

## Release notes:

### 1.11.1-dev
* Updated:
* Cradle API to `5.4.3-dev` (executes insert and update operations on pages atomically)
* th2-gradle-plugin: `0.1.3` (th2-bom: `4.8.0`)
* common to `5.14.0-dev`
* jetty: `9.4.56.v20240826`
* commons-cli: `1.9.0`

### 1.11.0-dev
* Migrated to th2 gradle plugin `0.0.8`
* Updated common: `5.12.0-dev`
Expand Down
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id "com.exactpro.th2.gradle.base" version "0.0.8"
id "com.exactpro.th2.gradle.component" version "0.0.8" apply false
id "com.exactpro.th2.gradle.base" version "0.1.3"
id "com.exactpro.th2.gradle.component" version "0.1.3" apply false
}

ext {
commonVersion = '5.12.0-dev'
cradleVersion = '5.3.0-dev'
commonVersion = '5.14.0-dev'
cradleVersion = '5.4.3-dev'
}

dependencyCheck {
Expand Down Expand Up @@ -41,12 +41,11 @@ subprojects {
dependencies {
implementation "org.slf4j:slf4j-api"

testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.10.0'

testImplementation 'com.exactpro.th2:junit-jupiter-integration:0.0.1'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.mockito:mockito-core:5.14.1'
testImplementation 'org.mockito:mockito-junit-jupiter:5.14.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.1'

testRuntimeOnly('org.junit.platform:junit-platform-launcher') {
because 'This artifact will not be added automatically since gradle 9.0. You can read more information here:' +
Expand Down
2 changes: 1 addition & 1 deletion cradle-admin-tool-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
implementation "com.exactpro.th2:cradle-core:$cradleVersion"
implementation "com.exactpro.th2:cradle-cassandra:$cradleVersion"

implementation 'commons-cli:commons-cli:1.7.0'
implementation 'commons-cli:commons-cli:1.9.0'

testImplementation project(':cradle-admin-tool-test')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,8 @@ public void addExistedPageTest(@Th2AppFactory CommonFactory appFactory,
cradleStorage.refreshBook(bookName);
assertEquals(1, bookInfo.getPages().size());
checkOutput(false, String.format(
"Query to insert page '%s' book '%s' was not applied. Probably, page already exists",
"Query to insert page '%s' to book '%s' failed. Page already exists",
pageName,
bookName.toLowerCase()));
}

}
}
19 changes: 14 additions & 5 deletions cradle-admin-tool-http/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cradle-admin-tool-http (1.8.0)
# cradle-admin-tool-http (1.11.1-dev)
Service which allows user to manage books/pages via RestAPI requests.
- The first page in a book can be created only if start time is more than current time.
- After the first page all new pages must have start time more than current time + `bookRefreshIntervalMillis` * 2
Expand All @@ -9,7 +9,7 @@ Service which allows user to manage books/pages via RestAPI requests.


## Configuration
- **ip** - host where http cradle admin instance will be instanciated. Default value: `0.0.0.0`
- **ip** - host where http cradle admin instance will be instantiated. Default value: `0.0.0.0`
- **port** - port on which http server will listen user requests. Default value: `8080`
- **page-recheck-interval** - interval in seconds which `PageManager` service checks if new page is required to create or not based on duration values presented in `auto-pages`. Default value: 60 seconds
- **auto-book** - if `true` than cradle-admin-tool creates books with first page for each value from `auto-pages` option when target book doesn't exist in cradle.
Expand All @@ -27,7 +27,7 @@ metadata:
name: cradle-admin
spec:
image-name: your.image.repo:42/cradle-admin-tool-http
image-version: 1.6.1
image-version: 1.11.1-dev
type: th2-box
custom-config:
ip: 198.168.0.2
Expand All @@ -48,6 +48,15 @@ spec:

## Release notes

### 1.11.1-dev

+ Updated:
+ Cradle API to `5.4.3-dev` (executes insert and update operations on pages atomically)
+ th2-gradle-plugin: `0.1.3` (bom: `4.8.0`)
+ common to `5.14.0-dev`
+ jetty: `9.4.56.v20240826`
lumber1000 marked this conversation as resolved.
Show resolved Hide resolved
+ commons-cli: `1.9.0`

### 1.8.0

+ Feature:
Expand Down Expand Up @@ -78,5 +87,5 @@ spec:
+ Cradle-admin creates auto-page in future even if the start time of a last page is much earlier than now + threshold

+ Updated:
+ Cradle API to `5.0.3-dev`
+ common to `5.2.1-dev`
+ Cradle API to `5.0.3-dev`
+ common to `5.2.1-dev`
4 changes: 2 additions & 2 deletions cradle-admin-tool-http/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

dependencies {
implementation project(':cradle-admin-tool-core')
implementation platform('org.eclipse.jetty:jetty-bom:9.4.54.v20240208')
implementation platform('org.eclipse.jetty:jetty-bom:9.4.56.v20240826')
implementation("com.exactpro.th2:common:$commonVersion") {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
Expand All @@ -15,7 +15,7 @@ dependencies {
implementation "org.eclipse.jetty:jetty-server"
implementation "org.eclipse.jetty:jetty-servlet"

implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.0'

implementation 'org.apache.commons:commons-lang3'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release_version = 1.11.0
release_version = 1.11.1
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading