Thanks Yoav,
I will try to use the method as suggested.
Here is an example of if the artifact never existed in "stage-release" repo
http://weavetoconnect.com/first_time.png
Here is an example of if the artifact existed and overwritten in
"stage-release" repo
http://weavetoconnect.com/over-write.png
I think i got one clue on what is happening here . Issue is that this code
get triggered every time an artifact is created in a repo and looks like
artifactory considers "even creating an group id" or "version number" as
creation of new artifact. and hence get triggered on all these events and
hence the code mess up the structure.
For ex if i need to upload axis-1.4.jar which has group id "axis" and
artifact id as "axis" and version number as 1.4 , then my assumption was
that artifactory considers "creation of axis-1.4.jar" as create event but
in actual it considers even creating "axis" folder , 1.4 folder as an
artifact and hence the above structure is formed.
But this is just my theory .. i think i need to use an event which get
triggered when jar is created ?
Please let me know
-Raj
On Sat, Apr 14, 2012 at 2:09 PM, Yoav Landman <[email protected]> wrote:
> Can you elaborate on why the copied artifact is not what you'd expect?
> Also, if you know the expected path of the artifact in the target
> repository, it is much preferable to check for its existence directly with
> Repositories.exists() than to run a search query each time.
>
>
> On Sat, Apr 14, 2012 at 2:30 AM, Rajwinder Makkar <[email protected]
> > wrote:
>
>> Ok so i have finally written the code by refering to various examples on
>> the artifactory site :
>>
>> Here is what the code is intended to do :
>>
>> 1. When a artifact is uploaded it get triggered on "afterCreate" event.
>> 2. It will query the release repo to see if the artifact version exist.
>> 3. If it exist then will not do any thing.
>> 4. If it does not exist then it will copy it to the release repo from
>> this stage repo.
>>
>> Now given i am niether a groovy or java coder this is a very basic code.
>>
>> Issue now is that when it copies the artifact it actually paste it in
>> target repo in a pretty wiered form. I am sure i am missing some thing but
>> i thought at this point it will be better to ask the experts ;-(
>>
>> -Raj
>>
>> ============================================
>> import org.artifactory.exception.CancelException
>> import org.artifactory.repo.RepoPathFactory
>> import org.artifactory.util.StringInputStream
>>
>> storage {
>>
>> afterCreate { item ->
>> def repoPaths = searches.artifactsByName(item.repoPath.name
>> ,"release")
>> def SourcePath = RepoPathFactory.create('ext-release-local',
>> item.repoPath.path)
>> def DestPath = RepoPathFactory.create('release', item.repoPath.path)
>> if (repoPaths.size >= 1)
>> {
>> echo "FOUND the artifact in the release repo so no need to copy"
>> } else {
>> echo "MISSING artifact in the release repo so copying it over"
>> repositories.copy (SourcePath, DestPath)
>> }
>> }
>>
>>
>> }
>>
>>
>> def echo(str) {
>> log.warn "########################### " + str;
>> }
>>
>>
>> ============================================
>>
>>
>> On Thu, Apr 12, 2012 at 9:30 AM, Rajwinder Makkar <
>> [email protected]> wrote:
>>
>>> Hmm i m not sure if this will work as before every build i do clean so
>>> every time it creates new file and it will have new chksum , so basically
>>> even if property tag eill not change, file will have new chksum even when
>>> code is not changed..
>>>
>>> Or am i missing something
>>>
>>> Raj
>>> On Apr 12, 2012 4:28 AM, "Yoav Landman" <[email protected]> wrote:
>>>
>>>> The pom.properties file contains a timestamp comment that changes with
>>>> every build and so pollutes the artifact's checksum signature.
>>>> When this is the only difference, so you are virtually creating the
>>>> exact same binary, then it makes sense to save time and space by not
>>>> redeploying the same content.
>>>>
>>>> On Wed, Apr 11, 2012 at 10:45 PM, Rajwinder Makkar <
>>>> [email protected]> wrote:
>>>>
>>>>> Thanks .. I think archive configuration will only prevent generation
>>>>> of .properties and .pom file .. i doubt it will impact checksum. And any
>>>>> how we want checksum to be changed if it's a new file and it make sense ,
>>>>> only i was confused on how checksum is used when it comes to artifactory.
>>>>>
>>>>> -Raj
>>>>>
>>>>> On Tue, Apr 10, 2012 at 12:43 AM, Yoav Landman <[email protected]>wrote:
>>>>>
>>>>>> You should be able to get around this behavior and end up with the
>>>>>> same checksum:
>>>>>> http://maven.apache.org/guides/mini/guide-archive-configuration.html
>>>>>>
>>>>>>
>>>>>> On Mon, Apr 9, 2012 at 1:18 PM, Noam Y. Tenne <[email protected]>wrote:
>>>>>>
>>>>>>> It's true that Maven modifies the produced artifact on every reactor
>>>>>>> build, even when the code itself was not modified; but that is the
>>>>>>> behavior
>>>>>>> of Maven.
>>>>>>> Although Artifactory has many features that are "tailor-made" to
>>>>>>> suit specific build tools, it actually serves as a general purpose
>>>>>>> binary
>>>>>>> repository manager and any file can be stored no matter how it was
>>>>>>> produced.
>>>>>>> So this feature can save a lot of time and bandwidth when deploying
>>>>>>> from an environment which doesn't modify the checksum of the artifact
>>>>>>> willy
>>>>>>> nilly, or if deploying a copy of an artifact that is already stored
>>>>>>> within
>>>>>>> Artifactory.
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Apr 8, 2012 at 8:31 PM, Rajwinder Makkar <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> I am little confused with this API :
>>>>>>>>
>>>>>>>> As per documentation :
>>>>>>>>
>>>>>>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>>>>> Deploy Artifact by Checksum
>>>>>>>>
>>>>>>>> Description: Deploy an artifact to the specified destination by
>>>>>>>> checking if the artifact content already exists in Artifactory.
>>>>>>>> If Artifactory already contains a readable artifact with the same
>>>>>>>> checksum the artifact content will be copied over to the new location
>>>>>>>> and
>>>>>>>> return a response without requiring a content transfer.
>>>>>>>>
>>>>>>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>>>>>
>>>>>>>> As with any maven build i do mvn clean deploy. This means that the
>>>>>>>> artifact will always be having a new md5 checksum no matter even if the
>>>>>>>> code is same. Then how come it can ever match the checksum of artifact
>>>>>>>> in
>>>>>>>> artifactory ? For artifactory every time it will be a new artifact as
>>>>>>>> the
>>>>>>>> checksum will be different.
>>>>>>>>
>>>>>>>> So what is the purpose of "deploy artifact by checksum"
>>>>>>>>
>>>>>>>> -Raj
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Apr 8, 2012 at 7:34 AM, Noam Y. Tenne <[email protected]>wrote:
>>>>>>>>
>>>>>>>>> A basic guide can be found in the wiki page I linked to (
>>>>>>>>> http://wiki.jfrog.org/confluence/display/RTF/User+Plugins), but
>>>>>>>>> don't hesitate to contact us for any more info.
>>>>>>>>> BTW, the user plugins are only available as an addon (part of
>>>>>>>>> Artifactory's Pro version), but you can download a free eval from
>>>>>>>>> here<https://secure.artifactoryonline.com/registration/evaluateaddons.html>
>>>>>>>>> .
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Noam
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Apr 8, 2012 at 5:24 PM, Rajwinder Makkar <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hmm .. this is smart approach Noam .. let me give it a try .. I
>>>>>>>>>> assume it needs to be written in groovy .. but can u point me to the
>>>>>>>>>> link
>>>>>>>>>> for documentation regarding this like how to create aftercreate hook
>>>>>>>>>> ?
>>>>>>>>>>
>>>>>>>>>> Thanks much
>>>>>>>>>> Raj
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sun, Apr 8, 2012 at 4:44 AM, Noam Y. Tenne <[email protected]>wrote:
>>>>>>>>>>
>>>>>>>>>>> Actually, this can be achieved by utilizing our user
>>>>>>>>>>> plugins<http://wiki.jfrog.org/confluence/display/RTF/User+Plugins>
>>>>>>>>>>> :
>>>>>>>>>>>
>>>>>>>>>>> 1. Create a temporary repository for deployments apart from
>>>>>>>>>>> you original target repository and direct all your deployments
>>>>>>>>>>> to that temp
>>>>>>>>>>> repo.
>>>>>>>>>>> 2. Revoke delete permissions from the original target
>>>>>>>>>>> repository and provide delete permissions to the temp repo.
>>>>>>>>>>> 3. Write a user plugin with the "afterCreate" hook that
>>>>>>>>>>> checks each deployment performed on the temp repo; if the
>>>>>>>>>>> artifact doesn't
>>>>>>>>>>> already exist in the "real" target repository, copy it to there;
>>>>>>>>>>> if the
>>>>>>>>>>> artifact already exists, do nothing with it.
>>>>>>>>>>>
>>>>>>>>>>> HTH,
>>>>>>>>>>> Noam
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Apr 8, 2012 at 12:24 PM, Noam Y. Tenne
>>>>>>>>>>> <[email protected]>wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Raj,
>>>>>>>>>>>>
>>>>>>>>>>>> Currently, there's no way to achieve this; but you may open a
>>>>>>>>>>>> feature request in our JIRA <https://issues.jfrog.org> if you
>>>>>>>>>>>> feel this feature is needed.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>> Noam
>>>>>>>>>>>>
>>>>>>>>>>>> On Sun, Apr 8, 2012 at 9:32 AM, Rajwinder Makkar <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Is there any way in artifactory to configure this :
>>>>>>>>>>>>>
>>>>>>>>>>>>> If an artifact that is sent for deployment to a repo has
>>>>>>>>>>>>> existing version in the same repo then ignore that artifact.
>>>>>>>>>>>>> Ignore means
>>>>>>>>>>>>> dont overwrite and dont fail the build either.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Or basically if i remove delete permission then it should not
>>>>>>>>>>>>> send failure to maven build.
>>>>>>>>>>>>>
>>>>>>>>>>>>> -Raj
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>>>>> For Developers, A Lot Can Happen In A Second.
>>>>>>>>>>>>> Boundary is the first to Know...and Tell You.
>>>>>>>>>>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it
>>>>>>>>>>>>> FREE!
>>>>>>>>>>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> Artifactory-users mailing list
>>>>>>>>>>>>> [email protected]
>>>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>>> For Developers, A Lot Can Happen In A Second.
>>>>>>>>>>> Boundary is the first to Know...and Tell You.
>>>>>>>>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>>>>>>>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Artifactory-users mailing list
>>>>>>>>>>> [email protected]
>>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>>> For Developers, A Lot Can Happen In A Second.
>>>>>>>>>> Boundary is the first to Know...and Tell You.
>>>>>>>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>>>>>>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Artifactory-users mailing list
>>>>>>>>>> [email protected]
>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> For Developers, A Lot Can Happen In A Second.
>>>>>>>>> Boundary is the first to Know...and Tell You.
>>>>>>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>>>>>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>>>>>>> _______________________________________________
>>>>>>>>> Artifactory-users mailing list
>>>>>>>>> [email protected]
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> For Developers, A Lot Can Happen In A Second.
>>>>>>>> Boundary is the first to Know...and Tell You.
>>>>>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>>>>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>>>>>> _______________________________________________
>>>>>>>> Artifactory-users mailing list
>>>>>>>> [email protected]
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> For Developers, A Lot Can Happen In A Second.
>>>>>>> Boundary is the first to Know...and Tell You.
>>>>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>>>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Artifactory-users mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Better than sec? Nothing is better than sec when it comes to
>>>>>> monitoring Big Data applications. Try Boundary one-second
>>>>>> resolution app monitoring today. Free.
>>>>>> http://p.sf.net/sfu/Boundary-dev2dev
>>>>>>
>>>>>> _______________________________________________
>>>>>> Artifactory-users mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Better than sec? Nothing is better than sec when it comes to
>>>>> monitoring Big Data applications. Try Boundary one-second
>>>>> resolution app monitoring today. Free.
>>>>> http://p.sf.net/sfu/Boundary-dev2dev
>>>>> _______________________________________________
>>>>> Artifactory-users mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> For Developers, A Lot Can Happen In A Second.
>>>> Boundary is the first to Know...and Tell You.
>>>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>>>> http://p.sf.net/sfu/Boundary-d2dvs2
>>>> _______________________________________________
>>>> Artifactory-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>>>
>>>>
>>
>>
>> ------------------------------------------------------------------------------
>> For Developers, A Lot Can Happen In A Second.
>> Boundary is the first to Know...and Tell You.
>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>> http://p.sf.net/sfu/Boundary-d2dvs2
>> _______________________________________________
>> Artifactory-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Artifactory-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/artifactory-users
>
>
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Artifactory-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/artifactory-users