GithubHelp home page GithubHelp logo

poc-puppet-module-packaging's People

Contributors

arioch avatar visibilityspots avatar

Stargazers

 avatar

Watchers

 avatar  avatar

poc-puppet-module-packaging's Issues

Empty dependency

There is an issue when there isn't a dependency declared in the Modulefile the fpm command fails because of the emptiness of the --depends parameter.

I tackled it using the if statement to grab the dependencies out of the Modulefile. If there are dependency execute the fpm command with the --depends param.

If not execute the fpm command without the --depends param.

Jenkins managed script

I used this code to start writing a managed script in a jenkins instance with the os as a parameter.

So this script can be ran in a jenkins job pointing to the puppet-module git repository:

DATE=$(date '+%Y%m%d%H%M')
PUPPET_TREE='/etc/puppet'
BUILD_OS=$1

MODULE_NAME=$(
grep -i ^name Modulefile
| sed -e "s+"+'+g"
| cut -d "'" -f2
| cut -d '-' -f2
)

MODULE_VERSION=$(
grep -i ^version Modulefile
| sed -e "s+"+'+g"
| cut -d "'" -f2
)

MODULE_LICENSE=$(
grep -i ^license Modulefile
| sed -e "s+"+'+g"
| cut -d "'" -f2
)

MODULE_DESCRIPTION=$(
grep -i ^description Modulefile
| sed -e "s+"+'+g"
| cut -d "'" -f2
)

MODULE_URL=$(
grep -i ^project_page Modulefile
| cut -d "'" -f2
)

if [ -n "$(grep -i ^dependency Modulefile)" ]
then
DEPENDENCY_NAME=$(
grep -i ^dependency Modulefile
| sed -e "s+"+'+g"
| cut -d "'" -f2
| cut -d '/' -f2
)
DEPENDENCY_VERSION=$(
grep -i ^dependency Modulefile
| sed -e "s+"+'+g"
| cut -d "'" -f4
)
FPM_DEPENDS="puppet-module-${DEPENDENCY_NAME} ${DEPENDENCY_VERSION}"
fi

build_centos() {
fpm -s dir -t rpm
-v ${MODULE_VERSION}
--url '${MODULE_URL}'
--epoch ${BUILD_NUMBER}
--iteration ${BUILD_NUMBER}
--prefix ${PUPPET_TREE}/modules/${MODULE_NAME}
--directories .
--exclude .git*
--exclude ..lock
--exclude .
.swp
--exclude .gem*
--exclude .project
--exclude .vim*
--exclude .travis.yml
-a all
-n puppet-module-${MODULE_NAME}
.
}

build_squeeze() {
fpm -s dir -t deb
--architecture all
-n puppet-module-${MODULE_NAME}
-v ${MODULE_VERSION}-${DATE}+squeeze1
--license "${MODULE_LICENSE}"
--prefix ${PUPPET_TREE}/modules/${MODULE_NAME}
--description "${MODULE_DESCRIPTION}"
--depends "${FPM_DEPENDS}"
--directories .
--exclude .git*
--exclude ..lock
--exclude .
.swp
--exclude .gem*
--exclude .project
--exclude .vim*
--exclude .travis.yml
.
}

build_wheezy() {
fpm -s dir -t deb
--architecture all
-n puppet-module-${MODULE_NAME}
-v ${MODULE_VERSION}-${DATE}+wheezy1
--license "${MODULE_LICENSE}"
--prefix ${PUPPET_TREE}/modules/${MODULE_NAME}
--description "${MODULE_DESCRIPTION}"
--depends "${FPM_DEPENDS}"
--directories .
--exclude .git*
--exclude ..lock
--exclude .
.swp
--exclude .gem*
--exclude .project
--exclude .vim*
--exclude .travis.yml
.
}

build_debian() {
build_squeeze
build_wheezy
}

case $BUILD_OS in
centos_)
build_centos
exit
;;
debian_)
build_debian
exit
;;
*)
echo "This OS, $BUILD_OS isn't supported by this script"
exit
;;
esac

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.