You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2017/09/03 09:35:36 UTC

Re: Karaf Feature vs. OBR

>>>>> Steinar Bang <sb...@dod.no>:
>>>>> Guillaume Nodet <gn...@apache.org>:

>> Fwiw, bundle:watch is very specific and only check the local repository, so
>> it won't work if you upload a new snapshot on a remote repository.

> I was sort of hoping it would work for a different maven repo in the
> local file system, which is what I currently have.

I tried one (actually two experiments):
 1. Made the repository deployed to by travis-ci karaf's local
    repository. 
    Using the same local repository as maven builds worked when I tried
    it out on my development machine (after I had made the repository
    writable by karaf).
    But it failed when using the repository deployed to by travis-ci on
    my production machine, because karaf was unable to recognize the
    deployed snapshots as snapshots in the local repository (actual
    repositories have a different snapshot structure to the local
    repository)

 2. Since I was in experimentation mode I tried making the repository
    are both the local repository and added it as a repository, like so:
     config:edit org.ops4j.pax.url.mvn
     config:property-set org.ops4j.pax.url.mvn.localRepository /var/www-maven/repository
     config:property-append org.ops4j.pax.url.mvn.repositories ", file:///var/www-maven/repository, http://maven.vaadin.com/vaadin-addons"
     config:update

    But this made karaf terribly confused:
     karaf@root()> feature:repo-add mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/featuresAdding feature url mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/features
     Error executing command: Error resolving artifact no.priv.bang.ukelonn:ukelonn.karaf:xml:features:1.0.0-SNAPSHOT: [Could not transfer artifact no.priv.bang.ukelonn:ukelonn.karaf:xml:features:1.0.0-SNAPSHOT from/to repo_1276108016 (http://artifactory.lampiris.be/remote-repos/): artifactory.lampiris.be, Could not find artifact no.priv.bang.ukelonn:ukelonn.karaf:xml:features:1.0.0-SNAPSHOT in apache (http://repository.apache.org/content/groups/snapshots-group/), Could not find artifact no.priv.bang.ukelonn:ukelonn.karaf:xml:features:1.0.0-SNAPSHOT in sonatype.snapshots.deploy (https://oss.sonatype.org/content/repositories/snapshots/), Could not find artifact no.priv.bang.ukelonn:ukelonn.karaf:xml:features:1.0.0-SNAPSHOT in ops4j.sonatype.snapshots.deploy (https://oss.sonatype.org/content/repositories/ops4j-snapshots/), Could not find artifact no.priv.bang.ukelonn:ukelonn.karaf:xml:features:1.0.0-SNAPSHOT in spring-ebr-repository (http://repository.springsource.com/maven/bundles/external/)] : mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/features
     karaf@root()>

(I didn't expect the second experiement to work. I just tried it out to
see what would happen...:-) )

So now I'm back to running with the https-URL pointing to the travis-ci
deployment repository added to the mvn.repositories setting:
 config:edit org.ops4j.pax.url.mvn
 config:property-append org.ops4j.pax.url.mvn.repositories ", https://maven.bang.priv.no/repository/@snapshots, http://maven.vaadin.com/vaadin-addons"
 config:property-set org.ops4j.pax.url.mvn.globalUpdatePolicy always
 config:update

So, no success yet at totally automating the deployment from a
travis-ci build.  

I still need to to "bundle:update" from the karaf console on each bundle
I want updated after a new snapshot has been added.


Re: Karaf Feature vs. OBR

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
>>>>> Steinar Bang <sb...@dod.no>:
> [snip!]
>> So, no success yet at totally automating the deployment from a
>> travis-ci build.  

>> I still need to to "bundle:update" from the karaf console on each bundle
>> I want updated after a new snapshot has been added.

> The still-in-flux REST API of the webconsole offers a possibility:
>  http://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-console-restful-api.html

> I have verified that this causes a bundle to update on my development
> machine:
>  curl -X POST --data "action=update" --basic -u karaf:karaf http://localhost:8181/system/console/bundles/no.priv.bang.ukelonn

> So in theory I could now create a shell script (or something) that would
> POST an update to all affected bundles, and modify the travis.yml file
> to run this script after completion of the snapshot deployment.

I was able to use the rest-maven-plugin to accomplish this, by adding
this to the <pluginManagement> of the parent pom
 https://github.com/steinarb/ukelonn/blob/scratch/call-karaf-console-rest-api-to-update-bundle-at-the-end-of-deploy/pom.xml#L320
and then adding the following to each of the bundle projects:
 https://github.com/steinarb/ukelonn/blob/scratch/call-karaf-console-rest-api-to-update-bundle-at-the-end-of-deploy/ukelonn.api/pom.xml#L68
 https://github.com/steinarb/ukelonn/blob/scratch/call-karaf-console-rest-api-to-update-bundle-at-the-end-of-deploy/ukelonn.bundle.db.liquibase/pom.xml#L98
 https://github.com/steinarb/ukelonn/blob/scratch/call-karaf-console-rest-api-to-update-bundle-at-the-end-of-deploy/ukelonn.bundle.db.test/pom.xml#L169
 https://github.com/steinarb/ukelonn/blob/scratch/call-karaf-console-rest-api-to-update-bundle-at-the-end-of-deploy/ukelonn.bundle.db.postgresql/pom.xml#L154
 https://github.com/steinarb/ukelonn/blob/scratch/call-karaf-console-rest-api-to-update-bundle-at-the-end-of-deploy/ukelonn.bundle/pom.xml#L237

> The downside is that I would have to install the webconsole, and expose
> it to the internet, and I'm not sure I want to do that... I prefer to
> limit access to admin features to what's absolutely necessary.

The downsides are still valid.  

But I have verfied locally that this works.


Re: Karaf Feature vs. OBR

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
[snip!]
> So, no success yet at totally automating the deployment from a
> travis-ci build.  

> I still need to to "bundle:update" from the karaf console on each bundle
> I want updated after a new snapshot has been added.

The still-in-flux REST API of the webconsole offers a possibility:
 http://felix.apache.org/documentation/subprojects/apache-felix-web-console/web-console-restful-api.html

I have verified that this causes a bundle to update on my development
machine:
 curl -X POST --data "action=update" --basic -u karaf:karaf http://localhost:8181/system/console/bundles/no.priv.bang.ukelonn

So in theory I could now create a shell script (or something) that would
POST an update to all affected bundles, and modify the travis.yml file
to run this script after completion of the snapshot deployment.

The downside is that I would have to install the webconsole, and expose
it to the internet, and I'm not sure I want to do that... I prefer to
limit access to admin features to what's absolutely necessary.