Skip to content

Commit a1ef2dd

Browse files
Merge pull request #123 from scality/improvement/OSIS-109-rebase-main
Improvement/osis 109 rebase main
2 parents bc6dc46 + d495f1d commit a1ef2dd

File tree

48 files changed

+649
-700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+649
-700
lines changed

.github/workflows/gradle-build-and-upload.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,23 @@ jobs:
2727
uses: actions/setup-java@v3
2828
with:
2929
distribution: "corretto"
30-
java-version: "8"
30+
java-version: "17"
3131

3232
- name: Setup Gradle
3333
uses: gradle/gradle-build-action@v2
3434
with:
35-
gradle-version: 6.7.1
35+
gradle-version: 7.3
3636

3737
- name: Execute build with Gradle wrapper
38-
run: ./gradlew build
38+
run: ./gradlew build -PsonatypeUsername=$NEXUS_UNAME -PsonatypePassword=$NEXUS_PWD
3939

4040
- name: Get archive upload signing key
4141
run: echo "$SIGNING_KEY" | base64 --decode > $GITHUB_WORKSPACE/secring.gpg
4242

4343
- name: Gradle Upload Archives to Snapshot Repository
4444
if: ${{ !inputs.release }}
45-
run: gradle uploadArchives -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/secring.gpg -PnexusUsername=$NEXUS_UNAME -PnexusPassword=$NEXUS_PWD -Psigning.keyId=$SIGNING_KEYID -Psigning.password=$SIGNING_PWD
45+
run: ./gradlew publishSonatypePublicationToNexusSnapshotsRepository -PsonatypeUsername=$NEXUS_UNAME -PsonatypePassword=$NEXUS_PWD -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/secring.gpg -Psigning.keyId=$SIGNING_KEYID -Psigning.password=$SIGNING_PWD
4646

4747
- name: Gradle Upload Archives to Releases Repository
4848
if: ${{ inputs.release }}
49-
run: gradle uploadArchives -Prelease -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/secring.gpg -PnexusUsername=$NEXUS_UNAME -PnexusPassword=$NEXUS_PWD -Psigning.keyId=$SIGNING_KEYID -Psigning.password=$SIGNING_PWD
50-
51-
- name: Gradle Publish Release to Nexus
52-
if: ${{ inputs.release }}
53-
run: ./gradlew closeAndReleaseRepository -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/secring.gpg -PnexusUsername=$NEXUS_UNAME -PnexusPassword=$NEXUS_PWD -Psigning.keyId=$SIGNING_KEYID -Psigning.password=$SIGNING_PWD
49+
run: ./gradlew publishSonatypePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository -Prelease -PsonatypeUsername=$NEXUS_UNAME -PsonatypePassword=$NEXUS_PWD -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/secring.gpg -Psigning.keyId=$SIGNING_KEYID -Psigning.password=$SIGNING_PWD

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea/
2+
3+
build/
4+
reports/
5+
.gradle/
6+
7+
secring.gpg
8+
gradle.properties

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM gradle:6-jdk8-openj9 AS gradle-build
1+
FROM gradle:7.3.0-jdk17-alpine AS gradle-build
22
COPY --chown=gradle:gradle . /home/gradle/src
33
WORKDIR /home/gradle/src
4-
RUN gradle bootJar
4+
RUN gradle bootJar -PsonatypeUsername=${NEXUS_UNAME} -PsonatypePassword=${NEXUS_PWD}
55

6-
FROM amazoncorretto:8-alpine-jdk AS build-image
6+
FROM amazoncorretto:17.0.0-alpine AS build-image
77
EXPOSE 8443
88
RUN apk add --no-cache bash
99
COPY --from=gradle-build /home/gradle/src/build/libs/osis-scality-*.jar /app/lib/app.jar

build.gradle

