-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically Fetching Trivy Binary (#41)
feat: adds the ability to choose the version of Trivy and download and configure the binary during the runtime of the plugin
- Loading branch information
1 parent
c15b953
commit 4f29650
Showing
15 changed files
with
287 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM eclipse-temurin:19.0.2_7-jre-ubi9-minimal | ||
FROM eclipse-temurin:8u402-b06-jre-alpine | ||
|
||
ADD target/*.jar /opt/app.jar | ||
CMD ["java", "-jar", "/opt/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package br.com.orla.api; | ||
|
||
import com.alibaba.fastjson.annotation.JSONField; | ||
|
||
public class Assets { | ||
|
||
private String name; | ||
|
||
@JSONField(alternateNames = "browser_download_url") | ||
private String browserDownloadUrl; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getBrowserDownloadUrl() { | ||
return browserDownloadUrl; | ||
} | ||
|
||
public void setBrowserDownloadUrl(String browserDownloadUrl) { | ||
this.browserDownloadUrl = browserDownloadUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package br.com.orla.api; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.http.HttpClient; | ||
import java.net.http.HttpRequest; | ||
import java.net.http.HttpResponse; | ||
import java.time.Duration; | ||
|
||
public class GithubTrivyRelease implements GithubTrivyReleaseApi { | ||
|
||
@Override | ||
public Release releaseByTag(String tag) { | ||
try { | ||
var httpClient = HttpClient.newHttpClient(); | ||
var request = HttpRequest.newBuilder() | ||
.timeout(Duration.ofSeconds(10)) | ||
.uri(URI.create("https://api.github.com/repos/aquasecurity/trivy/releases/tags/".concat(tag))) | ||
.build(); | ||
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); | ||
return JSON.parseObject(response.body(), Release.class); | ||
} catch (IOException | InterruptedException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.com.orla.api; | ||
|
||
public interface GithubTrivyReleaseApi { | ||
|
||
Release releaseByTag(String tag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package br.com.orla.api; | ||
|
||
import java.util.List; | ||
|
||
public class Release { | ||
|
||
private List<Assets> assets; | ||
|
||
public List<Assets> getAssets() { | ||
return assets; | ||
} | ||
|
||
public void setAssets(List<Assets> assets) { | ||
this.assets = assets; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.