From nobody Sun Feb 8 21:12:30 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=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