Skip to content

Commit

Permalink
JBS-38 Remove sbom/cyclonedx
Browse files Browse the repository at this point in the history
  • Loading branch information
rnc committed Oct 25, 2024
1 parent 675aa5e commit e4bfb52
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 251 deletions.
5 changes: 1 addition & 4 deletions java-components/build-request-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-core</artifactId>
</dependency>
<dependency>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-core-java</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-tree</artifactId>
Expand All @@ -71,6 +67,7 @@
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-tooling-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.indexer</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -11,18 +10,11 @@
import java.util.Map;
import java.util.Set;

import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;

import org.cyclonedx.CycloneDxSchema;
import org.cyclonedx.generators.BomGeneratorFactory;
import org.cyclonedx.generators.json.BomJsonGenerator;
import org.cyclonedx.model.Bom;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.redhat.hacbs.classfile.tracker.ClassFileTracker;
import com.redhat.hacbs.classfile.tracker.TrackingData;
import com.redhat.hacbs.container.results.ResultsUpdater;

import io.quarkus.logging.Log;
import picocli.CommandLine;
Expand All @@ -40,9 +32,6 @@ public abstract class AnalyserBase implements Runnable {
@Inject
RebuildService rebuild;

@CommandLine.Option(names = "-s")
Path sbom;

@CommandLine.Option(names = "-c")
Path dependenciesCount;

Expand All @@ -52,9 +41,6 @@ public abstract class AnalyserBase implements Runnable {
@CommandLine.Option(names = "--publishers")
Path publishers;

@Inject
Instance<ResultsUpdater> resultsUpdater;

protected String imageDigest = "";

@Override
Expand All @@ -65,36 +51,13 @@ public void run() {
doAnalysis(gavs, trackingData);
rebuild.rebuild(taskRunName, gavs);
writeResults(gavs, trackingData);
writeSbom(trackingData);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

abstract void doAnalysis(Set<String> gavs, Set<TrackingData> trackingData) throws Exception;

void writeSbom(Set<TrackingData> trackingData) throws IOException {
Bom bom;
InputStream existing = null;
try {
if (Files.exists(sbom)) {
existing = Files.newInputStream(sbom);
}
bom = SBomGenerator.generateSBom(trackingData, existing);
} finally {
if (existing != null) {
existing.close();
}
}

BomJsonGenerator generator = BomGeneratorFactory.createJson(CycloneDxSchema.VERSION_LATEST, bom);
String sbom = generator.toJsonString();
Log.infof("Generated SBOM:\n%s", sbom);
if (this.sbom != null) {
Files.writeString(this.sbom, sbom, StandardCharsets.UTF_8);
}
}

void writeResults(Set<String> gavs, Set<TrackingData> trackingData) throws IOException {
if (dependenciesCount != null) {
Files.writeString(dependenciesCount, trackingData.size() + "");
Expand Down

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions java-components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<!-- Dependencies -->
<asm.version>9.7.1</asm.version>
<assertj.version>3.26.3</assertj.version>
<cyclonedx-core-java.version>9.0.4</cyclonedx-core-java.version>
<gradle-tooling-api.version>8.10.2</gradle-tooling-api.version>
<maven-indexer.version>7.1.5</maven-indexer.version>
<maven-resolver.version>1.9.22</maven-resolver.version>
Expand Down Expand Up @@ -185,11 +184,6 @@
<version>0.0.4</version>
</dependency>

<dependency>
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-core-java</artifactId>
<version>${cyclonedx-core-java.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
<artifactId>maven-release-manager</artifactId>
Expand Down

0 comments on commit e4bfb52

Please sign in to comment.