From nobody Mon Feb 9 06:05:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1586259105; cv=none; d=zohomail.com; s=zohoarc; b=V/0AkaUScFtR/fUHjFXSxBfTE5s46FL2v/POvSzxngCbgerr3Y+xTWiJEOHEQHGZOY1o/dShiWV04SqCDqbjNvwPMcoXfYMXBidta5b/eSQxPyaGWG5xYlDtRZBOgLPuOQ2FZvOnhqbtriLK9ZDCdUnz9A3cm5k0NTGtm85kCOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586259105; 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=loHzVnQkDRRTBh0gTyqO62UF8/RoDMTI2UGBLPGJyeg=; b=nBDhJMW3B2+xJOxJi6d4wd++g1Ev1dH8slgbXfgHpmGuQaBp1sjdg/n74f2w5vkt1ywwtiNW+DRYRGltkytiN5xCeDJMZnrqQT0cOa8m2BZsApf31VEQRkz2MavExoMlfTWvK/KlA3MnP1gbsD0KUPgri6qq60EaPMIicFsmiOM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1586259105229922.1972630750632; Tue, 7 Apr 2020 04:31:45 -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-454-UvGsVoTWPTKs_I2ZE9N08w-1; Tue, 07 Apr 2020 07:31:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8092B8017FE; Tue, 7 Apr 2020 11:31:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57ED45DA7C; Tue, 7 Apr 2020 11:31:36 +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 0A46F18095FF; Tue, 7 Apr 2020 11:31:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 037BVV55005412 for ; Tue, 7 Apr 2020 07:31:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A910118F24; Tue, 7 Apr 2020 11:31:31 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.193.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 700EAD766D; Tue, 7 Apr 2020 11:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586259104; 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=loHzVnQkDRRTBh0gTyqO62UF8/RoDMTI2UGBLPGJyeg=; b=Hsun5jM+Ema0l6eRUxju/kdxPyWavTKP1PWOGrQOSyrZMFiAHK5SWF0cAFyGvcOpxpFwG0 9BQCvE2DE1RzScq4En94rnYRLzjlQPtcv5W54sAxej958kjfihJXWG/6dTvgfg97yFg1Ov NmhMWpFKNxuAsToGCwWFTc6FBfh0vgc= X-MC-Unique: UvGsVoTWPTKs_I2ZE9N08w-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v2 5/6] guests: Introduce the new 'gitlab' flavor Date: Tue, 7 Apr 2020 13:31:20 +0200 Message-Id: <978499188c0db30d7922882dd559c86753d91cf6.1586259071.git.eskultet@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.14 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 | 52 ++++++++++++++++++++++++ 2 files changed, 57 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..b8f731d --- /dev/null +++ b/guests/playbooks/update/tasks/gitlab.yml @@ -0,0 +1,52 @@ +--- +- 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_path: '/home/gitlab/.gitlab-runner/config.toml' + +- name: Download gitlab-runner agent + get_url: + url: '{{ gitlab_runner_download_url }}' + dest: /home/gitlab/bin/gitlab-runner + owner: gitlab + group: gitlab + mode: '0775' + force: yes + +- name: Register the gitlab-runner agent + become: true + become_user: gitlab + shell: '/home/gitlab/bin/gitlab-runner register --non-interactive --conf= ig {{ gitlab_runner_config_path }} --registration-token {{ gitlab_runner_se= cret }} --url {{ gitlab_url }} --executor shell --tag-list {{ inventory_hos= tname }}' + args: + creates: '{{ gitlab_runner_config_path }}' + +- 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