added ebuild for gitlab-ci-runner-5.2.1

This commit is contained in:
Manuel Friedli 2015-05-10 19:40:14 +02:00
parent a555af05e6
commit f9f42251a0
2 changed files with 162 additions and 0 deletions

View file

@ -2,4 +2,6 @@ AUX gitlab-ci-runner-5.0.0-fix-gemfile.patch 1099 SHA256 80dddabf6c0abf0096a9ba5
AUX gitlab-ci-runner.conf 78 SHA256 3b9e4f922ff53cc57c4c883dd19c1343b2a61ceba7bef303d623aedc5d2651cd SHA512 af0b725e3eea789776962a085f53d8787f91b1c8bdd7aad76aeedad2304885ac890c81d95126ad5de2590ef2b0c93045d4ba50f8bc2ba7e0caeec3b27fa4f6f7 WHIRLPOOL 10563abf39449389e9cf53076fd21a106f555e58b708b679c9cc91213ec0319a7b0dfa15977c187ceedb9a2f7c060424f66891472a2e8e8ca78262e628e05968
AUX gitlab-ci-runner.init 1551 SHA256 83bb581255db1a8bfdf15627ce4d3166e3fab6725a36086a51ab6a69c4b0536a SHA512 d0af95f32af62c6b8758a29af831fbf80310381446c76bac795c767f5c2d6d04ead5329a8c0cc3b0624d83ea500bc48edef288073297b1060eb4df5b7856033c WHIRLPOOL 7fcb1ef8d15742a9800e43496e2802f66e8805510f40e685b7f1ef20ae23bb8d2389480acb11386cff1223ada7981e2a5d9ddaeb4d32fe4d74f88583f55c5311
DIST gitlab-ci-runner-5.0.0.tar.gz 11846 SHA256 7d7f97894ba5ffeb4f06aa8a62d1ec17c2a1cbf84efd20418d74ccfc0f18c1e5 SHA512 cee02d144f37840b215a9cf706a3ca8239fbd2f33561b783b1abfd9ebdfd2eb323ecb57b8545d08f17c50a24e237053c505257279940cef2dce60f160364875f WHIRLPOOL d79a53553221715d3a34a18bce88af5fdf02e162afb1c0ca7212707f2672e0e30f584513ac9a1b7a6b9c46b3695762fd04e2819903b05504b5f482e0047dc337
DIST gitlab-ci-runner-5.2.1.tar.gz 13379 SHA256 b03d63632e891f56b46097e2ca6b8e53dbb60cf82ed6c0b7164eed80c86f27eb SHA512 2a557ed01bd7a2ad9b1b0f6f47d39926d80163f61ba1df26977083d26a0f4346175efa2c9a1ba93df13db130d34a77440a18168e0cec9e9f5b9a7b88b9b48cba WHIRLPOOL 3c7f602cab556596fb1d39ef8b5f68fe1bf050d0af44b08a942ffc5bbab8ceb354ebd226acd18fafff3f88237182cac4b9f31cfa95a0fcbf014c18f308e7593d
EBUILD gitlab-ci-runner-5.0.0.ebuild 3744 SHA256 3cd6c4d1a3df1b06da6365efb8f60ab373561598f47c9c6c38de1e0627dd2c82 SHA512 42e24a2bb8d9bd478e454200c1fec3affb7d824fdae9073627535d12f998378b8247166d821d4473c5f8d3f60e2d2e10dd843ef3a59935c1cf48286d3a9f92a7 WHIRLPOOL ce3b94c8393788c694baf904c794eaeda930b022360cd1ee700562d90dde2f416c655c6277a26714806572c83336d2c878e9bcd6795778fa77fd70029463e736
EBUILD gitlab-ci-runner-5.2.1.ebuild 3751 SHA256 755fe91c75bd70483fd836722074e0d936836ddba234b7bfeb940e262400d022 SHA512 867469996a3847718ed914dbf887436265dcc87bf73bc646327c01a4dbd74808c6505749f04aaf95fcb81c54b1e4680f0e578e66e740fba30b5edefd14e616a9 WHIRLPOOL c48e1dc37ceae10d7882fece78f69d7d11f9f5c0243d78d5d557c48f03a377bd21ed53931d63840c469454bc653abb15ed81617082961bb8bb9f2295b84bfcb5

View file

