You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Paul Spencer <pa...@mindspring.com> on 2020/07/01 20:24:36 UTC

Cave - Copying artifacts from a Quality to a Production Repository?

Cave v4.2.1

I would like to maintain several site specific “Quality” and a “Production” repositories with the intent that artifacts passing “QA” in the “Quality” repository will be moved to the site’s “Production” repository.

This can be implemented in one or two instance of Cave per site, so what are my options for of copying artifacts passing “QA” to a “Production” repository and what would the workflow look like?

From my research:
- repository-copy is documented to copy entire repositories, not individual artifacts or features
- The Gateway features appear to have no filtering or “allowlist” capability.

Paul Spencer

Re: Cave - Copying artifacts from a Quality to a Production Repository?

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi,

Yes, it’s what I mean by using "directly" maven.

By the way, if you use only maven (not OBR), then no need to update repository.xml.


Regards
JB

> Le 2 juil. 2020 à 21:47, Paul Spencer <pa...@mindspring.com> a écrit :
> 
> JB,
> Until "cave:repository-artifact-promote" is implement, below is a workaround:
> 
> By adding the Cave Quality repository to the Karaf instance artifacts can be uploaded to the Cave Production repository then deleting the artifact from the Cave Quality repository.  
> 
> ***
> * Adding Cave Quality repository to Karaf.  This only needs to be done once.
> ***
> karaf@root()> maven:repository-add -id quality http://localhost:8181/cave/repository/quality/                                                                                             
> 
> == Remote repositories
> ID                              │ URL                                                            │ Releases    │ Snapshots   │ Defined in
> ────────────────────────────────┼────────────────────────────────────────────────────────────────┼─────────────┼─────────────┼───────────
> central                         │ https://repo1.maven.org/maven2/                                │ yes (daily) │ no          │ PID
> apache                          │ https://repository.apache.org/content/groups/snapshots-group/  │ no          │ yes (daily) │ PID
> ops4j.sonatype.snapshots.deploy │ https://oss.sonatype.org/content/repositories/ops4j-snapshots/ │ no          │ yes (daily) │ PID
> quality                         │ http://localhost:8181/cave/repository/quality/                 │ yes (daily) │ no          │ PID
> 
> == Default repositories
> ID                      │ URL                                                  │ Releases    │ Snapshots
> ────────────────────────┼──────────────────────────────────────────────────────┼─────────────┼────────────
> system.repository       │ file:/home/pi/Documents/apache-karaf-4.2.9/system/   │ yes (daily) │ yes (daily)
> kar.repository          │ file:/home/pi/Documents/apache-karaf-4.2.9/data/kar/ │ yes (daily) │ yes (daily)
> child.system.repository │ file:/home/pi/Documents/apache-karaf-4.2.9/system/   │ yes (daily) │ yes (daily)
> 
> karaf@root()>
> 
> 
> ***
> * Moving artifact from the Cave Quality repository to the Cave Production repository through the local Karaf
> ***
> 1) Copy the artifact to the Cave Production repository using cave:repository-artifact-add
> 
> karaf@root()> cave:repository-artifact-add production mvn:foo.bar/test/1.0.0/jar
> Installing foo.bar:test:jar:1.0.0 to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/1.0.0/test-1.0.0.jar
> Installed foo.bar:test:jar:1.0.0 to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/1.0.0/test-1.0.0.jar
> Installing foo.bar:test/maven-metadata.xml to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/maven-metadata-local.xml
> Installed foo.bar:test/maven-metadata.xml to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/maven-metadata-local.xml
> karaf@root()>                                                                                                                                                                             
> 
> 2) Remove the artifact and related files from the Cave Quality repository.  The .pom, .md5, and .sha1 related files where created by mvn:deploy-file
> 
> karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/jar                                                                                                          
> karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/jar.md5                                                                                                      
> karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/jar.sha1
> karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/pom
> karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/pom.md5                                                                                                      
> karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/pom.sha1
> karaf@root()>                                                                                                                                                                             
> 
> 
> 3) Rebuild repository.xml in each Cave repository
> 
> karaf@root()> cave:repository-update-bundle-descriptor production
> karaf@root()> cave:repository-update-bundle-descriptor quality
> karaf@root()>                                                                                                                                                                             
> 
> Paul Spencer
> 
> 
> 
>> On Jul 1, 2020, at 4:32 PM, Jean-Baptiste Onofre <jb...@nanthrax.net> wrote:
>> 
>> Hi,
>> 
>> You can use mvn to that with something like:
>> 
>> mvn deploy:deploy-file
>> 
>> Directly in Cave, you can instead use cave:repository-artifact-add command in a script.
>> 
>> I think it’s a good idea to create cave:repository-artifact-promote command supporting regex, copying artifacts from one repo to another.
>> 
>> Regards
>> JB
>> 
>>> Le 1 juil. 2020 à 22:24, Paul Spencer <pa...@mindspring.com> a écrit :
>>> 
>>> Cave v4.2.1
>>> 
>>> I would like to maintain several site specific “Quality” and a “Production” repositories with the intent that artifacts passing “QA” in the “Quality” repository will be moved to the site’s “Production” repository.
>>> 
>>> This can be implemented in one or two instance of Cave per site, so what are my options for of copying artifacts passing “QA” to a “Production” repository and what would the workflow look like?
>>> 
>>> From my research:
>>> - repository-copy is documented to copy entire repositories, not individual artifacts or features
>>> - The Gateway features appear to have no filtering or “allowlist” capability.
>>> 
>>> Paul Spencer
>> 
> 