Lines changed: 66 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,110 @@
11
buildscript {
22
ext {
3-
springBootVersion = '2.2.5.RELEASE'
4-
}
5-
repositories {
6-
mavenCentral()
7-
maven {
8-
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
9-
}
10-
}
11-
dependencies {
12-
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
13-
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
14-
classpath 'org.owasp:dependency-check-gradle:7.1.1'
15-
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.1"
3+
osisVersion = '2.0.0'
4+
vaultclientVersion = '1.0.0-SNAPSHOT'
5+
springBootVersion = '2.7.5'
166
}
177
}
188

199
plugins {
2010
id 'java'
21-
id 'maven-publish'
11+
id 'java-library'
2212
id 'pmd'
23-
id "com.github.spotbugs" version "4.6.0"
24-
id 'com.github.ksoichiro.console.reporter' version '0.6.2'
25-
id 'io.codearte.nexus-staging' version '0.21.1'
13+
id 'org.springframework.boot' version "${springBootVersion}"
14+
id 'io.spring.dependency-management' version '1.1.0'
15+
id 'com.github.spotbugs' version '5.0.12'
16+
id 'com.github.ksoichiro.console.reporter' version '0.6.3' // jacoco report (code coverage)
17+
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' // gradle nexus publish-plugin
18+
id 'org.owasp.dependencycheck' version '7.1.1'
2619
}
2720

28-
group = 'com.scality'
29-
description = 'osis.scality'
30-
sourceCompatibility = '1.8'
21+
dependencies {
22+
implementation project('osis-app')
23+
}
3124

25+
bootJar {
26+
mainClass = 'com.scality.osis.Application'
27+
}
3228

