Skip to content

Commit

Permalink
Merge develop to master (#919)
Browse files Browse the repository at this point in the history
* remove wrong indexer

Signed-off-by: andrei_varabyeu <[email protected]>

* add k8s configs

Signed-off-by: andrei_varabyeu <[email protected]>

* add k8s configs

Signed-off-by: andrei_varabyeu <[email protected]>

* add postman test example

Signed-off-by: andrei_varabyeu <[email protected]>

* EPMRPP-40125 || Plugin instance removing fix. Plugin-related jobs update (#911)

* Plugin instance removing fix. Plugin-related jobs update

* Plugins directories creation impl

* Plugins data store uploading fix

* Junit tests update

* update analyzer info contributor (#910)

* change error type on bid creation (#912)

* EPMRPP-40285 || Project level integration validation fix (#914)

* Project level integration validation fix

* Junit tests fix

* backward compatibility updates (#909)

* handle attributes without key on sending notification (#913)

* EPMRPP-40470 || Bts integrations validation update (#915)

* Bts integrations validation update

* Junit tests update

* cover few tests

* update deps

* Tests (#916)

* cover few tests

* update deps

* update release versions
  • Loading branch information
pbortnik authored and avarabyeu committed Aug 21, 2019
1 parent ad17ac3 commit ad611ee
Show file tree
Hide file tree
Showing 38 changed files with 502 additions and 181 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build/
#!build/libs/
out/
.gradle/
.gradle/
.idea
103 changes: 103 additions & 0 deletions Jenkinsfile.k8s.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!groovy

//String podTemplateConcat = "${serviceName}-${buildNumber}-${uuid}"
def label = "worker-${UUID.randomUUID().toString()}"
println("label")
println("${label}")

podTemplate(
label: "${label}",
containers: [
containerTemplate(name: 'jnlp', image: 'jenkins/jnlp-slave:alpine'),
containerTemplate(name: 'docker', image: 'docker:dind', ttyEnabled: true, alwaysPullImage: true, privileged: true,
command: 'dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --storage-driver=overlay',
resourceRequestCpu: '500m',
resourceLimitCpu: '800m',
resourceRequestMemory: '2048Mi',
resourceLimitMemory: '2048Mi'),
// containerTemplate(name: 'jdk', image: 'quay.io/reportportal/openjdk-8-alpine-nonroot', command: 'cat', ttyEnabled: true),
// containerTemplate(name: 'gradle', image: 'quay.io/reportportal/gradle-nonroot', command: 'cat', ttyEnabled: true),
// containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.8', command: 'cat', ttyEnabled: true),
containerTemplate(name: 'helm', image: 'lachlanevenson/k8s-helm:latest', command: 'cat', ttyEnabled: true)
],
imagePullSecrets: ["regcred"],
volumes: [
emptyDirVolume(memory: false, mountPath: '/var/lib/docker'),
secretVolume(mountPath: '/etc/.dockercreds', secretName: 'docker-creds'),
// hostPathVolume(mountPath: '/home/gradle/.gradle', hostPath: '/tmp/jenkins/gradle')
]
) {

node("${label}") {

properties([
pipelineTriggers([
pollSCM('H/10 * * * *')
])
])

stage('Configure') {
container('docker') {
sh 'echo "Initialize environment"'
sh """
QUAY_USER=\$(cat "/etc/.dockercreds/username")
cat "/etc/.dockercreds/password" | docker login -u \$QUAY_USER --password-stdin quay.io
"""
}
}
parallel 'Checkout Infra': {
stage('Checkout Infra') {
sh 'mkdir -p ~/.ssh'
sh 'ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts'
dir('kubernetes') {
git branch: "v5", url: 'https://github.com/reportportal/kubernetes.git'

}
}
}, 'Checkout Service': {
stage('Checkout Service') {
dir('app') {
checkout scm
}
}
}


// dir('app') {
// try {
// container('docker') {
// stage('Build App') {
// sh "gradle build --full-stacktrace"
// }
// }
// } finally {
// junit 'build/test-results/**/*.xml'
// dependencyCheckPublisher pattern: 'build/reports/dependency-check-report.xml'
//
// }
//
// }

stage('Build Docker Image') {
dir('app') {
container('docker') {
container('docker') {
version = """${
sh(
returnStdout: true,
script: 'cat gradle.properties | grep "version" | cut -d "=" -f2'
)
}""".trim()
image = "quay.io/reportportal/service-api:${version}-BUILD-${env.BUILD_NUMBER}"
sh "docker build -f docker/Dockerfile-develop -t $image ."
sh "docker push $image"
}

}
}


}
}
}

26 changes: 18 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {
id "com.jfrog.bintray" version "1.8.4"
id 'java'
id 'jacoco'
id "org.owasp.dependencycheck" version "5.0.0-M3.1"
id "org.owasp.dependencycheck" version "5.2.0"
id "org.ajoberstar.grgit" version "3.1.1"
}

Expand Down Expand Up @@ -90,17 +90,17 @@ configurations {

dependencies {
if (releaseMode) {
compile 'com.epam.reportportal:commons-dao:5.0.0-BETA-9'
compile 'com.epam.reportportal:commons-dao:5.0.0-BETA-10'
compile 'com.epam.reportportal:commons-rules:5.0.0-BETA-6'
compile 'com.epam.reportportal:commons-model:5.0.0-BETA-10'
compile 'com.epam.reportportal:commons-model:5.0.0-BETA-11'
compile 'com.epam.reportportal:commons:5.0.0-BETA-2'
compile('com.epam.reportportal:plugin-api:5.0.0-BETA-7')
} else {
compile 'com.epam.reportportal:commons-dao:5.0.0-BETA-9'
compile 'com.epam.reportportal:commons-rules:5.0.0-BETA-6'
compile 'com.epam.reportportal:commons-model:5.0.0-BETA-10'
compile('com.epam.reportportal:commons:5.0.0-BETA-2')
compile('com.epam.reportportal:plugin-api:5.0.0-BETA-7')
compile 'com.github.reportportal:commons-dao:5.0.0-BETA-10'
compile 'com.github.reportportal:commons-rules:5.0.0-BETA-6'
compile 'com.github.reportportal:commons-model:5.0.0-BETA-11'
compile('com.github.reportportal:commons:5.0.0-BETA-2')
compile('com.github.reportportal:plugin-api:5.0.0-BETA-7')
}

//saucelabs
Expand Down Expand Up @@ -224,6 +224,11 @@ task copyJacocoAgentToLibs(type: Copy) {
}
}

dependencyCheck {
formats = ['HTML', 'XML']
// cveValidForHours = 1
}

jar.dependsOn copyJacocoAgentToLibs
jar.dependsOn gitInfo
//End section for external jacoco test report
Expand Down Expand Up @@ -277,6 +282,11 @@ test {
exceptionFormat 'short'
}

// testLogging.showStandardStreams = true
reports {
junitXml.enabled = true
}

jacocoTestReport {
reports {
xml.enabled true
Expand Down
24 changes: 24 additions & 0 deletions docker/Dockerfile-dev-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM openjdk:8-jre

LABEL maintainer="Andrei Varabyeu <[email protected]>"
LABEL version="@version@"
LABEL description="@description@"

ENV APP_FILE @name@-@version@
ENV APP_DOWNLOAD_URL https://dl.bintray.com/epam/reportportal/com/epam/reportportal/@name@/@version@/$APP_FILE.jar
ENV JAVA_OPTS="-Xmx1g -Djava.security.egd=file:/dev/./urandom"
ENV JAVA_APP=/app.jar

RUN apt-get update && \
apt-get install -y fonts-noto && \
rm -rf /var/lib/apt/lists/*

RUN sh -c "echo '#!/bin/sh \n\
exec java $JAVA_OPTS -jar $JAVA_APP' > /start.sh && chmod +x /start.sh"

VOLUME /tmp

COPY build/libs/service-api.jar /app.jar

EXPOSE 8080
ENTRYPOINT ["/start.sh"]
32 changes: 22 additions & 10 deletions docker/Dockerfile-develop
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ RUN apk add --no-cache ca-certificates git curl font-noto
RUN addgroup -S -g 1000 rp-builder
RUN adduser -D -S -G rp-builder -u 1000 -s /bin/ash rp-builder

USER rp-builder
WORKDIR /home/rp-builder

COPY gradle/ ./gradle
COPY gradlew .
COPY build-quality.gradle build.gradle gradlew settings.gradle gradle.properties ./
COPY . ./

RUN chown -R rp-builder:rp-builder ./
USER rp-builder
### Copy gradle wrapper's stuff to init and cache gradle wrapper
COPY --chown=rp-builder gradle/ ./gradle/
COPY --chown=rp-builder gradlew* ./
RUN ./gradlew wrapper

### Copy gradle build files to resolve and cache dependencies
COPY --chown=rp-builder *.gradle gradle.properties ./
RUN ./gradlew resolveDependencies --stacktrace

### Copy source and run build
COPY --chown=rp-builder src/ ./src/
COPY --chown=rp-builder .git/ .git/
RUN ./gradlew build --full-stacktrace

RUN mkdir -p /home/rp-builder/plugins
Expand All @@ -24,9 +28,17 @@ RUN curl -o /home/rp-builder/plugins/RALLY.jar https://jitpack.io/com/github/rep

FROM openjdk:8-jre-slim

ARG version

### Set quay.io image cache. Since the build is for development only,
### there is no need to keep them forever
### details: https://support.coreos.com/hc/en-us/articles/115001384693-Tag-Expiration
LABEL quay.expires-after=1w

LABEL maintainer="Andrei Varabyeu <[email protected]>"
LABEL version="@version@"
LABEL description="@description@"
LABEL version=${version}
LABEL description="ReportPortal API Service: Development Version"


ENV JAVA_OPTS="-Xmx1g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djava.security.egd=file:/dev/./urandom -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
ENV JAVA_APP=/app.jar
Expand All @@ -50,4 +62,4 @@ RUN sh -c 'touch /app.jar'

EXPOSE 8080

ENTRYPOINT /start.sh
ENTRYPOINT /start.sh
7 changes: 7 additions & 0 deletions docker/DockerfileGradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM gradle:5.4.1-jdk8-alpine

USER root
RUN apk add --no-cache ca-certificates git curl font-noto

USER gradle

48 changes: 48 additions & 0 deletions postman/service-api.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"info": {
"_postman_id": "1c81a0f3-8beb-4317-8749-0d506c95eac8",
"name": "service-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "GET Info",
"event": [
{
"listen": "test",
"script": {
"id": "3e2613e1-567b-46da-a520-f54f5a7936f7",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Build Version is Present\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.build.version).to.not.eq(undefined);",
"});",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{rp_url}}/api/info",
"host": [
"{{rp_url}}"
],
"path": [
"api",
"info"
]
}
},
"response": []
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
import com.epam.ta.reportportal.plugin.Pf4jPluginManager;
import com.epam.ta.reportportal.plugin.ReportPortalExtensionFactory;
import com.google.common.collect.Sets;
import org.pf4j.ExtensionFactory;
import org.pf4j.ManifestPluginDescriptorFinder;
import org.pf4j.PluginDescriptorFinder;
import org.pf4j.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class PluginConfiguration {

Expand All @@ -50,7 +50,7 @@ public class PluginConfiguration {
private String pluginsTempPath;

@Bean
public Pf4jPluginBox pf4jPluginBox() {
public Pf4jPluginBox pf4jPluginBox() throws IOException {
Pf4jPluginManager manager = new Pf4jPluginManager(pluginsPath,
pluginsTempPath,
pluginLoader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected String startLaunch(ReportPortalUser.ProjectDetails projectDetails, Rep
startLaunchRQ.setStartTime(initialStartTime);
startLaunchRQ.setName(launchName);
startLaunchRQ.setMode(Mode.DEFAULT);
return startLaunchHandler.startLaunch(user, projectDetails, startLaunchRQ).getUuid();
return startLaunchHandler.startLaunch(user, projectDetails, startLaunchRQ).getId();
}

protected void finishLaunch(String launchId, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private void startRootItem(String name, String timestamp) {
startItemTime = LocalDateTime.now();
}
StartTestItemRQ rq = buildStartTestRq(name);
String id = startTestItemHandler.startRootItem(user, projectDetails, rq).getUuid();
String id = startTestItemHandler.startRootItem(user, projectDetails, rq).getId();
itemUuids.push(id);
}

Expand All @@ -207,7 +207,7 @@ private LocalDateTime parseTimeStamp(String timestamp) {

private void startTestItem(String name) {
StartTestItemRQ rq = buildStartTestRq(name);
String id = startTestItemHandler.startChildItem(user, projectDetails, rq, itemUuids.peek()).getUuid();
String id = startTestItemHandler.startChildItem(user, projectDetails, rq, itemUuids.peek()).getId();
itemUuids.push(id);
}

Expand All @@ -217,7 +217,7 @@ private void startStepItem(String name, String duration) {
rq.setStartTime(EntityUtils.TO_DATE.apply(startItemTime));
rq.setType(TestItemTypeEnum.STEP.name());
rq.setName(name);
String id = startTestItemHandler.startChildItem(user, projectDetails, rq, itemUuids.peek()).getUuid();
String id = startTestItemHandler.startChildItem(user, projectDetails, rq, itemUuids.peek()).getId();
currentDuration = toMillis(duration);
currentItemUuid = id;
itemUuids.push(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;

/**
* @author <a href="mailto:[email protected]">Ivan Budayeu</a>
Expand All @@ -51,8 +52,8 @@ public EntryCreatedRS uploadPlugin(MultipartFile pluginFile) {
BusinessRule.expect(newPluginFileName, StringUtils::isNotBlank)
.verify(ErrorType.BAD_REQUEST_ERROR, "File name should be not empty.");

try {
IntegrationType integrationType = pluginBox.uploadPlugin(newPluginFileName, pluginFile.getInputStream());
try (InputStream inputStream = pluginFile.getInputStream()) {
IntegrationType integrationType = pluginBox.uploadPlugin(newPluginFileName, inputStream);
return new EntryCreatedRS(integrationType.getId());
} catch (IOException e) {
throw new ReportPortalException(ErrorType.PLUGIN_UPLOAD_ERROR, "Error during file stream retrieving");
Expand Down
Loading

0 comments on commit ad611ee

Please sign in to comment.