Adding file into to an existing .war file - ruby

My automation deployment environment I have web.war file deployment under tomcat.
Lets assume this web.war application contains mix.jar file which is under /lib directory of web.war archive file.
(mix.jar releases giving by different DEV team and they don't responsible for giving web.war and the organization practice is putting the latest mix.jar file into the web.war archive file manually )
Can anyone help me to automate this process from CHEF recipe ?
Basically what I need during the chef deployment is, putting the mix.jar file into the web.war/lib directory under tomcat container.
Our current practice is open the web.war file from Winrar and put the mix.jar file into it and redeploy it into tomcat.
But I want to automate this process.

Jar files are just zip files so you can probably write some code using either the zip command line tool or the RubyZip gem (I would go for the latter but depends on your comfort level with Ruby code) to do this on the fly, but please don't. Chef is really not built for this kind of task and it will be very frustrating to build the code in a robust manner. If you need it ASAP and want to build a fragile version now and fix the process afterwards that's more understandable, but otherwise probably just talk to your dev team about what this is and why you need it added to their build process. Some problems are best solved with communication rather than code.

Related

How do I replace remote resource.bundles with local resource.bundles in xcode

I am trying to maintain my changes to config files of resource.bundle directories from remote cocoapods repositories.
While working on the implementation I am able to make changes locally but I do not own the external repository.I would like to be able to refer to the code owners tags implementing the pods from their repos in my project while maintaining my configuration changes.
It has been suggested to me to create a script phase in my build process that would copy files from a "assets folder" within the project to the finished pod directory after the remote pull and build.
This sounds feasible but I am not sure where to start in this process or what the script would like.
essentially I would have a
root/assetsfolder/resource.bundle
that would need to be copied to
Pods/ExternalPodName/Core/resource.bundle
Any help would be appreciated.

how to deploy a custom sub-directory within the project with capistrano?

I couldn't find a way to do this yet with capistrano, but lets say I have a project like
project
project/src
project/Capfile
project/config/deploy.rb
project/config/deploy/production.rb
project/build
project/build/main.js
project/build/other_src.js
so the intention is to deploy only what I have within the /build sub directory within the project.
I realize I can just move the capistrano files to the build directory, but the directory is build and dropped every time I compile the project, so I need to kept the capistrano files within the root dir of the project.
Any advice on how to do it in Capistrano?
I've always deployed the entire project and then pointed my webserver at the relevant subfolder. Alternately, you can write a custom task to rework the data in the release path.

Jenkins CI: Where and how store configuration files?

I am in process of moving configuration parameters out of Java application. I discover that the best approach is to extend your classpath and use .properties files (leave ZooKeeper alone for another requirement).
So my WAR file no longer have any hosts/IPs/URLs, users/passwords.
DevOps distribute configs manually across test, stage, stable installations.
Now time for Jenkins to run tests. But they fail as there are no required .propeties files in classpath.
How can I load this config files to Jenkins and how to make in available in test classpath?
maven-surefire-plugin allow extending classpath and passing system-properties.
So only question how to get separate directory in Jenkins hosting server and load files to this directory and create alias/placeholder/envvar per build job to refer to this path in build config.
This job can be done with SSH access, but I think that this is "wrong way". I expect that this can be done via Jenkins UI (any manager can upload file in WEB browser).
UPDATE I have no requirements for distributed slave/master builds but it whould nice to have solution that migrate configuration files to slaves automatically...
In this way sshing to host or ftp/scp - bad thing.
I read most of Jenkins docs, ask at mail list and IRC. Yea - Jenkins community is silent. At docs I found link to Config File Provider Plugin, after that I visit http://builder.evil.com/jenkins/pluginManager/available page and look for config keyword.
There are a lot related plug-ins with various usefulness to my subject (most useless first):
https://wiki.jenkins-ci.org/display/JENKINS/Envfile+Plugin - This plugin enables you to set environment variables via a file.
https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin - Allows credentials to be bound to environment variables for use from miscellaneous build steps.
https://wiki.jenkins-ci.org/display/JENKINS/Environment+Script+Plugin - Allows you to run a script before each build that generates environment variables for it.
https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin - This plugin makes it possible to have an isolated environment for your jobs.
https://wiki.jenkins-ci.org/display/JENKINS/Copy+Data+To+Workspace+Plugin - Copies data to workspace directory for each project build.
https://wiki.jenkins-ci.org/display/JENKINS/Copy+To+Slave+Plugin - This plugin allows to copy a set of files, from a location somewhere on the master node, to jobs' workspaces. It also allows to copy files back from the workspaces of jobs located on a slave node to their workspaces on the master one.
https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin - Adds the ability to provide configuration files (i.e., settings.xml for maven, XML, groovy, custom files, etc.) loaded through the Jenkins UI which will be copied to the job's workspace.
Only last plug-in - Config File Provider Plugin allow editing configs via Jenkins WEB interface. And it have brother - Managed Script Plugin - for uploading/managing/editing custom scripts. No question now I use Config File Provider Plugin!
You should keep the configs required for the tests together with the rest of source code, so that after compilation, your unit tests can run.
After deploying the .war, the DevOps team should overwrite the in-war configs with whatever per-environment configs that they have.

Path for persisting files between Capistrano deployments in a Ruby app

Where is the proper path for creating files using Ruby on a *nix environment? The files must persist between restarts and releases. Obviously using the project path doesn't work as Capistrano will create a new folder for each push.
Capistrano has a system directory created by default that should be linked to the shared/system directory at the root of your release path. This will persist between deployments.
You should put anything there that is not specific to your deployment, for example, attached files or other user uploads.
In your version control system you should be sure to not deploy this directory as to avoid packaging up your development-specific content. Generally it should be ignored, not included in your version control.

Leiningen - way to automate removal of *.DSA and *.SF files (Clojure Maven)

I'm using Leiningen to automate the creation of a single 'uberjar' from several dependencies. (For a Web Start Application).
Some of the jar files are signed, and the uberjar process brings across their signature files (which don't match the new jar). I want to add my own self-signed cert and remove the old ones.
Is there an easy way in leiningen to remove these old signing files (or stop them being copied across)? I'm doing it as a manual step at present.
See lein ticket #31. I submitted a patch, but if it isn't in the version you're using, you can put this in your project.clj for a fairly comprehensive ban on .sf files:
:uberjar-exclusions [#"(?i)^META-INF/[^/]*\.SF$"]
This is what I was looking for:
:uberjar-exclusions [#"foo.sf"]
From here: Leiningen has problems building a working uberjar

Resources