File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed
download/ExpireFileInRepos Expand file tree Collapse file tree 3 files changed +11
-4
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ Artifactory expireFileInRemoteRepos User Plugin
22====================================================
33
44An implementation of the beforeDownloadRequest execution point. This
5- plugin causes artifacts (including binaries) to expire and be re-cached when downloaded from a remote
5+ plugin causes artifacts (including binaries) to expire and be re-cached when downloaded from a remote/virtual
66repository.
77
88## Features
99
10- To use the plugin, modify the script by adding the names of the remote repositories you wish to expire files in.
11- The names are to be added to the list 'reposToExpire'
10+ To use the plugin, modify the script by adding the names of the repositories you wish to expire artifacts in.
11+ The names are to be added to the list 'reposToExpire'.
12+ Note: using this plugin, when downloading artifacts from virtual repositories - artifacts are expired and served from
13+ the source repo for all underlying repos
1214
1315## Installation
1416
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ final List<String> reposToExpire = List.of(/*TODO: add repo names*/)
2121
2222download {
2323 beforeDownloadRequest { Request request , RepoPath repoPath ->
24- if (reposToExpire. contains(repoPath. repoKey) && isRemote(repoPath. repoKey)) {
24+ if ((isRemote(repoPath. repoKey) || isVirtual(repoPath. repoKey))
25+ && reposToExpire. contains(repoPath. repoKey)) {
2526 log. debug ' Repository ${repoPath.repoKey} is marked for file expiration. Expiring file: ${repoPath.name}'
2627 expired = true
2728 }
@@ -30,4 +31,8 @@ download {
3031
3132def isRemote (String repoKey ) {
3233 return repositories. getRemoteRepositories(). contains(repoKey)
34+ }
35+
36+ def isVirtual (String repoKey ) {
37+ return repositories. getVirtualRepositories(). contains(repoKey)
3338}
You can’t perform that action at this time.
0 commit comments