I asked a couple of people at the chef meetup in Seattle about this; they
gave me some good ideas and suggested that I ask the mailing list for more,
so… Does anyone have a nice way of using chef to deploy maven snapshots
from nexus that they would be willing to share? At my job, we’ve extended
the deploy resource to know how to use the nexus search functionality to
find artifacts and download them. It works great, except that due to the
nature of maven snapshots (*), it downloads snapshots whether it needs to or
not. Ideas so far:
- Hit nexus, download thing-1.0-SNAPSHOT.war snapshot, compare it to the
existing one. If they are the same, then tell the nexus/deploy resource
somehow not to move the symlinks. Issue: I don’t know how to tell the
deploy resource not to move the symlinks.
- Give thing-1.0-SNAPSHOT.war a unique identifier (timestamp/build
number/checksum) in a file in the target node’s filesystem. When the recipe
next runs, scrape the nexus output to determine whether there is a new
snapshot that needs to be downloaded. If there isn’t, don’t download
anything, and gracefully exit the nexus/deploy resource. Issue: I don’t
know how to make the graceful exit.
- Add code to check nexus for new snapshots separately, and only run the
nexus resource if there are changes. This is what I’m planning to implement
for now. Issues: None really, except that (1) or (2) seem to me to be
cleaner solutions if I could make them work.
- Add a build step to jenkins to run the chef client and update nodes when
a new snapshot is built. Issue: I don’t love the idea of adding an
explicit dependency on jenkins, although I suppose I could be convinced
In case it matters, we’re using nexus 1.5 open source, for which API
documentation seems to be not quite available.
(*) Basically, thing-1.0-SNAPSHOT.war refers to the most recent of