From 0399606944c420bb712a8a0d50c19634f822e6e8 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Tue, 30 Jun 2015 02:56:42 +0200 Subject: [PATCH] implemented installing the binary runner --- dev-vcs/gitlab-ci-multi-runner/Manifest | 9 +-- .../files/gitlab-ci-multi-runner.conf | 2 - .../files/gitlab-ci-multi-runner.init | 59 ++++------------- .../gitlab-ci-multi-runner-0.4.2.ebuild | 65 +++++-------------- 4 files changed, 31 insertions(+), 104 deletions(-) delete mode 100644 dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.conf diff --git a/dev-vcs/gitlab-ci-multi-runner/Manifest b/dev-vcs/gitlab-ci-multi-runner/Manifest index 7294cc7..606e92c 100644 --- a/dev-vcs/gitlab-ci-multi-runner/Manifest +++ b/dev-vcs/gitlab-ci-multi-runner/Manifest @@ -1,4 +1,5 @@ -AUX gitlab-ci-multi-runner.conf 78 SHA256 3b9e4f922ff53cc57c4c883dd19c1343b2a61ceba7bef303d623aedc5d2651cd SHA512 af0b725e3eea789776962a085f53d8787f91b1c8bdd7aad76aeedad2304885ac890c81d95126ad5de2590ef2b0c93045d4ba50f8bc2ba7e0caeec3b27fa4f6f7 WHIRLPOOL 10563abf39449389e9cf53076fd21a106f555e58b708b679c9cc91213ec0319a7b0dfa15977c187ceedb9a2f7c060424f66891472a2e8e8ca78262e628e05968 -AUX gitlab-ci-multi-runner.init 1569 SHA256 8c5166b6919e42e7130b2e782adff2d53dbafafee29b444cd06e609e193b09f1 SHA512 84ca9fca9c28a7c62a416166f2ca85b57a97432b043ba50f74193ba93416567d99103b23f9e154b310a902449737198e504c2d2f0732504f2ab34dc6b7f28407 WHIRLPOOL f7dac1e2cc24b9637d860a0ab29081ea1cc2f63e4422e07b1294092885146ecb869c2d6ac8e057068b0a108a8fbe385b4d12314a2db50587fcb7b67fdb2e9d03 -DIST gitlab-ci-multi-runner-0.4.2.tar.gz 404292 SHA256 ca3c5e98017d55c7fb7397708332c7e2843b6db614cd21b820b5713718026797 SHA512 6131b6f420acc57083d6659c5b825f9f655f719cb38664933746c896ef79520189f9b160121466eedd901b5197f1bc7f85b993920d3cd42696940b33a576af80 WHIRLPOOL e9e09481694980a8f3c33dc41dc20de4fbbfc4729350cc1f087679544048ae453714e8b3c87038b1071a2c2266560926bbbda74a97296368879bda57542c5272 -EBUILD gitlab-ci-multi-runner-0.4.2.ebuild 3225 SHA256 44b6408c4a211d329bb6eeeb1ff0f50b2cda79334a9dc6c6697285b21b7d3264 SHA512 77280f574a972540899a149f52e07d8ec554163caf561c76e3026c6fb0673f2a8147d2cd7d564d9e8df3afb7462b5d910cb33da857584007da15492c6f5c8818 WHIRLPOOL a1cc329c74f9a4e976b719dadc5afc6744dbc60f752dae7ff766a9f1fc9a381fb3e06107cfc2a543e78e4cb73af9cbcfb2c3c85b953553226300694cbbdb4389 +AUX gitlab-ci-multi-runner.init 614 SHA256 911adb1f9513890a0b77a31902a32def106c74fcb28013764e745cf4c6b6b9d2 SHA512 e6ede98bb586233c4257f6e174d240905d8a1be71dfe2cd07fa0d79fba6d413c1382bfb70b958be06da1030034d142dd740eb61131c766e55f37770d14088383 WHIRLPOOL f553fd87c05d3693738f4f3169d9a3361231339c013435043137afe9349026f43df03c8e9a7d72165337310a77470ceb9895bccde17ab0128abd581cb574ee15 +DIST gitlab-ci-multi-runner-amd64 11164760 SHA256 f4eebcab008314cdca686c81ce54077a5ffebc47638ce7359d1982b0f27a6796 SHA512 b150515f7da2863974dd9213e5bf4144aee5b039cabaef8790cc8963ded4afecaf23375e8e78d1941b3d4a4cf024cc99846f4a1dcf2922fe9528feeab6a0c187 WHIRLPOOL 2190567da88614b8497046e9578981b1bbfc80fd67f60e5d50497a561f19f4281e66dda20a9863e479e02dec1f8458a01e5c71a7a58f89ebcc8c071f2917e107 +DIST gitlab-ci-multi-runner-arm 8940328 SHA256 4e13b2a2c3ea47d8f3bf9a946717b1a1655bd17955c88ea112d88aaa4f3bcbb9 SHA512 8108c3240f29a951fcfb1502cbb4db2bb82053481ca8212f26402078cf98637ed663f7adeeaca696b6fb67bac875673bd40c57074f6e94ffb6dfa99d13d26964 WHIRLPOOL 0e9948de75ad5d4aa81d417456dc8d6275a0355f0e976476e551c4c7acd611f5aea8fba765d2df51a282ba55a67a25dbe76328c52ad79814d9b29fa004629e46 +DIST gitlab-ci-multi-runner-x86 8981664 SHA256 be900402515f2c7739566ae39817b9a9f1a5a3418329353edd4d2f2bfbf77d7f SHA512 21884ce24efab2c5954d0b2d8fb5dbeb4d55cfe12143bf338ea58cddc6ef5b23eea6bb3b12290454f42854636155d985a213d4a487f0fbaa7f1e21e1f5a5ac2d WHIRLPOOL 838d7fc935031925e9ce62cf034d4b73450252c253f2e7db2944fe2dcd187babacd46c70f9657fa7995a911b77ffa0cc250acb295d9b5a074171072472e06386 +EBUILD gitlab-ci-multi-runner-0.4.2.ebuild 2259 SHA256 394cacff5bee1cd321151c5b3fc1c04da928ee1dd09713680e7385abbffe0319 SHA512 a9b7bf551a9a29417f0a1724e515e47973e6d964d6b5afb7a63337c6760048e1c52efc08df5a08858bba05ee6a734b34d45945f82b4785d9bb0e5c91c9bb058b WHIRLPOOL 98e63b26a69e9741ac443896f7bccb96c52fadad4c424f89007469d45e6386c567090ba877b9989ec1d4f9d77d5ea18bc5d73016000af49b0b27e924e1e4c8d0 diff --git a/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.conf b/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.conf deleted file mode 100644 index 52d32e9..0000000 --- a/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.conf +++ /dev/null @@ -1,2 +0,0 @@ -# specify the number of runners to spawn. Default: 1 -# gitlab_ci_runner_num=1 diff --git a/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.init b/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.init index ef6a452..8a8f0eb 100644 --- a/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.init +++ b/dev-vcs/gitlab-ci-multi-runner/files/gitlab-ci-multi-runner.init @@ -1,58 +1,21 @@ #!/sbin/runscript - -name="GitLab CI Multi Runner" -description="GitLab CI Multi Runner, starts runners in the background" - -: ${gitlab_ci_runner_user:=@USER@} -: ${gitlab_ci_runner_base:="@GITLAB_CI_RUNNER_BASE@"} -: ${gitlab_ci_runner_pidfile_base:="@RUN_DIR@/gitlab-ci-runner.pid"} -: ${gitlab_ci_runner_logfile:="@LOGS_DIR@/gitlab-ci-runner.log"} -: ${gitlab_ci_runner_num:=1} # number of runners to spawn - -bundle_command="/usr/bin/bundle" -bundle_command_args="exec ./bin/runner" +# Copyright 2015 Nicolas Heine depend() { - provide gitlab-ci-multi-runner + after sshd + need net + need localmount } start() { - ebegin "Starting ${name}" - - for (( i=1; i<=${gitlab_ci_runner_num}; i++ )) ; do - einfo "Starting runner ${i} of ${gitlab_ci_runner_num} ..." - local pidfile="${gitlab_ci_runner_pidfile_base}${i}" - checkpath -d -o ${gitlab_ci_runner_user} -m755 "$(dirname "${pidfile}")" - start-stop-daemon --start \ - --chdir "${gitlab_ci_runner_base}" \ - --user=${gitlab_ci_runner_user} \ - --make-pidfile \ - --pidfile="${pidfile}" \ - --background \ - --exec /bin/bash -- -c "exec ${bundle_command} ${bundle_command_args} >> ${gitlab_ci_runner_logfile} 2>&1" - local success=$? - if [ ${success}!=0 ] ; then - eend ${success} - fi - done - - eend 0 + ebegin "Starting gitlab-ci-multi-runner" + start-stop-daemon --start -b -u @USER@ --chdir /var/tmp/gitlab-ci-multi-runner --pidfile /var/run/gitlab-ci-multi-runner.pid -1 /dev/null -2 /dev/null --make-pidfile \ + --exec /opt/gitlab-ci-multi-runner/gitlab-ci-multi-runner -- run + eend $? } stop() { - ebegin "Stopping ${name}" - - for (( i=1; i<=${gitlab_ci_runner_num}; i++ )) ; do - einfo "Stopping runner ${i} of ${gitlab_ci_runner_num} ..." - local pidfile="${gitlab_ci_runner_pidfile_base}${i}" - start-stop-daemon --stop \ - --pidfile="${pidfile}" -# DO WE NEED --exec? or --startas??? - local success=$? - if [ ${success}!=0 ] ; then - eend ${success} - fi - done - - eend 0 + ebegin "Stopping gitlab-ci-multi-runner" + start-stop-daemon --stop --pidfile /var/run/gitlab-ci-multi-runner.pid + eend $? } diff --git a/dev-vcs/gitlab-ci-multi-runner/gitlab-ci-multi-runner-0.4.2.ebuild b/dev-vcs/gitlab-ci-multi-runner/gitlab-ci-multi-runner-0.4.2.ebuild index 0b94a5c..3686f92 100644 --- a/dev-vcs/gitlab-ci-multi-runner/gitlab-ci-multi-runner-0.4.2.ebuild +++ b/dev-vcs/gitlab-ci-multi-runner/gitlab-ci-multi-runner-0.4.2.ebuild @@ -4,18 +4,13 @@ EAPI="5" -#USE_RUBY="ruby19 ruby20 ruby21" -#PYTHON_DEPEND="2:2.7" - -#inherit eutils python ruby-ng user inherit eutils user DESCRIPTION="GitLab CI Multi Runner is the new build processor needed for GitLab CI >= 7.12" HOMEPAGE="https://gitlab.com/gitlab-org/gitlab-ci-multi-runner" -SRC_URI="https://gitlab.com/gitlab-org/${PN}/repository/archive.tar.gz?ref=${PV} -> ${P}.tar.gz" -#"x86? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-386 -> ${PN}-x86 ) -# amd64? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-amd64 -> ${PN}-amd64 ) -# arm? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-arm -> ${PN}-arm )" +SRC_URI="x86? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-386 -> ${PN}-x86 ) + amd64? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-amd64 -> ${PN}-amd64 ) + arm? ( https://${PN}-downloads.s3.amazonaws.com/${PV}/binaries/${PN}-linux-arm -> ${PN}-arm )" RESTRICT="mirror" @@ -27,90 +22,60 @@ KEYWORDS="~amd64 ~x86" IUSE="amd64 arm x86" DEPEND="dev-vcs/git" -CDEPEND="dev-lang/go" RDEPEND="${DEPEND} virtual/mta" MY_NAME="${PN}" -MY_USER="gitlab_ci_runner" +MY_USER="gitlab_ci_multi_runner" DEST_DIR="/opt/${MY_NAME}" LOGS_DIR="/var/log/${MY_NAME}" TEMP_DIR="/var/tmp/${MY_NAME}" RUN_DIR="/run/${MY_NAME}" -S="${WORKDIR}/${PN}.git" - pkg_setup() { enewgroup ${MY_USER} enewuser ${MY_USER} -1 /bin/bash ${DEST_DIR} ${MY_USER} - export GOPATH="${WORKDIR}" } -#src_unpack() { -# local a="$(usev amd64)$(usev arm)$(usev x86)" -# mkdir -p "${S}" -# cp "${DISTDIR}/${PN}-${a}" "${S}/${PN}" -#} +src_unpack() { + local a="$(usev amd64)$(usev arm)$(usev x86)" + mkdir -p "${S}" + cp "${DISTDIR}/${PN}-${a}" "${S}/${PN}" +} src_prepare() { - git init + chmod +x "${S}/${PN}" } src_compile() { - emake deps build || die "Failed to make deps build" + # nothing to compile, binary all-in-one goodness! (?) + : } src_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 - - # install the files using cp 'cause doins is slow - cp -Rl "${S}/"* "${D}/${dest}/" - - # install logrotate config -# dodir /etc/logrotate.d -# cat > "${D}/etc/logrotate.d/${MY_NAME}" <<-EOF -# ${logs}/*.log { -# missingok -# delaycompress -# compress -# copytruncate -# } -# EOF + exeinto ${dest} + doexe "${S}/${PN}" # fix permissions fowners -R ${MY_USER}:${MY_USER} ${dest} -# fowners -R ${MY_USER}:${MY_USER} ${dest} ${temp} ${logs} - ## RC script and conf.d file ## + ## RC script ## local rcscript=gitlab-ci-multi-runner.init - local rcconf=gitlab-ci-multi-runner.conf cp "${FILESDIR}/${rcscript}" "${T}" || die sed -i \ -e "s|@USER@|${MY_USER}|" \ - -e "s|@GITLAB_CI_MULTI_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() {