Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add storage.beforeRepoCreate Plugin Execution Points #402

Closed
domruf opened this issue Dec 8, 2021 · 1 comment
Closed

add storage.beforeRepoCreate Plugin Execution Points #402

domruf opened this issue Dec 8, 2021 · 1 comment

Comments

@domruf
Copy link

domruf commented Dec 8, 2021

There is already a storage.beforeCreate Plugin Execution Points that lets you implement plugins that react before artifacts are created in a repository. What we need is a plugin that reacts before a repository itself is created.

More concretely we want to restrict the names used for repositories. The idea would be something like this

import org.artifactory.exception.CancelException

storage {
    beforeRepoCreate { item ->
        def pattern = "(([^\\-]+)-)+(alpine|cargo|chef|cocoa|conan|conda|cran|debian|docker|gems|generic|gitlfs|go|helm|ivy|maven|npm|nuget|opkg|php|puppet|pypi|rpm|sbt|vagrant|bower)(-(prod|qa|dev))?-(local|remote)"
        def repoConf = repositories.getRepositoryConfiguration(item.repoPath.repoKey)
        if (!(item.repoPath.repoKey ==~ pattern)){
            def message = "Repo name: " + item.repoPath.repoKey + ". "
            message += "The repository name must end with -<type>-<remote|local> or -<type>-<prod|qa|dev>-<local|remote>"
            def status = 400
            throw new CancelException(message, status) {
                public Throwable fillInStackTrace() {
                    return null;
                }
            }
        }
    }
}
@fluxxBot
Copy link
Contributor

We appreciate you sending in your feature request. We value every user comment. We are closing this request for the time being, though, because it has been pending for a while and a number of plugins have been deprecated in the most recent releases. Please revisit it or submit a new request with the most recent information if you have any changes or believe that this feature is still necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants