Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions storage/remoteBackup/remoteBackup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,30 @@ storage {
}
}
}

afterPropertyCreate { item, name, values ->
def etcdir = ctx.artifactoryHome.etcDir
def cfgfile = new File(etcdir, REMOTE_BACKUP)

// Ensure invalid or missing JSON config does not prevent Artifactory
// from serving and receiving artifacts.
//
cfg = parseJson(cfgfile)
if (!cfg) return

if (item.repoKey in cfg && !item.isFolder() && name != "artifactory.internal.etag") {
asSystem {
def dest = cfg[item.repoKey]
try {
// Set property in archive repo
def destpath = RepoPathFactory.create(dest, item.relPath)
repositories.setProperty(destpath, name, values)
} catch (Exception ex) {
log.warn("Unable to set property $name for $destpath: $ex.message")
}
}
}
}
}

def runBackup(repos) {
Expand Down