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

Merged dev-version-2 to master #18

Closed
wants to merge 6 commits into from
Closed
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
19 changes: 19 additions & 0 deletions .github/workflows/build-dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish dev release Docker image to Github Container Registry ghcr.io and publish dev release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: true
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 19 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish release Docker image to Github Container Registry ghcr.io and publish release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: false
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
24 changes: 24 additions & 0 deletions .github/workflows/build-sanpshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and publish Docker image to Github Container Registry ghcr.io and publish snapshot jar to sonatype

on:
push:
branches-ignore:
- master
- version-*
- dependabot**
paths-ignore:
- README.md

jobs:
build-job:
uses: th2-net/.github/.github/workflows/compound-java-dev.yml@main
with:
build-target: 'Sonatype,Docker'
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 0 additions & 19 deletions .github/workflows/dev-docker-publish.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/docker-publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:7.5-jdk11 AS build
FROM gradle:7.6-jdk11 AS build
ARG release_version
COPY ./ .
RUN gradle --no-daemon clean build dockerPrepare -Prelease_version=${release_version}
Expand Down
62 changes: 38 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# HTTP Codec v0.2.0
# HTTP Codec v0.5.0

This microservice can encode and decode HTTP messages

Expand Down Expand Up @@ -27,32 +27,33 @@ This codec processes parsed messages with `http` protocol in metadata field
1. HTTP message - `Message` with `Request` or `Response` type (protocol = `http`)
2. HTTP message body - `RawMessage` with a raw message body (if present)

If decoded message was an HTTP request, message body metadata would contain `method` and `uri` properties with HTTP request method name and URI respectively
If decoded message was an HTTP request, message body metadata would contain `method` and `uri` properties with HTTP
request method name and URI respectively

## Message types

* Request

|Field|Type|Description|
|:---:|:---:|:---:|
|method|String|HTTP method name (e.g. GET, POST, etc.)|
|uri|String|Request URI (e.g. /some/request/path?param1=value1&param2=value2...)|
|headers|List\<Header>|HTTP headers (e.g. Host, Content-Length, etc.)|
| Field | Type | Description |
|:-------:|:-------------:|:--------------------------------------------------------------------:|
| method | String | HTTP method name (e.g. GET, POST, etc.) |
| uri | String | Request URI (e.g. /some/request/path?param1=value1&param2=value2...) |
| headers | List\<Header> | HTTP headers (e.g. Host, Content-Length, etc.) |

* Response

|Field|Type|Description|
|:---:|:---:|:---:|
|statusCode|String|HTTP status code (e.g. 200, 403, 500, etc)|
|reason|String|HTTP status reason (e.g. OK, Forbidden, Internal Server Error, etc.)|
|headers|List\<Header>|HTTP headers (e.g. Set-Cookie, Content-Length, etc.)|
| Field | Type | Description |
|:----------:|:-------------:|:--------------------------------------------------------------------:|
| statusCode | String | HTTP status code (e.g. 200, 403, 500, etc) |
| reason | String | HTTP status reason (e.g. OK, Forbidden, Internal Server Error, etc.) |
| headers | List\<Header> | HTTP headers (e.g. Set-Cookie, Content-Length, etc.) |

* Header

|Field|Type|Description|
|:---:|:---:|:---:|
|name|String|HTTP header name|
|value|String|HTTP header value|
| Field | Type | Description |
|:-----:|:------:|:-----------------:|
| name | String | HTTP header name |
| value | String | HTTP header value |

## Deployment via `infra-mgr`

