From nobody Tue May 14 23:37:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1586406217; cv=none; d=zohomail.com; s=zohoarc; b=eMbulyfWzxaL8oHs97/p6588bThs9g3Mixob6Ja/WhZKpr0TXvXTQHMOx5xOwLLr3L/E6CkHDjVU1Qjt6Yj0eOIqcMKTrkx7i5SK2HtP/uWfR9T7U7Am0F3MWyCUhbhcAUh5dpNu0STa6M+sRZ7/PeDMx6JiNQMAlhNkDKWUTlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586406217; 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=Je1O0sTo/Ns34PPqakkZlSvM3IX/A/rBs5dLFay0jUw=; b=ROAcsvhRJKasqcGHWot4sUZ/CKSH+SSEP+KmmVQiaGKYu4j4ajxtLiLlwZ5Ay2O8yA8BW1YE+gLqSPWduINOx5N1MkY9erXNvTxWbGtqKVJRJyCISvPlzqshHSGxCgvTp6nJi0LTTPtvJIbr/J2c6ntqbmf+HuNhJ6xT/DTarRk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 158640621740883.49251617659809; Wed, 8 Apr 2020 21:23:37 -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-337--kukrvsiMbuhPVaNnIWEOg-1; Thu, 09 Apr 2020 00:23:34 -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 754041005513; Thu, 9 Apr 2020 04:23:27 +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 CB4EF60C80; Thu, 9 Apr 2020 04:23:26 +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 2133393A9B; Thu, 9 Apr 2020 04:23:23 +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 0394NL3Y029639 for ; Thu, 9 Apr 2020 00:23:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id B83C19DD82; Thu, 9 Apr 2020 04:23:21 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id C54609DD73; Thu, 9 Apr 2020 04:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586406216; 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=Je1O0sTo/Ns34PPqakkZlSvM3IX/A/rBs5dLFay0jUw=; b=c5qu4m2Felt3p0PNWWVwoFsad8yPtb0/QX/u+vbGzVurZ6qIudify8V8Rz8VYpIjkkmCEX rcZ3/EIu1fCj4d/nQ/Gql6XrHuP9ZlCJR2UNkFQ0+PQ2DEXyjETIXl3EHJN5ql7IYUTt4P aZ4V/eilMglNN0kRO+pX8JsejNGLGPk= X-MC-Unique: -kukrvsiMbuhPVaNnIWEOg-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v3 1/5] guests: users: Discard the .bash_logout skeleton file Date: Thu, 9 Apr 2020 06:23:12 +0200 Message-Id: <875f7f1fcbd74b71ea14627d8c8006a410472122.1586406166.git.eskultet@redhat.com> 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: Andrea Bolognani , 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" As part of the users tasks, we remove the .profile file after we create our own .bash_profile. As part of that effort, let's remove the .bash_logout skeleton file as well, the reason being gitlab's runner agent which has a hard time initializing a build environment on Debian where the system populates the .bash_logout with console cleaning code which messes up the runner and causes the build to fail instantly [1]. Since Debian is the only distro actually populating the file and the machines are assumed to be accessed over SSH, we can safely drop it. [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/4449 Signed-off-by: Erik Skultety Reviewed-by: Andrea Bolognani --- guests/playbooks/update/tasks/users.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/upd= ate/tasks/users.yml index 30e5fca..a07349f 100644 --- a/guests/playbooks/update/tasks/users.yml +++ b/guests/playbooks/update/tasks/users.yml @@ -63,9 +63,10 @@ - bash_profile - bashrc =20 -- name: '{{ flavor }}: Remove existing shell profile' +- name: '{{ flavor }}: Remove unnecessary home skeleton files' file: path: /home/{{ flavor }}/.{{ item }} state: absent with_items: - profile + - bash_logout --=20 2.25.1 From nobody Tue May 14 23:37:51 2024 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=LfmRqdSucYWGgEINqvi/neY79Kk6Hkw9O5V0dJrJfxCmyq/ANNSM2dcDOoPlnAJFtaHIyadU9jt5YUyF1upT97r4A4DUfBm5yCo2a4C/aqfpMLoQfGrOMTDqZFCPABNFBf+ZcaBcBZKXtQEcTWEdkLUiGAG0W4mxBVugWA25zqM= 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=B13WKW1XiBDHkqOIc6E3yPu7WYcyVdS1Jel9NJG+Jkg=; b=lewQzZmR7bU1V/sE3K2ZTzOyLOoZ5TbiYpU8oaCyxaW0EHKCCuCPHCxPX8YNAXp0mHQUf8tsmvl3yOmbsKk/IM1cbKjfCXyltkAS8VKRgmzqaDG24qa6+9i86sFRYWIxmLmMn4nFMbmVXulSnbHmg06Y68jrn7UiKMqLd40TsZ8= 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 1586406228495133.44127508725; 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-431-qOL0QXEWNoKPQKyfHgYcVw-1; Thu, 09 Apr 2020 00:23:45 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52C9C1137855; Thu, 9 Apr 2020 04:23:39 +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 C20875C1C5; Thu, 9 Apr 2020 04:23:38 +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 828CD18089CE; Thu, 9 Apr 2020 04:23:38 +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 0394NMTw029649 for ; Thu, 9 Apr 2020 00:23:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id D7A439DD80; Thu, 9 Apr 2020 04:23:22 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E90B9DD73; Thu, 9 Apr 2020 04:23:21 +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=B13WKW1XiBDHkqOIc6E3yPu7WYcyVdS1Jel9NJG+Jkg=; b=MpZW2CwpIc1JHLaB2c6ALEGGu6gXrbZe7Zf8SVPKgecRj66zd99bZKc7/j4BIIN7LT830G 7oQCLAlP4C6KVESB2PcI2aSCEvsNEJT/86Yzi6CGErXYK/2lH6UmqSc2qXx7zkwanr/LQ7 Ml3Nj5KjNnonG7msJ4g2rnwnKBqKvuk= X-MC-Unique: qOL0QXEWNoKPQKyfHgYcVw-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v3 2/5] guests: templates: Introduce a gitlab-runner systemd service template Date: Thu, 9 Apr 2020 06:23:13 +0200 Message-Id: <20ae3fcbf2170ad6f4e44f0f9fb28908f9b5b92d.1586406166.git.eskultet@redhat.com> 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.16 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" Signed-off-by: Erik Skultety --- .../update/templates/gitlab-runner.service.j2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 guests/playbooks/update/templates/gitlab-runner.service= .j2 diff --git a/guests/playbooks/update/templates/gitlab-runner.service.j2 b/g= uests/playbooks/update/templates/gitlab-runner.service.j2 new file mode 100644 index 0000000..9c3adc0 --- /dev/null +++ b/guests/playbooks/update/templates/gitlab-runner.service.j2 @@ -0,0 +1,14 @@ +[Unit] +Description=3DGitLab Runner +After=3Dnetwork.target +ConditionFileIsExecutable=3D/usr/local/bin/gitlab-runner + +[Service] +User=3Dgitlab +WorkingDirectory=3D/home/gitlab +ExecStart=3D/usr/local/bin/gitlab-runner run --config /etc/gitlab-runner/c= onfig.toml +Restart=3Dalways + +[Install] +WantedBy=3Dmulti-user.target + --=20 2.25.1 From nobody Tue May 14 23:37:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1586406218; cv=none; d=zohomail.com; s=zohoarc; b=n1/b42mtQ1IqQR8an4DyXZkFYIEsiC6YwZ9oPWXO7/RlwEMPZjBHcfQp/ac0xlgDAquzTZWOwfONatxIYw/EvBLzW8ueYpo6gIbzG6abzvxvxy518fiQ0pySYrlWBqBfwh/qm/9vpEP4oD7Bo/yrjTE2FGj9rEg78Ro+q3rdPwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586406218; 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=9cePSrVm6oHec1+Cv4wlSUn+8yT14Kl/S6Gv/uUjGpI=; b=Ngb+najsqahszdVMuHtuC6VMbqZoeK6WaKyDT1DNqSFJbznzKHBN7E+1DLyWVGFokBvjb8pqJcT905FlPZUXQwYF5T+0B3LEecVkz7UqQ93C9pA1ZOkxehe7iqdRTxSJ6r9J/7Dcl1YxPfsf4fAmyet3DoOfweNDt0H3tNK19N0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586406218920710.274785252035; Wed, 8 Apr 2020 21:23:38 -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-292-RI3JCDr3MdatvZOF9OjhEQ-1; Thu, 09 Apr 2020 00:23:33 -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 74A5C8017FE; Thu, 9 Apr 2020 04:23:27 +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 3700D60C84; Thu, 9 Apr 2020 04:23:27 +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 9969718089C8; Thu, 9 Apr 2020 04:23:25 +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 0394NOHb029659 for ; Thu, 9 Apr 2020 00:23:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 013729DD82; Thu, 9 Apr 2020 04:23:24 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C8619DD73; Thu, 9 Apr 2020 04:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586406217; 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=9cePSrVm6oHec1+Cv4wlSUn+8yT14Kl/S6Gv/uUjGpI=; b=aEIqONha9NfL8nsEt+OHX1aeY7Bfq7f+MLM7CsxGcSj1kS0cHQZbcS9LLk3EpzZz0HthIE zM8cedw1JUkvbGJ51+5cUcRp/U5cTdd8BeLlWLyYsGHzOWKXTQQfA7clUriCpDTTVRmUyA F+qLiFCjXGfJLHxPfGtOfNPi4/n66Lc= X-MC-Unique: RI3JCDr3MdatvZOF9OjhEQ-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v3 3/5] guests: templates: Introduce a gitlab-runner RC init service template Date: Thu, 9 Apr 2020 06:23:14 +0200 Message-Id: <4b7594eabffc73be6a10fd33bb2305b558e47729.1586406166.git.eskultet@redhat.com> 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" Based on https://docs.gitlab.com/runner/install/freebsd.html#installing-git= lab-runner Signed-off-by: Erik Skultety Reviewed-by: Andrea Bolognani --- .../update/templates/gitlab-runner.j2 | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 guests/playbooks/update/templates/gitlab-runner.j2 diff --git a/guests/playbooks/update/templates/gitlab-runner.j2 b/guests/pl= aybooks/update/templates/gitlab-runner.j2 new file mode 100644 index 0000000..4c40c23 --- /dev/null +++ b/guests/playbooks/update/templates/gitlab-runner.j2 @@ -0,0 +1,31 @@ +#!/bin/sh +# PROVIDE: gitlab_runner +# REQUIRE: DAEMON NETWORKING +# BEFORE: +# KEYWORD: + +. /etc/rc.subr + +name=3D"gitlab_runner" +rcvar=3D"gitlab_runner_enable" + +user=3D"gitlab" +user_home=3D"/home/gitlab" +command=3D"/usr/local/bin/gitlab-runner" +command_args=3D"run --config /etc/gitlab-runner/config.toml" +pidfile=3D"/var/run/${name}.pid" + +start_cmd=3D"gitlab_runner_start" + +gitlab_runner_start() +{ + export USER=3D${user} + export HOME=3D${user_home} + if checkyesno ${rcvar}; then + cd ${user_home} + /usr/sbin/daemon -u ${user} -p ${pidfile} ${command} ${command_args} >= /var/log/gitlab-runner.log 2>&1 + fi +} + +load_rc_config $name +run_rc_command $1 --=20 2.25.1 From nobody Tue May 14 23:37:51 2024 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 From nobody Tue May 14 23:37:51 2024 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=1586406231; cv=none; d=zohomail.com; s=zohoarc; b=PWM2k87DEZx3bNOlZoKc+zfv+5VEkoxuvP5bTm4oLGYkZn+8JztOhC9BDAg12DyU3RiCUfdSO8tXTl3QejxXN6c5XsZjulelViNM43QPhXmzu79zmrM1PBEOLCNNhhgPFNgOcVENFjwr2tMkFN4F9DN+5pIqUQZEP9/EaAfmE+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586406231; 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=c482ico4yPyOEEui+QDHrl3VtE5w/kUMp6Cxkr8PECA=; b=A2rdDgjRNCNpbR2RWJRSDnRM+l18D6HSaGIpvve2oo/kejkYJT4PoTDaD5wTxmOdwaLLBLwTPq+2QOBZeH9nKFhVNYOUbHLsYaPsguBWmTwP4LzA/jN3rJd+oK6MgBzm9GIAngl/n1sFmCS/BNWzC3+tNrKKmoCTljSfQTaD5XE= 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 158640623185376.58002998532447; Wed, 8 Apr 2020 21:23:51 -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-125-m02zqzRpN3KEgaaX52G5ew-1; Thu, 09 Apr 2020 00:23:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB69A13FF; Thu, 9 Apr 2020 04:23:42 +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 BD5AE5C545; Thu, 9 Apr 2020 04:23:42 +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 768F918089D0; Thu, 9 Apr 2020 04:23:42 +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 0394NQZp029678 for ; Thu, 9 Apr 2020 00:23:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3927D9DD80; Thu, 9 Apr 2020 04:23:26 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75F299DD8A; Thu, 9 Apr 2020 04:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586406230; 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=c482ico4yPyOEEui+QDHrl3VtE5w/kUMp6Cxkr8PECA=; b=iowICNW15d2cmAQT4JG6GVAYNXhUx/mWhfHxhTkeaQ8GLGXZUPxqcbpabKfZ0oxVn+ll5Q YKVyWXwlmgizok3mqdKDbQracwJ7yc4md/s4y1wWgGz6iF0zdmOc352kiYi0XXXuEKrSC0 1/1sVTxO5Tils2bQ7IvQ0d6Sobj31HU= X-MC-Unique: m02zqzRpN3KEgaaX52G5ew-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v3 5/5] guests: lcitool: Enable the new 'gitlab' flavor in the lcitool script Date: Thu, 9 Apr 2020 06:23:16 +0200 Message-Id: <1f3cc8da2c1fb1f3c4a5a6c05bf15ab4c1f0e6d3.1586406166.git.eskultet@redhat.com> 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.16 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" Signed-off-by: Erik Skultety --- guests/lcitool | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 689a8cf..975a811 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -175,7 +175,7 @@ class Config: ) ) =20 - if flavor not in ["test", "jenkins"]: + if flavor not in ["test", "jenkins", "gitlab"]: raise Exception("Invalid flavor '{}'".format(flavor)) =20 return flavor @@ -185,7 +185,7 @@ class Config: =20 # The vault password is only needed for the jenkins flavor, but in # that case we want to make sure there's *something* in there - if self.get_flavor() !=3D "test": + if self.get_flavor() =3D=3D "jenkins": vault_pass_file =3D self._get_config_file("vault-password") =20 try: @@ -217,6 +217,44 @@ class Config: =20 return root_pass_file =20 + def get_gitlab_runner_token_file(self): + if self.get_flavor() !=3D "gitlab": + return None + + gitlab_runner_token_file =3D self._get_config_file("gitlab-runner-= token") + + try: + with open(gitlab_runner_token_file, "r") as infile: + if not infile.readline().strip(): + raise ValueError + except Exception as ex: + raise Exception( + "Missing or invalid GitLab runner token file ({}): {}".for= mat( + gitlab_runner_token_file, ex + ) + ) + + return gitlab_runner_token_file + + def get_gitlab_url_file(self): + if self.get_flavor() !=3D "gitlab": + return None + + gitlab_url_file =3D self._get_config_file("gitlab-url") + + try: + with open(gitlab_url_file, "r") as infile: + if not infile.readline().strip(): + raise ValueError + except Exception as ex: + raise Exception( + "Missing or invalid GitLab url file ({}): {}".format( + gitlab_url_file, ex + ) + ) + + return gitlab_url_file + =20 class Inventory: =20 @@ -449,6 +487,8 @@ class Application: flavor =3D self._config.get_flavor() vault_pass_file =3D self._config.get_vault_password_file() root_pass_file =3D self._config.get_root_password_file() + gitlab_url_file =3D self._config.get_gitlab_url_file() + gitlab_runner_token_file =3D self._config.get_gitlab_runner_token_= file() =20 ansible_hosts =3D ",".join(self._inventory.expand_pattern(hosts)) selected_projects =3D self._projects.expand_pattern(projects) @@ -477,6 +517,8 @@ class Application: "selected_projects": selected_projects, "git_remote": git_remote, "git_branch": git_branch, + "gitlab_url_file": gitlab_url_file, + "gitlab_runner_token_file": gitlab_runner_token_file }) =20 ansible_playbook =3D distutils.spawn.find_executable("ansible-play= book") --=20 2.25.1