%global goipath gitlab.com/gitlab-org/gitlab-runner %global commit de7731dd40f8e65738ac1452c13e8636dc3453c6 %global archivename gitlab-runner-%{commit} %global common_description %{expand: GitLab Runner is the open source project that is used to run your jobs and send the results back to GitLab. It is used in conjunction with GitLab CI, the open-source continuous integration service included with GitLab that coordinates the jobs.} %gometa Name: gitlab-runner Version: 12.1.0 Release: 1%{?dist} Summary: Run tests on gitlab-ci License: MIT URL: %{gourl} Source0: %{gosource} %description %{common_description} %prep %forgesetup %build %gobuildroot %gobuild -o _bin/gitlab-runner %{goipath} %install install -Dpm 0755 _bin/gitlab-runner %{buildroot}%{_bindir}/gitlab-runner %post #!/bin/sh set -e # detect user: first try to use gitlab_ci_multi_runner for USER in gitlab_ci_multi_runner gitlab-runner; do if id -u "$USER" >/dev/null 2>/dev/null; then break fi done # create user if doesn't exist: it will create gitlab-runner if not found if ! id -u "$USER" >/dev/null 2>/dev/null; then useradd --system --shell /bin/bash --comment 'GitLab Runner' --create-home $USER fi # get USER home directory eval HOMEDIR=~$USER # create empty config and re-register runner mkdir -p /etc/gitlab-runner chmod 0700 /etc/gitlab-runner if [ -f $HOMEDIR/config.toml ] && [ ! -f /etc/gitlab-runner/config.toml ]; then cp $HOMEDIR/config.toml /etc/gitlab-runner/config.toml chmod 0600 /etc/gitlab-runner/config.toml fi # uninstall old service if gitlab-runner status --service="gitlab-runner"; then gitlab-runner stop --service="gitlab-runner" >/dev/null 2>/dev/null || : gitlab-runner uninstall --service="gitlab-runner" >/dev/null 2>/dev/null || : fi # re-register runner gitlab-runner stop >/dev/null 2>/dev/null || : gitlab-runner uninstall >/dev/null 2>/dev/null || : gitlab-runner install --user=$USER --working-directory=$HOMEDIR # start runner service gitlab-runner start || : %preun #!/bin/sh gitlab-runner stop >/dev/null 2>/dev/null gitlab-runner uninstall >/dev/null 2>/dev/null exit 0 %files %license LICENSE %doc README.md %{_bindir}/gitlab-runner %changelog * Fri Jul 19 2019 Christopher Brown - 12.1.0 - Bump to 12.1.0 * Wed Jul 17 2019 Christopher Brown - 12.0.2 - Bump to 12.0.2 * Sun Mar 03 2019 Emiel Wiedijk - 11.8.0 - Initial RPM release