Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #89 from dcanar9/master
Browse files Browse the repository at this point in the history
src and pom update
  • Loading branch information
aswink19 authored Nov 30, 2022
2 parents 4ab95b0 + 208515b commit 1367e32
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven-pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Build with Maven
run: mvn test --file pom.xml
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: java
jdk:
- openjdk8
- openjdk11
services:
- docker

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Hygieia Artifact Collector for Jfrog Artifactory
src## Hygieia Artifact Collector for Jfrog Artifactory

[![Build Status](https://travis-ci.com/Hygieia/hygieia-artifact-artifactory-collector.svg?branch=master)](https://travis-ci.com/Hygieia/hygieia-artifact-artifactory-collector)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Hygieia_hygieia-artifact-artifactory-collector&metric=alert_status)](https://sonarcloud.io/dashboard?id=Hygieia_hygieia-artifact-artifactory-collector)
Expand Down
140 changes: 106 additions & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
<packaging>jar</packaging>
<artifactId>artifactory-artifact-collector</artifactId>
<url>https://github.com/Hygieia/${repository.name}</url>
<version>3.2.6-SNAPSHOT</version>
<version>3.2.7-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.22.RELEASE</version>
<version>2.7.0</version>
</parent>

<organization>
<name>Hygieia</name>
<url>https://www.github.com/Hygieia/</url>
<url>https://www.github.com/hygieia/</url>
</organization>

<scm>
Expand Down Expand Up @@ -48,43 +48,43 @@

<properties>
<!-- Dependencies -->
<com.capitalone.dashboard.core.version>3.15.26</com.capitalone.dashboard.core.version>
<spring-security.version>4.2.18.RELEASE</spring-security.version>
<tomcat.version>8.5.57</tomcat.version>
<com.capitalone.dashboard.core.version>4.0.1</com.capitalone.dashboard.core.version>
<spring-security.version>5.6.6</spring-security.version>
<commons-beanutils.version>1.9.4</commons-beanutils.version>
<commons-codec.version>1.14</commons-codec.version>
<commons-collections4.version>4.1</commons-collections4.version>
<commons-io.version>2.4</commons-io.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang.version>3.10</commons-lang.version>
<fongo.version>2.2.0-RC2</fongo.version>
<guava.version>29.0-jre</guava.version>
<hibernate-validator.version>5.4.2.Final</hibernate-validator.version>
<hibernate-validator.version>7.0.0.Final</hibernate-validator.version>
<jackson.version>2.10.3</jackson.version>
<jasypt.version>1.18</jasypt.version>
<logback.version>1.2.3</logback.version>
<mongodb.version>3.6.4</mongodb.version>
<mongodb.version>4.0.6</mongodb.version>
<assertj.version>3.9.0</assertj.version>

<!-- Plugins -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<repository.name>hygieia-artifact-artifactory-collector</repository.name>
<sonar.skip>true</sonar.skip>
<java.version>11</java.version>
<repository.name>artifactory-collector-ace</repository.name>
<apache.rat.plugin.version>0.13</apache.rat.plugin.version>
<coveralls.maven.plugin.version>4.3.0</coveralls.maven.plugin.version>
<developmentTeam>The Hygieia Team</developmentTeam>
<jacoco.maven.plugin.version>0.8.3</jacoco.maven.plugin.version>
<jacoco.coverage.percentage.minimum>0.010</jacoco.coverage.percentage.minimum><!-- will fix in future-->
<jacoco.classes.missed.minimum>15</jacoco.classes.missed.minimum>
<jacoco.coverage.percentage.minimum>0.000</jacoco.coverage.percentage.minimum><!-- will fix in future-->
<jacoco.classes.missed.minimum>3000</jacoco.classes.missed.minimum>
<japicmp.breakBuildOnBinaryIncompatibleModifications>true</japicmp.breakBuildOnBinaryIncompatibleModifications>
<japicmp.breakBuildOnSourceIncompatibleModifications>true</japicmp.breakBuildOnSourceIncompatibleModifications>
<japicmp.skip>false</japicmp.skip>
<java.compilation.source>1.8</java.compilation.source>
<java.compilation.target>1.8</java.compilation.target>
<java.compilation.source>11</java.compilation.source>
<java.compilation.target>11</java.compilation.target>
<maven.changes.plugin.version>2.12.1</maven.changes.plugin.version>
<maven.checkstyle.plugin.version>3.0.0</maven.checkstyle.plugin.version>
<maven.compiler.plugin.version>3.1</maven.compiler.plugin.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.javadoc.plugin.version>3.1.0</maven.javadoc.plugin.version>
<maven.pmd.plugin.version>3.11.0</maven.pmd.plugin.version>
<maven.project-info.version>3.0.0</maven.project-info.version>
Expand All @@ -93,6 +93,7 @@
<site.publish.url>https://github.com/Hygieia/${project.artifactId}</site.publish.url>
<site.publish.checkout.directory>site-content</site.publish.checkout.directory>
<spotbugs.plugin.version>3.1.11</spotbugs.plugin.version>
<mockito.core.version>1.10.19</mockito.core.version>
</properties>

<issueManagement>
Expand All @@ -101,30 +102,15 @@
</issueManagement>

<developers>
<developer>
<name>Amit Mawkin</name>
</developer>
<developer>
<name>Tapabrata Topo Pal</name>
<email>[email protected]</email>
<organization>CapitalOne</organization>
<organizationUrl>http://www.capitalone.com</organizationUrl>
</developer>
<developer>
<name>Raghavendra Vema</name>
<email>[email protected]</email>
<organization>CapitalOne</organization>
<organizationUrl>http://www.capitalone.com</organizationUrl>
</developer>
<developer>
<name>Nireesh Thiruveedula</name>
<email>[email protected]</email>
<organization>CapitalOne</organization>
<organizationUrl>http://www.capitalone.com</organizationUrl>
</developer>
<developer>
<name>Stephen Hughes</name>
<email>stephen.hughes@capitalone.com</email>
<name>Aravindhan Murugan</name>
<email>aravindhan.murugan@capitalone.com</email>
<organization>CapitalOne</organization>
<organizationUrl>http://www.capitalone.com</organizationUrl>
</developer>
Expand All @@ -135,15 +121,72 @@
<groupId>com.capitalone.dashboard</groupId>
<artifactId>core</artifactId>
<version>${com.capitalone.dashboard.core.version}</version>
<classifier>embed</classifier>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.5.13</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.23.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.core.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.5.2</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.32</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -179,6 +222,17 @@
<target>${java.compilation.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-cipher</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down Expand Up @@ -279,6 +333,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.22.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.2</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
Expand Down Expand Up @@ -680,3 +751,4 @@
</profiles>

</project>

2 changes: 1 addition & 1 deletion src/main/java/com/capitalone/dashboard/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/**
* Application configuration and bootstrap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -258,7 +251,7 @@ private void updateExistingBinaryArtifact(BinaryArtifact newBinaryArtifact, Bina

private void attachLatestBuildInfo(ArtifactItem artifactItem, BinaryArtifact binaryArtifact) {
// get latest binary artifact associated with the artifact item by desc timestamp
BinaryArtifact latestWithBuildInfo = binaryArtifactRepository.findTopByCollectorItemIdAndBuildInfosIsNotEmptyOrderByTimestampDesc(artifactItem.getId(), new Sort(Sort.Direction.DESC, "timestamp"));
BinaryArtifact latestWithBuildInfo = binaryArtifactRepository.findTopByCollectorItemIdAndBuildInfosIsNotEmptyOrderByTimestampDesc(artifactItem.getId(), Sort.by(Sort.Direction.DESC, "timestamp"));
if (Objects.isNull(latestWithBuildInfo)) return;
binaryArtifact.setBuildInfos(latestWithBuildInfo.getBuildInfos());
}
Expand All @@ -280,12 +273,12 @@ private void refreshData(Map<ObjectId, Set<ObjectId>> artifactBuilds) {
Iterable<BinaryArtifact> binaryArtifacts = binaryArtifactRepository.findByCollectorItemId(artCollectorItemId);
List<Build> associatedBuilds = new ArrayList<>();
buildIdSet.forEach(buildId -> {
associatedBuilds.add(buildRepository.findOne(buildId));
associatedBuilds.add((Build) buildRepository.findAllById(Collections.singleton(buildId)));
});
binaryArtifacts.forEach(binaryArtifact -> {
if (associatedBuilds != null) {
binaryArtifact.addBuild(associatedBuilds.get(0));
binaryArtifactRepository.save(binaryArtifacts);
binaryArtifactRepository.saveAll(binaryArtifacts);
}
});

Expand Down Expand Up @@ -328,7 +321,7 @@ private void clean(ArtifactoryCollector collector, List<ArtifactoryRepo> existin
}
}
if (!CollectionUtils.isEmpty(stateChangeRepoList)) {
artifactoryRepoRepository.save(stateChangeRepoList);
artifactoryRepoRepository.saveAll(stateChangeRepoList);
}
}

Expand Down Expand Up @@ -377,7 +370,7 @@ private void addNewRepos(List<ArtifactoryRepo> repos, List<ArtifactoryRepo> exis
}
//save all in one shot
if (!CollectionUtils.isEmpty(newRepos)) {
artifactoryRepoRepository.save(newRepos);
artifactoryRepoRepository.saveAll(newRepos);
}
log("New repos", start, count);
}
Expand Down Expand Up @@ -405,7 +398,7 @@ private void addNewArtifacts(List<ArtifactoryRepo> enabledRepos) {
repo.setLastUpdated(start);
}
// We set the last update time so need to save it
artifactoryRepoRepository.save(enabledRepos);
artifactoryRepoRepository.saveAll(enabledRepos);
log("New artifacts", start, count.get());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ private void updateExistingBinaryArtifact(BinaryArtifact newBinaryArtifact, Bina

private void attachLatestBuildInfo(ArtifactItem artifactItem, BinaryArtifact binaryArtifact) {
// get latest binary artifact associated with the artifact item by desc timestamp
BinaryArtifact latestWithBuildInfo = binaryArtifactRepository.findTopByCollectorItemIdAndBuildInfosIsNotEmptyOrderByTimestampDesc(artifactItem.getId(), new Sort(Sort.Direction.DESC, "timestamp"));
BinaryArtifact latestWithBuildInfo = binaryArtifactRepository.findTopByCollectorItemIdAndBuildInfosIsNotEmptyOrderByTimestampDesc(artifactItem.getId(), Sort.by(Sort.Direction.DESC, "timestamp"));
if (Objects.isNull(latestWithBuildInfo)) return;
binaryArtifact.setBuildInfos(latestWithBuildInfo.getBuildInfos());
}
Expand Down Expand Up @@ -774,7 +774,7 @@ private List<BinaryArtifact> createArtifactForArtifactBased(String artifactCanon
for (BinaryArtifact ba: bas) {
setCollectorItemId(result, ba);
setBuilds(result, ba);
binaryArtifactRepository.delete(ba.getId());
binaryArtifactRepository.delete(ba);
}
}
result.setType(getString(jsonArtifact, "type"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

Expand Down Expand Up @@ -85,7 +86,7 @@ public ResponseEntity<String> refresh(@RequestBody ArtifactSyncRequest request)
}
dashboardCount = dashboardCount + ds.size();
for (Dashboard d : ds) {
Component component = componentRepository.findOne(d.getApplication().getComponents().get(0).getId());
Component component = (Component) componentRepository.findAllById(Collections.singleton(d.getApplication().getComponents().get(0).getId()));
List<CollectorItem> collectorItems = component.getCollectorItems().get(CollectorType.Artifact);
if(CollectionUtils.isEmpty(collectorItems)) {
dashboardNotConfiguredWithArtifactory.add(dashboard);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>logs/artifactcollector-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>logs/artifactory-collector-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
Expand Down
Loading

0 comments on commit 1367e32

Please sign in to comment.