Re: Cave - Copying artifacts from a Quality to a Production Repository?

Posted by Paul Spencer <pa...@mindspring.com>.
JB,
Until "cave:repository-artifact-promote" is implement, below is a workaround:

By adding the Cave Quality repository to the Karaf instance artifacts can be uploaded to the Cave Production repository then deleting the artifact from the Cave Quality repository.  

***
* Adding Cave Quality repository to Karaf.  This only needs to be done once.
***
karaf@root()> maven:repository-add -id quality http://localhost:8181/cave/repository/quality/                                                                                             

== Remote repositories
ID                              │ URL                                                            │ Releases    │ Snapshots   │ Defined in
────────────────────────────────┼────────────────────────────────────────────────────────────────┼─────────────┼─────────────┼───────────
central                         │ https://repo1.maven.org/maven2/                                │ yes (daily) │ no          │ PID
apache                          │ https://repository.apache.org/content/groups/snapshots-group/  │ no          │ yes (daily) │ PID
ops4j.sonatype.snapshots.deploy │ https://oss.sonatype.org/content/repositories/ops4j-snapshots/ │ no          │ yes (daily) │ PID
quality                         │ http://localhost:8181/cave/repository/quality/                 │ yes (daily) │ no          │ PID

== Default repositories
ID                      │ URL                                                  │ Releases    │ Snapshots
────────────────────────┼──────────────────────────────────────────────────────┼─────────────┼────────────
system.repository       │ file:/home/pi/Documents/apache-karaf-4.2.9/system/   │ yes (daily) │ yes (daily)
kar.repository          │ file:/home/pi/Documents/apache-karaf-4.2.9/data/kar/ │ yes (daily) │ yes (daily)
child.system.repository │ file:/home/pi/Documents/apache-karaf-4.2.9/system/   │ yes (daily) │ yes (daily)

karaf@root()>


***
* Moving artifact from the Cave Quality repository to the Cave Production repository through the local Karaf
***
1) Copy the artifact to the Cave Production repository using cave:repository-artifact-add

karaf@root()> cave:repository-artifact-add production mvn:foo.bar/test/1.0.0/jar
Installing foo.bar:test:jar:1.0.0 to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/1.0.0/test-1.0.0.jar
Installed foo.bar:test:jar:1.0.0 to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/1.0.0/test-1.0.0.jar
Installing foo.bar:test/maven-metadata.xml to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/maven-metadata-local.xml
Installed foo.bar:test/maven-metadata.xml to /home/pi/Documents/apache-karaf-4.2.9/data/cave/repository/production/foo/bar/test/maven-metadata-local.xml
karaf@root()>                                                                                                                                                                             

2) Remove the artifact and related files from the Cave Quality repository.  The .pom, .md5, and .sha1 related files where created by mvn:deploy-file
 
karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/jar                                                                                                          
karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/jar.md5                                                                                                      
karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/jar.sha1
karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/pom
karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/pom.md5                                                                                                      
karaf@root()> cave:repository-artifact-delete quality mvn:foo.bar/test/1.0.0/pom.sha1
karaf@root()>                                                                                                                                                                             


3) Rebuild repository.xml in each Cave repository

karaf@root()> cave:repository-update-bundle-descriptor production
karaf@root()> cave:repository-update-bundle-descriptor quality
karaf@root()>                                                                                                                                                                             

Paul Spencer



> On Jul 1, 2020, at 4:32 PM, Jean-Baptiste Onofre <jb...@nanthrax.net> wrote:
> 
> Hi,
> 
> You can use mvn to that with something like:
> 
> mvn deploy:deploy-file
> 
> Directly in Cave, you can instead use cave:repository-artifact-add command in a script.
> 
> I think it’s a good idea to create cave:repository-artifact-promote command supporting regex, copying artifacts from one repo to another.
> 
> Regards
> JB
> 
>> Le 1 juil. 2020 à 22:24, Paul Spencer <pa...@mindspring.com> a écrit :
>> 
>> Cave v4.2.1
>> 
>> I would like to maintain several site specific “Quality” and a “Production” repositories with the intent that artifacts passing “QA” in the “Quality” repository will be moved to the site’s “Production” repository.
>> 
>> This can be implemented in one or two instance of Cave per site, so what are my options for of copying artifacts passing “QA” to a “Production” repository and what would the workflow look like?
>> 
>> From my research:
>> - repository-copy is documented to copy entire repositories, not individual artifacts or features
>> - The Gateway features appear to have no filtering or “allowlist” capability.
>> 
>> Paul Spencer
> 


Re: Cave - Copying artifacts from a Quality to a Production Repository?

Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi,

You can use mvn to that with something like:

mvn deploy:deploy-file

Directly in Cave, you can instead use cave:repository-artifact-add command in a script.

I think it’s a good idea to create cave:repository-artifact-promote command supporting regex, copying artifacts from one repo to another.

Regards
JB

> Le 1 juil. 2020 à 22:24, Paul Spencer <pa...@mindspring.com> a écrit :
> 
> Cave v4.2.1
> 
> I would like to maintain several site specific “Quality” and a “Production” repositories with the intent that artifacts passing “QA” in the “Quality” repository will be moved to the site’s “Production” repository.
> 
> This can be implemented in one or two instance of Cave per site, so what are my options for of copying artifacts passing “QA” to a “Production” repository and what would the workflow look like?
> 
> From my research:
> - repository-copy is documented to copy entire repositories, not individual artifacts or features
> - The Gateway features appear to have no filtering or “allowlist” capability.
> 
> Paul Spencer