Expand Down Expand Up @@ -119,17 +120,30 @@ spec:
enabled: false
```

### Gradle metadata note
ignoreGradleMetadataRedirection is used for sonatype because Sailfish dependencies have constrains that interfere with BOM,
so we exclude Gradle metadata for these repositories.

It's been verified that Sailfish itself is compatible with versions from BOM and therefore safe to use.


# Release notes

## 0.5.0
+ Migrated to th2 gradle plugin: `0.0.6`
+ Updated:
+ bom `4.6.1`
+ common: `5.10.1-dev`
+ common-utils: `2.2.3-dev`
+ codec: `5.5.0-dev`
+ rawhttp-core: `2.6.0`

## 0.4.0

+ th2 transport protocol support
+ Updated bom: `4.5.0-dev`
+ Updated common: `5.7.2-dev`
+ Updated common-utils: `2.2.2-dev`
+ Updated codec: `5.4.1-dev`
+ Updated kotlin: `1.8.22`
+ Removed sailfish-utils

## 0.3.0

* th2-common upgrade to `3.44.0`
* th2-bom upgrade to `4.1.0`
* th2-codec upgrade to `4.7.6`
* sailfish upgrade to `3.3.54`
* sailfish upgrade to `3.3.54`
141 changes: 26 additions & 115 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,152 +1,63 @@
plugins {
id 'com.palantir.docker' version '0.25.0'
id 'org.jetbrains.kotlin.jvm' version "${kotlin_version}"
id 'application'
id "org.owasp.dependencycheck" version "7.2.0"
id 'org.jetbrains.kotlin.kapt' version "${kotlin_version}"
}
id "org.jetbrains.kotlin.jvm" version "$kotlin_version"
id "org.jetbrains.kotlin.kapt" version "$kotlin_version"
id("java-library")
id("maven-publish")

dependencyCheck {
format='HTML'
failBuildOnCVSS=5
}

ext {
sharedDir = file("${project.rootDir}/shared")
sailfishVersion = '3.3.54'
id "com.exactpro.th2.gradle.publish" version "0.0.6"
id "com.exactpro.th2.gradle.component" version "0.0.6"
}

group = 'com.exactpro.th2'
version = release_version

sourceCompatibility = 11
targetCompatibility = 11

ext.excludeSailfish = { rcd ->
rcd.excludeModule("com.exactpro.sf", "sailfish-core")
rcd.excludeModule("com.exactpro.sf", "sailfish-common")
rcd.excludeModule("com.exactpro.sf", "sailfish-rest-api-client")
rcd.excludeModule("com.exactpro.sf", "service-http")
kotlin {
jvmToolchain(11)
}

repositories {
maven {
name 'MavenLocal'
url sharedDir
}

maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
content {
excludeSailfish(it)
}
}

// ignoreGradleMetadataRedirection is used for sonatype because
// Sailfish dependencies have constrains that interfere with our BOM
// so we exclude Gradle metadata for this repositories.
// We've checked these versions - they are compatible and safe to use
mavenCentral()
maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
content {
excludeSailfish(it)
}
}
maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
mavenCentral()
mavenLocal()

configurations.all {
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
}

jar {
manifest {
attributes(
'Created-By': "${System.getProperty('java.version')} (${System.getProperty('java.vendor')})",
'Specification-Title': '',
'Specification-Vendor': 'Exactpro Systems LLC',
'Implementation-Title': project.archivesBaseName,
'Implementation-Vendor': 'Exactpro Systems LLC',
'Implementation-Vendor-Id': 'com.exactpro',
'Implementation-Version': project.version
)
}
}

dependencies {
api platform('com.exactpro.th2:bom:4.1.0')

implementation 'com.exactpro.th2:common:3.44.0'
implementation 'com.exactpro.th2:codec:4.7.6'
implementation "com.exactpro.th2:common:5.10.1-dev"
implementation "com.exactpro.th2:common-utils:2.2.3-dev"
implementation "com.exactpro.th2:codec:5.5.0-dev"

implementation 'com.exactpro.th2:sailfish-utils:3.14.0'

compileOnly 'com.google.auto.service:auto-service:1.0.1'
annotationProcessor 'com.google.auto.service:auto-service:1.0.1'
compileOnly "com.google.auto.service:auto-service:1.1.1"
kapt "com.google.auto.service:auto-service:1.1.1"

implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlin_version
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_version
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: '1.7.9'
implementation group: 'com.athaydes.rawhttp', name: 'rawhttp-core', version: '2.4.1'
implementation "io.github.microutils:kotlin-logging:3.0.5"
implementation "com.athaydes.rawhttp:rawhttp-core:2.6.0"

testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit5', version: kotlin_version
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'

kapt 'com.google.auto.service:auto-service:1.0.1'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.3.1'
testImplementation 'io.strikt:strikt-core:0.34.1'
}

application {
mainClassName 'com.exactpro.th2.codec.MainKt'
}

applicationName = 'service'

distTar {
archiveName "${applicationName}.tar"
}

dockerPrepare {
dependsOn distTar
}

docker {
copySpec.from(tarTree("$buildDir/distributions/${applicationName}.tar"))
}

compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
mainClass.set("com.exactpro.th2.codec.MainKt")
}

test {
useJUnitPlatform()
}

dependencyCheck {
suppressionFile = file('suppressions.xml')
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
kotlin.code.style=official
kotlin_version=1.6.21
release_version=0.3.0
kotlin_version=1.8.22
release_version=0.5.0
Loading
Loading