33-
dependencies {
34-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
35-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
36-
compile project('osis-app')
29+
jar {
30+
classifier = ''
31+
}
32+
33+
// to upload the bootJar instead of jar
34+
configurations {
35+
[apiElements, runtimeElements].each {
36+
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
37+
it.outgoing.artifact(bootJar)
38+
}
3739
}
3840

3941
allprojects {
40-
apply plugin: 'java'
42+
group = 'com.scality'
43+
sourceCompatibility = JavaVersion.VERSION_17
44+
45+
apply plugin: 'java-library'
4146
apply plugin: 'maven-publish'
47+
apply plugin: 'signing'
4248
apply plugin: 'org.owasp.dependencycheck'
4349

4450
apply from: "$rootDir/spotbugs.gradle"
4551
apply from: "$rootDir/pmd.gradle"
4652
apply from: "$rootDir/jacoco.gradle"
4753
apply from: "$rootDir/upload-artifact.gradle"
4854

55+
dependencies {
56+
// vaultclient
57+
implementation "com.scality:vaultclient:$vaultclientVersion"
58+
59+
// Spring boot
60+
implementation "org.springframework.boot:spring-boot-starter-webflux:$springBootVersion"
61+
implementation "org.springframework.boot:spring-boot-starter-hateoas:$springBootVersion"
62+
implementation "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
63+
implementation "org.springframework.boot:spring-boot-starter-security:$springBootVersion"
64+
implementation "org.springframework.boot:spring-boot-starter-data-redis:$springBootVersion"
65+
implementation "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
66+
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
67+
68+
implementation 'io.springfox:springfox-swagger2:3.0.0'
69+
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
70+
implementation 'javax.validation:validation-api:2.0.1.Final'
71+
implementation 'org.apache.commons:commons-lang3:3.12.0'
72+
implementation 'io.jsonwebtoken:jjwt:0.9.1'
73+
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.328'
74+
implementation 'com.amazonaws:aws-java-sdk-sts:1.12.328'
75+
implementation 'com.amazonaws:aws-java-sdk-iam:1.12.328'
76+
}
4977

5078
repositories {
5179
mavenLocal()
5280
mavenCentral()
53-
jcenter()
54-
maven {
55-
url = 'https://repo.maven.apache.org/maven2'
56-
}
5781
maven {
5882
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
5983
}
6084
}
61-
}
62-
63-
repositories {
64-
mavenCentral()
65-
}
66-
67-
apply plugin: 'org.springframework.boot'
68-
apply plugin: 'io.spring.dependency-management'
69-
apply plugin: 'java'
70-
apply plugin: 'idea'
71-
72-
bootJar {
73-
mainClassName = 'com.scality.osis.Application'
74-
enabled = true
75-
}
76-
77-
jar {
78-
manifest {
79-
attributes 'Main-Class': 'com.scality.osis.Application'
80-
}
81-
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
82-
}
83-
84-
subprojects {
85-
apply plugin: 'io.spring.dependency-management'
86-
apply plugin: 'java'
87-
apply plugin: 'idea'
88-
89-
sourceCompatibility = 1.8
90-
targetCompatibility = 1.8
9185

92-
tasks.withType(Javadoc).all { enabled = false }
93-
}
94-
95-
sourceSets {
96-
main {
97-
resources {
98-
srcDirs = ["$projectDir/src/main/resources"]
86+
configurations {
87+
version = "${osisVersion}"
88+
if (!project.hasProperty('release')) {
89+
project.setVersion(project.getVersion() + '-SNAPSHOT')
9990
}
10091
}
101-
}
10292

103-
configure(allprojects) {
104-
version = '1.5.0'
105-
if (!project.hasProperty('release')) {
106-
project.setVersion(project.getVersion() + '-SNAPSHOT')
93+
test {
94+
useJUnitPlatform()
10795
}
10896

109-
ext {
110-
springBootVersion = '2.2.5.RELEASE'
97+
tasks.withType(JavaCompile) {
98+
options.encoding = 'UTF-8'
11199
}
112-
dependencies {
113-
compile "org.springframework.boot:spring-boot-starter-webflux:$springBootVersion"
114-
compile "org.springframework.boot:spring-boot-starter-hateoas:$springBootVersion"
115-
compile "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
116-
compile "org.springframework.boot:spring-boot-starter-security:$springBootVersion"
117-
compile "org.springframework.boot:spring-boot-starter-data-redis:$springBootVersion"
118-
compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
119-
testImplementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion") {
120-
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
121-
}
122-
compile 'io.springfox:springfox-swagger2:2.8.0'
123-
compile 'io.springfox:springfox-swagger-ui:2.8.0'
124-
compile 'javax.xml.bind:jaxb-api:2.2.11'
125-
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.5'
126-
compile 'org.openapitools:jackson-databind-nullable:0.1.0'
127-
compile 'javax.validation:validation-api:2.0.1.Final'
128-
compile 'org.hsqldb:hsqldb:2.3.2'
129-
compile 'org.postgresql:postgresql:42.2.25'
130-
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.11.0'
131-
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.11.0'
132-
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
133-
compile 'io.jsonwebtoken:jjwt:0.9.1'
134-
implementation 'org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE'
135-
implementation 'com.scality:vaultclient:0.5.0'
136-
implementation 'com.amazonaws:aws-java-sdk-s3:1.11.914'
137-
implementation 'com.amazonaws:aws-java-sdk-sts:1.11.914'
138-
implementation 'com.amazonaws:aws-java-sdk-iam:1.11.914'
139-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
140-
}
141-
}
142-
143-
tasks.withType(JavaCompile) {
144-
options.encoding = 'UTF-8'
145-
}
146-
147-
test {
148-
useJUnitPlatform()
149100
}
150101

151-
jar {
152-
enabled = true
153-
}
154-
155-
tasks.withType(JavaCompile) {
156-
options.encoding = 'UTF-8'
157-
}
158-
159-
publishing {
160-
publications {
161-
mavenJava(MavenPublication) {
162-
groupId 'com.scality'
163-
artifactId 'osis'
164-
165-
from components.java
166-
167-
}
168-
}
169-
102+
// task used by the gradle nexus publish-plugin
103+
nexusPublishing {
170104
repositories {
171-
mavenLocal()
172-
mavenCentral()
173-
jcenter()
174-
maven {
175-
url = 'https://repo.maven.apache.org/maven2'
176-
}
177-
maven {
178-
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
105+
sonatype {
106+
username = sonatypeUsername
107+
password = sonatypePassword
179108
}
180109
}
181110
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

jacoco.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: "jacoco"
22
jacoco {
3-
toolVersion = "0.8.5"
3+
toolVersion = "0.8.8"
44
}
55

66
test {

osis-app/build.gradle

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
dependencies {
2-
compile project(':osis-core')
3-
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.11.0'
4-
compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.11.0'
5-
compile 'io.springfox:springfox-swagger2:2.8.0'
6-
compile 'io.springfox:springfox-swagger-ui:2.8.0'
7-
compile 'javax.xml.bind:jaxb-api:2.2.11'
8-
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.5'
9-
compile 'org.openapitools:jackson-databind-nullable:0.1.0'
2+
implementation project(':osis-core')
103
}
11-
jar.enabled(true)
12-
group = 'com.scality'
4+

osis-app/src/main/java/com/scality/osis/resource/ScalityOsisController.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,11 @@ public OsisUser createUser(
122122
* Operation ID: deleteCredential<br> Delete the S3 credential of the
123123
* platform user. Parameters tenant_id and tenant_id are always in request; the
124124
* platform decides whehter to use them.
125-
*
125+
* Returned HTTP status codes : the S3 credential is deleted (status code 204) or The optional API is not implemented (status code 501)
126126
* @param tenantId The ID of the tenant which the user belongs to (required)
127127
* @param userId The ID of the user which the deleted S3 credential belongs
128128
* to (required)
129129
* @param accessKey The access key of the S3 credential to delete (required)
130-
* @return The S3 credential is deleted (status code 204)
131-
* or The optional API is not implemented (status code 501)
132130
*/
133131
@ApiOperation(value = "Delete the S3 credential of the platform user", nickname = "deleteCredential", notes = "Operation ID: deleteCredential<br> Delete the S3 credential of the platform user. Parameters tenant_id and tenant_id are always in request; the platform decides whehter to use them. ", authorizations = {
134132
@Authorization(value = "basicAuth")
@@ -149,12 +147,9 @@ public void deleteCredential(
149147
/**
150148
* DELETE /api/v1/tenants/{tenantId} : Delete a tenant in the platform
151149
* Operation ID: deleteTenant&lt;br&gt; Delete a tenant in the platform
152-
*
150+
* Returned HTTP status codes : The tenant is deleted (status code 204) or The optional API is not implemented (status code 501)
153151
* @param tenantId Tenant ID of the tenant to delete (required)
154-
* @param purgeData Purge data when the tenant is deleted (optional, default to
155-
* false)
156-
* @return The tenant is deleted (status code 204)
157-
* or The optional API is not implemented (status code 501)
152+
* @param purgeData Purge data when the tenant is deleted (optional, default to false)
158153
*/
159154
@ApiOperation(value = "Delete a tenant in the platform", nickname = "deleteTenant", notes = "Operation ID: deleteTenant<br> Delete a tenant in the platform ", authorizations = {
160155
@Authorization(value = "basicAuth")
@@ -177,13 +172,12 @@ public void deleteTenant(
177172
* DELETE /api/v1/tenants/{tenantId}/users/{userId} : Delete the user in the
178173
* platform tenant
179174
* Operation ID: deleteUser&lt;br&gt; Delete the user in the platform tenant
180-
*
175+
* Returned HTTP status codes : The user is deleted (status code 204)
181176
* @param tenantId The ID of the tenant which the deleted user belongs to
182177
* (required)
183178
* @param userId The ID of the user to delete (required)
184179
* @param purgeData Purge data when the user is deleted (optional, default to
185180
* false)
186-
* @return The user is deleted (status code 204)
187181
*/
188182
@ApiOperation(value = "Delete the user in the platform tenant", nickname = "deleteUser", notes = "Operation ID: deleteUser<br> Delete the user in the platform tenant ", authorizations = {
189183
@Authorization(value = "basicAuth")

osis-core/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
dependencies {
2-
compile project(':storage-platform-clients')
2+
api project(':storage-platform-clients')
33
}
4-
test {
5-
useJUnitPlatform()
6-
}
7-
group = 'com.scality'
4+
5+
6+

0 commit comments

Comments
 (0)