Skip to content

Commit

Permalink
Merge pull request #125 from snyk/feat/switch-first-lifecycle-hook-to…
Browse files Browse the repository at this point in the history
…-afterCreate

feat: switch first lifecycle hook to afterCreate
  • Loading branch information
jacek-rzrz authored Nov 26, 2024
2 parents 849dbe1 + 4eb1a7d commit fd14b8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ executions {

download {

afterRemoteDownload { Request request, RepoPath repoPath ->
try {
snykPlugin.handleAfterRemoteDownloadEvent(repoPath)
} catch (Exception e) {
log.error("An exception occurred during afterRemoteDownload, re-throwing it for Artifactory to handle. Message was: ${e.message}")
throw e
}
}

beforeDownload { Request request, RepoPath repoPath ->
try {
snykPlugin.handleBeforeDownloadEvent(repoPath)
Expand All @@ -47,6 +38,16 @@ download {
}

storage {

afterCreate { ItemInfo itemInfo ->
try {
snykPlugin.handleAfterCreate(itemInfo.repoPath)
} catch (Exception e) {
log.error("An exception occurred during afterCreate, re-throwing it for Artifactory to handle. Message was: ${e.message}")
throw e
}
}

afterPropertyCreate { ItemInfo itemInfo, String propertyName, String[] propertyValues ->
try {
snykPlugin.handleAfterPropertyCreateEvent(security.currentUser(), itemInfo, propertyName, propertyValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public void handleAfterPropertyCreateEvent(User user, ItemInfo itemInfo, String
* Invoked once when an artifact is first fetched from an external repository.
* Runs Snyk test and persists the result in properties.
* <p>
* Extension point: {@code download.afterRemoteDownload}.
* Extension point: {@code storage.afterCreate}.
*/
public void handleAfterRemoteDownloadEvent(RepoPath repoPath) {
LOG.debug("Handle 'afterRemoteDownload' event for: {}", repoPath);
public void handleAfterCreate(RepoPath repoPath) {
LOG.debug("Handle 'afterCreate' event for: {}", repoPath);

try {
scannerModule.testArtifact(repoPath);
Expand Down

0 comments on commit fd14b8f

Please sign in to comment.