@ -0,0 +1,160 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
# Maintainer notes:
# - This ebuild uses Bundler to download and install all gems in deployment mode
# (i.e. into isolated directory inside application). That's not Gentoo way how
# it should be done, but GitLab CI Runner has too many dependencies that it
# will be too difficult to maintain them via ebuilds.
#
USE_RUBY="ruby19 ruby20 ruby21"
PYTHON_DEPEND="2:2.7"
inherit eutils python ruby-ng user
DESCRIPTION="GitLab CI Runner is the build processor needed for GitLab CI"
HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci-runner"
SRC_URI="https://github.com/gitlabhq/gitlab-ci-runner/archive/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~x86"
# IUSE=""
## Gems dependencies:
# charlock_holmes dev-libs/icu
# grape, capybara dev-libs/libxml2, dev-libs/libxslt
#
GEMS_DEPEND="
dev-libs/icu
dev-libs/libxml2
dev-libs/libxslt"
DEPEND="${GEMS_DEPEND}
dev-vcs/git"
RDEPEND="${DEPEND}
virtual/mta"
ruby_add_bdepend "
virtual/rubygems
>=dev-ruby/bundler-1.0"
#
RUBY_PATCHES=(
"${PN}-5.0.0-fix-gemfile.patch"
)
MY_NAME="gitlab-ci-runner"
MY_USER="gitlab_ci_runner"
DEST_DIR="/opt/${MY_NAME}"
LOGS_DIR="/var/log/${MY_NAME}"
TEMP_DIR="/var/tmp/${MY_NAME}"
RUN_DIR="/run/${MY_NAME}"
pkg_setup() {
enewgroup ${MY_USER}
enewuser ${MY_USER} -1 /bin/bash ${DEST_DIR} ${MY_USER}
}
all_ruby_prepare() {
# remove useless files
rm -r lib/support/{init.d,logrotate.d}
}
all_ruby_install() {
local dest=${DEST_DIR}
local logs=${LOGS_DIR}
local temp=${TEMP_DIR}
local runs=${RUN_DIR}
# prepare directories
diropts -m750
dodir ${logs} ${temp}
diropts -m755
dodir ${dest}
dosym ${temp} ${dest}/tmp
dosym ${logs} ${dest}/log
echo 'export RAILS_ENV=production' > "${D}/${dest}/.profile"
# install the files using cp 'cause doins is slow
cp -Rl * "${D}/${dest}"/
# install logrotate config
dodir /etc/logrotate.d
cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF
${logs}/*.log {
missingok
delaycompress
compress
copytruncate
}
EOF
## Install gems via bundler ##
cd "${D}/${dest}"
local bundle_args="--deployment"
einfo "Running bundle install ${bundle_args} ..."
${RUBY} /usr/bin/bundle install ${bundle_args} || die "bundler failed"
# clean gems cache
rm -Rf vendor/bundle/ruby/*/cache
# fix permissions
fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs}
## RC script and conf.d file ##
local rcscript=gitlab-ci-runner.init
local rcconf=gitlab-ci-runner.conf
cp "${FILESDIR}/${rcscript}" "${T}" || die
sed -i \
-e "s|@USER@|${MY_USER}|" \
-e "s|@GITLAB_CI_RUNNER_BASE@|${dest}|" \
-e "s|@LOGS_DIR@|${logs}|" \
-e "s|@RUN_DIR@|${runs}|" \
"${T}/${rcscript}" \
|| die "failed to filter ${rcscript}"
newinitd "${T}/${rcscript}" "${MY_NAME}"
newconfd "${FILESDIR}/${rcconf}" "${MY_NAME}"
}
pkg_postinst() {
elog
elog "If this is a fresh install of GitLab CI Runner, please configure it"
elog "with the following command:"
elog " emerge --config \"=${CATEGORY}/${PF}\""
}
pkg_config() {
einfo "You need to register the runner with your GitLab CI instance. In"
einfo "order to do so, you need to know the URL of GitLab CI and the"
einfo "authentication token."
einfo
einfo "You can find the token on your GitLab CI website at"
einfo
einfo " http://<GITLAB-CI-HOST>/admin/runners"
einfo
einfo "Now please follow the instructions on the screen."
local RUBY=${RUBY:-/usr/bin/ruby}
local BUNDLE="${RUBY} /usr/bin/bundle"
su -l ${MY_USER} -c "
cd ${DEST_DIR}
${BUNDLE} exec ./bin/setup" \
|| die "failed to run ${BUNDLE} exec ./bin/setup"
}