Commit ff5ea9c5 authored by Eric Vidal's avatar Eric Vidal 💬
Browse files

update runner script

parent 9c185c76
# Copyright (c) 2015-2019 Eric Vidal <>
# All rights reserved.
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution.
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
out() {
local errno="${1}" color="${2}" msg="${@:3}"
printf "${PROG}: ${color}%s${reset}: %s\n" "${errno}" "$msg" >&1
out_trace() {
out "tracing" "${bold}" "${@}"
out_success() {
out "success" "${green}" "${@}"
out "warning" "${yellow}" "${@}"
out "fatal" "${red}" "${@}"
out_usage() {
out "usage" "${reset}" "${@}"
die() {
out_error "${@}"
exit 111
extra_pkg=( "openssh" "git" )
out_trace "Install extra packages"
pacman -Sy ${extra_pkg[@]} --noconfirm || die "Unable to install extra packages"
out_trace "Starts ssh-agent"
eval $(ssh-agent)
out_trace "Configure ssh"
mkdir -p ~/.ssh || die "Unable to create ~/.ssh directory"
echo "${ssh_private_key}"| tr -d '\r' > ~/.ssh/id_rsa
chmod 700 ~/.ssh/id_rsa || die "Unable to change permissions of ~/.ssh/id_rsa"
ssh-add ~/.ssh/id_rsa || die "Unable to add key ~/.ssh/id_rsa"
echo ${ssh_known_host} > ~/.ssh/known_hosts
out_trace "Configure git"
git config --global ${GITLAB_USER_NAME}
git config --global ${GITLAB_USER_EMAIL}
out_trace "Cd to /tmp"
cd /tmp
out_trace "Clone git@${CI_SERVER_HOST}:/${CI_PROJECT_PATH}.git"
git clone git@${CI_SERVER_HOST}:/${CI_PROJECT_PATH}.git || die "Unable to clone git@${CI_SERVER_HOST}:/${CI_PROJECT_PATH}.git"
out_trace "Cd to ${CI_PROJECT_NAME}"
out_trace "Checkout to branch ${pkg_target}"
git checkout ${pkg_target} || die "Unable to checkout to ${pkg_target}"
out_trace "Retrieve pkgver and pkgrel variables from PKGBUILD"
source trunk/PKGBUILD || die "Unable to source PKGBUILD"
out_trace "Make directory of version: ${pkgver}-${pkgrel}"
mkdir -p version/${pkgver}-${pkgrel} || die "Unable to make directory version/${pkgver}-${pkgrel}"
out_trace "Copy file from trunk to version/${pkgver}-${pkgrel}"
cp trunk/* version/${pkgver}-${pkgrel} || die "Unable to copy trunk/* to version/${pkgver}-${pkgrel}"
if ! git diff-index --quiet HEAD; then
out_trace "Git add new file"
git add . || die "Unable to git add"
out_trace "Git commit message: upgpkg: ${pkgver}-${pkgrel}"
git commit -m "upgpkg: ${pkgver}-${pkgrel}" || die "Unable to commit"
out_trace "Push the new version"
git push --all || die "Unable to push at git@${CI_SERVER_HOST}:/${CI_PROJECT_PATH}.git"
exit 0
......@@ -6,6 +6,7 @@ variables:
ssh_private_key: "$SSH_PRIVATE_KEY"
ssh_known_host: "$SSH_KNOWN_HOSTS"
pkg_target: "$CI_COMMIT_REF_NAME"
repo_conf: ".repositories.conf"
# followed variable are ignored but
# need to be set
pkg_track: "branch"
......@@ -18,10 +19,7 @@ stages:
stage: build
# you can specify the directory where find pkgbuild
# with e.g --chdir=trunk
# you can ask to install the package after a build
# e.g --install
- cp ./${repo_conf} /etc/${repo_conf}
- --chdir=trunk
......@@ -41,4 +39,4 @@ deploy:
- trunk/PKGBUILD
- ./
#SigLevel = Required
#Server =
SigLevel = Required
Server =
#SigLevel = Required
#Server =
SigLevel = Required
Server =
#SigLevel = Required
#Server =
SigLevel = Required
Server =
#SigLevel = Required
#Server =
SigLevel = Required
Server =
#SigLevel = Required
#Server =
SigLevel = Required
Server =
#Include = /etc/pacman.d/mirrorlist
Include = /etc/pacman.d/mirrorlist
Include = /etc/pacman.d/mirrorlist
#Include = /etc/pacman.d/mirrorlist
Include = /etc/pacman.d/mirrorlist
#Include = /etc/pacman.d/mirrorlist
#Include = /etc/pacman.d/mirrorlist
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment