Trying to implement this structure to restrict any artifact being uploaded
should have a maven layout. The code below works fine with "Artifactory Pro
Power Pack 3.1.0"
beforeCreate { item ->
if (!item.isFolder()){
// Get the layout information of the item
def layoutInfo =
repositories.getLayoutInfo(item.repoPath)
String groupId = layoutInfo.getOrganization()
String artifactId = layoutInfo.getModule()
String versionId = layoutInfo.getBaseRevision()
// If the item doesn't contain the Maven Layout
structure, reject the upload
if ( "${groupId}" == "null" || "${artifactId}" ==
"null" || "${versionId}" == "null" ){
throw new CancelException("Artifact create
not permitted without Maven Layout", 403)
}
}
}
If a directory/path gets created before it gets to the file, plugin checks
for the path created and discards the path.
However, with "Artifactory Pro Power Pack 3.4.2" it discards only the file,
and, leaves the directory/path trace in the repository. Which is an
unexpected behavior. Any other way to implement this?
Logs from 3.1.0:
2015-02-13 11:00:29,193 [http-bio-8081-exec-8] [INFO ]
(o.a.e.UploadServiceImpl:478) - Deploy to 'repo1:TestDir5/artifact.txt'
Content-Length: 62
2015-02-13 11:00:29,203 [http-bio-8081-exec-8] [ERROR]
(o.a.r.i.s.StorageInterceptorsImpl:50) - Before create rejected: Artifact
create not permitted without Maven Layout: Artifact create not permitted
without Maven Layout
2015-02-13 11:00:29,204 [http-bio-8081-exec-8] [WARN ]
(o.a.e.UploadServiceImpl:239) - Sending HTTP error code 403:
org.artifactory.exception.CancelException: Artifact create not permitted
without Maven Layout.
2015-02-13 11:00:29,205 [http-bio-8081-exec-8] [WARN ]
(o.a.s.f.l.SessionLockEntry:112) - Mutable item 'repo1:TestDir5' has local
modifications that will be discarded.
2015-02-13 11:00:29,205 [http-bio-8081-exec-8] [WARN ]
(o.a.w.w.p.d.s.DeployArtifactPanel:517) - Failed to deploy artifact: Cannot
deploy file 'artifact.txt'. org.artifactory.exception.CancelException:
Artifact create not permitted without Maven Layout.
Logs from 3.4.2:
2015-02-13 10:59:25,366 [http-bio-8081-exec-7] [INFO ]
(o.a.e.UploadServiceImpl:479) - Deploy to 'repo1:TestDir2/artifact.txt'
Content-Length: 62
2015-02-13 10:59:25,378 [http-bio-8081-exec-7] [ERROR]
(o.a.r.i.s.StorageInterceptorsImpl:50) - Before create rejected: Artifact
create not permitted without Maven Layout: Artifact create not permitted
without Maven Layout
2015-02-13 10:59:25,379 [http-bio-8081-exec-7] [WARN ]
(o.a.e.UploadServiceImpl:234) - Sending HTTP error code 403:
org.artifactory.exception.CancelException: Artifact create not permitted
without Maven Layout.
2015-02-13 10:59:25,379 [http-bio-8081-exec-7] [WARN ]
(o.a.w.w.p.d.s.DeployArtifactPanel:532) - Failed to deploy artifact: Cannot
deploy file 'artifact.txt'. org.artifactory.exception.CancelException:
Artifact create not permitted without Maven Layout.
The newer version is not discarding the modifications when interrupted by
the CancelException.
--
View this message in context:
http://forums.jfrog.org/Restrict-artifact-upload-if-not-Maven-Layout-not-selected-tp7580194.html
Sent from the Artifactory - Users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users