From nobody Sun Feb 8 15:30:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1586406228; cv=none; d=zohomail.com; s=zohoarc; b=lkT4LSz8ezhYhYFxCXlZ5iUpH92ackPQzHiJKwPp9sRpMyJx6yt8XXMh5p1t+UVgl9fxMdchdvK7wDz+Q9k0mhnl8q3kQTm2QOVgs6i4fdCNLZUtyjNO7hqbr8AqHKUv3Z3YyU8wVd7E+WLP8ZqqkFussYOOvqi8ewveUT2GJlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586406228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xet1ZxDE4+p/4U0uy62HA46+X0loF0/ELpnxWkPPJkc=; b=mwYnC1YsTrUN+x+qkYFp0/t1gGxk4OsRbdKjyFX2oyZKedT2AoXC1WHvhD/2H/ITflzIrAyTAx7303lWAWMlOTB+PXn/isShHSLmSHFTPMIkCwSwf7gYg1f74Yf/fmdnzPj7EfewN90r2w79ARkkORe+RZVsNbG6BuQ+0tCNcmc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586406228865410.54506772344996; Wed, 8 Apr 2020 21:23:48 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-ZXi-gPo1Ndmmww2km4bnqQ-1; Thu, 09 Apr 2020 00:23:45 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 737AD1137858; Thu, 9 Apr 2020 04:23:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4971160FC2; Thu, 9 Apr 2020 04:23:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 01F9A93020; Thu, 9 Apr 2020 04:23:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0394NPe1029665 for ; Thu, 9 Apr 2020 00:23:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1D19B9DD80; Thu, 9 Apr 2020 04:23:25 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 597219DD73; Thu, 9 Apr 2020 04:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586406227; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xet1ZxDE4+p/4U0uy62HA46+X0loF0/ELpnxWkPPJkc=; b=WqJicG+RFIwWYfFr70RamA/+t2nWoHJ5uwLNp+im3NWsKR3twd90Lu5WisEYovZWrFVVdO Vl5WxDnqkIM03PeORiZekrhx/zTAUkckfR5KChTrFAEFmf+b1cA/i+rUdPxELTOjsD1xXS DJSLNCxSrMC3njqiexBVgZSK0L7aI7k= X-MC-Unique: ZXi-gPo1Ndmmww2km4bnqQ-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v3 4/5] guests: Introduce the new 'gitlab' flavor Date: Thu, 9 Apr 2020 06:23:15 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" With the recent efforts in upstream libvirt to centralize our CI on gitlab, let's add a new gitlab-specific flavor along with related playbook tasks. This flavour revolves around installing and configuring the gitlab-runner agent binary which requires the per-project registration token to be specified in order for the runner to be successfully registered with the gitlab server. Note that as part of the registration process each runner acquires a new unique access token. This means that we must ensure that the registration is run only on the first update, otherwise a new runner with a new access token is registered with the gitlab project. Signed-off-by: Erik Skultety --- guests/playbooks/update/main.yml | 5 ++ guests/playbooks/update/tasks/gitlab.yml | 58 ++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 guests/playbooks/update/tasks/gitlab.yml diff --git a/guests/playbooks/update/main.yml b/guests/playbooks/update/mai= n.yml index a5a4de8..371e53d 100644 --- a/guests/playbooks/update/main.yml +++ b/guests/playbooks/update/main.yml @@ -58,3 +58,8 @@ - include: '{{ playbook_base }}/tasks/jenkins.yml' when: - flavor =3D=3D 'jenkins' + + # Install the Gitlab runner agent + - include: '{{ playbook_base }}/tasks/gitlab.yml' + when: + - flavor =3D=3D 'gitlab' diff --git a/guests/playbooks/update/tasks/gitlab.yml b/guests/playbooks/up= date/tasks/gitlab.yml new file mode 100644 index 0000000..1f75d98 --- /dev/null +++ b/guests/playbooks/update/tasks/gitlab.yml @@ -0,0 +1,58 @@ +--- +- name: Define gitlab-related facts + set_fact: + gitlab_url: '{{ lookup("file", gitlab_url_file) }}' + gitlab_runner_secret: '{{ lookup("file", gitlab_runner_token_file) }}' + gitlab_runner_download_url: https://gitlab-runner-downloads.s3.amazona= ws.com/latest/binaries/gitlab-runner-{{ ansible_system|lower }}-amd64 + gitlab_runner_config_dir: '/etc/gitlab-runner' + +- name: Download gitlab-runner agent + get_url: + url: '{{ gitlab_runner_download_url }}' + dest: /usr/local/bin/gitlab-runner + mode: '0755' + force: yes + +- name: Register the gitlab-runner agent + shell: 'gitlab-runner register --non-interactive --config "{{ gitlab_run= ner_config_dir }}/config.toml" --registration-token "{{ gitlab_runner_secre= t }}" --url "{{ gitlab_url }}" --executor shell --tag-list "{{ os_name|lowe= r }}-{{ os_version }}"' + args: + creates: '{{ gitlab_runner_config_dir }}/config.toml' + +- name: Make {{ gitlab_runner_config_dir }} world readable + file: + path: '{{ gitlab_runner_config_dir }}' + mode: '0755' + +- name: Make {{ gitlab_runner_config_dir }}/config.toml world readable + file: + path: '{{ gitlab_runner_config_dir }}/config.toml' + mode: '0644' + +- block: + - name: Install the gitlab-runner service unit + template: + src: '{{ playbook_base }}/templates/gitlab-runner.service.j2' + dest: /etc/systemd/system/gitlab-runner.service + + - name: Enable the gitlab-runner service + systemd: + name: gitlab-runner + state: started + enabled: yes + daemon_reload: yes + when: ansible_service_mgr =3D=3D 'systemd' + +- block: + - name: Install the gitlab_runner rc service script + template: + src: '{{ playbook_base }}/templates/gitlab-runner.j2' + dest: '/usr/local/etc/rc.d/gitlab_runner' + mode: '0755' + + - name: Enable the gitlab-runner rc service + service: + name: gitlab_runner + state: started + enabled: yes + when: ansible_service_mgr !=3D 'systemd' + --=20 2.25.1