using jenkins to build RPM packages

17,049
  • You can install Jenkins on a different machine, but you generally must have a Jenkins "node", "slave", "agent" installed on a machine that can generate RPM packages.

  • Running each step of the RPM package setup is putting all the steps to build within Jenkins. It works much better if you extend your build system to build the RPM, and have Jenkins do what it does best, manage the build (schedule, etc), not micro-manage the build (do the steps).

Depending on what you currently have as your build system, this might include ant directives to setup the rpm build tree, copy in the .spec file, and a executable call to rpmbuild.

  • Jenkins can easily call a post-build task to do this, or you might want to configure a mini "fake" project that does the update, depending on tastes.

As an aside, for a yum command to work without using the --localinstall option, you will need to have a web server set up, the new RPM copied to the right folder on the web server, and the indexing files rebuilt (repobuild is the script to do so, if I recall correctly).

On the client machine (where the package will be installed), you will need to have a yum configuration that directs the client machine to include the web server as one of the known yum repositories.

Share:
17,049
ender
Author by

ender

Updated on June 23, 2022

Comments

  • ender
    ender almost 2 years

    I want to use Jenkins for creating RPM packages to deploy code and scripts onto a Linux redhat machine(s) So the applications are a mix of technologies (no compiling needed) i just need to package up the applications deploy them to the correct location restart apache

    Would anybody have some instructions on how to do these steps for a total Newbie:

    Some questions:

    1. Do i need to install jenkins on a local linux machine if im going to be creating RPM's that will be deployed on to linux redhat machine (i was hoping to install jenkins on windows)

    2. Does anybody have a example of creating a package out of a local folder (no source control for the moment) I want to just specify the directory of where to take the code from and specify where to deploy the code to on a machine the rpm is installed on

    3. On the destination machine i want to run something like yum -install mypackage-version12.rpm and it will install the code/scripts to the specified directory and restart apache i need an example of this also.

    Thanks