From nobody Wed May 15 15:48:48 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=1586259102; cv=none; d=zohomail.com; s=zohoarc; b=Ts2cUxmp4pSFyTqdGa4I01x7MK7Iqzp3ZVnZk2hObU1d0alzASoEdkB4l8h+qgQ3czxN4LwBqLOZqLRnbmrRNPSL+amtPnhh8GoaOK2NRVenqBkimeTwkxaVbJxKKGlJJgd7QJMpKkqNjVzYQNIioGYpjZ8VWuIuwPKXYM/iX6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586259102; 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=MwxF35DTszq2kn4nDKHhm0mOaCjqq/e2wvEcEGpUorM=; b=UK+87aofxQftTQ114FZ4UR241yvrfIB2ZANHDCaYD6skUXVfxesnTXH/24FzTVuKW3eh/hc+G5Gkc9Er7FibU1K7LteZOxrlJb23EvljJcm/jELIOvOVLtyxZ6Z2FCW2dNgWY5rqFj+zlCtI8v+Ul1bPPtwFRPtmSAhj/7iaC6Q= 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586259102616526.3510025283247; Tue, 7 Apr 2020 04:31:42 -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-72-HHMxcoHsPgW4UkXkBtMr0w-1; Tue, 07 Apr 2020 07:31:35 -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 7E08B107ACCA; Tue, 7 Apr 2020 11:31:30 +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 4B46E5DA7B; Tue, 7 Apr 2020 11:31:30 +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 4AABF93A7C; Tue, 7 Apr 2020 11:31:28 +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 037BVQfM005373 for ; Tue, 7 Apr 2020 07:31:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id DD45BD766D; Tue, 7 Apr 2020 11:31:26 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.193.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F360118F4A; Tue, 7 Apr 2020 11:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586259101; 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=MwxF35DTszq2kn4nDKHhm0mOaCjqq/e2wvEcEGpUorM=; b=EImEKVFf0IaJ4fmCbMBT4YCrVeS3bjWvCq6ZHnskjI5s9NQztLFCzPY9xaLowb8C+u6WgP IabmBYARa21uTX6ST2xrPvFUjhUPPFME+1Q6X03rhKWG+fEOp7kGPX6Oukryyf9u9XMnNQ lzdo7iapoRpxUxIVBRehXQfDGHcAVv0= X-MC-Unique: HHMxcoHsPgW4UkXkBtMr0w-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v2 1/6] guests: users: Discard the .bash_logout skeleton file Date: Tue, 7 Apr 2020 13:31:16 +0200 Message-Id: <888b6af8b45274ccf3725f9146774233c9d4381d.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" 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 Wed May 15 15:48:48 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=1586259099; cv=none; d=zohomail.com; s=zohoarc; b=F3DxzH+dzvQAfHujN2baD5e5kIKk2Wvq89dsN6SHl0pEyRzqM+RNCrCP5ZKa31SOuzfRUDZULLO5rxMLaHq/2t11nd/AM2ZlRndXZQYCQa2Rf4Sd7qMCOAtzJv/QuQCyJAN83N5HTMXhnVBt+egoF0Iq0qLecSk8K6l1/JItfDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586259099; 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=1OGIbmbR1MV5qOH39AHADbblLGOdXEmgJgqhDuoprNY=; b=UtvDY/Yu3qVpLr7XE5mzWP8FT3vGTaZBob3730+TEzIKFn+Zo41IP9sso49thU6OjjTR2THdknf4jMijPqcrbvtj+Zoxc7izQnQNG7RarJA1GMLuAxEVK7DEcc4Gs1GFUUnLDrvfpfGWR6a+sXBFeLiopn++sP/w610oB7hmfTw= 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 1586259099290795.4497642285294; Tue, 7 Apr 2020 04:31:39 -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-265-qs2HPP29PeGxHru5GUaQ9A-1; Tue, 07 Apr 2020 07:31:35 -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 536AB107ACC4; Tue, 7 Apr 2020 11:31:30 +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 7521A5C1BB; Tue, 7 Apr 2020 11:31:29 +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 DAB6C93A83; Tue, 7 Apr 2020 11:31:28 +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 037BVR0f005381 for ; Tue, 7 Apr 2020 07:31:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECA00118F24; Tue, 7 Apr 2020 11:31:27 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.193.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E6D3D766D; Tue, 7 Apr 2020 11:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586259098; 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=1OGIbmbR1MV5qOH39AHADbblLGOdXEmgJgqhDuoprNY=; b=Su4Yn2KpVWM9ZhQci+FCk0sKqxfrUmDK2qZJp8JFErJchfUWMXBrkqN5+wGbz/sWEGCiga MYY2jzLIGUK+gW2H2uEOB/chrFah2mBEvMG65DeoZK4y21JuWH0DYhUsJA5bXRB7neyg7c LJ8H2lb9zqGYl4bU0DMGDZXNcsJSTJU= X-MC-Unique: qs2HPP29PeGxHru5GUaQ9A-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v2 2/6] guests: users: Create a bin/ directory in the flavor user's home Date: Tue, 7 Apr 2020 13:31:17 +0200 Message-Id: <9e857f0e3ddd6b6e0ab5baed44cde80b2c48390a.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.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" We're creating a dedicated user to run the gitlab agent, so why not store the agent within the user profile and execute it from there. Signed-off-by: Erik Skultety --- guests/playbooks/update/tasks/users.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/upd= ate/tasks/users.yml index a07349f..4b09416 100644 --- a/guests/playbooks/update/tasks/users.yml +++ b/guests/playbooks/update/tasks/users.yml @@ -70,3 +70,10 @@ with_items: - profile - bash_logout + +- name: '{{ flavor }}: Create /home/{{ flavor }}/bin directory' + file: + path: /home/{{ flavor }}/bin + state: directory + owner: '{{ flavor }}' + group: '{{ flavor }}' --=20 2.25.1 From nobody Wed May 15 15:48:48 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=1586259192; cv=none; d=zohomail.com; s=zohoarc; b=g32H/A7GJV7FoI0ehsBQSoR06uyTlTpPerfIyL19Ib605PL+GOyvCewwpKWneBaitL+bIO9QUTN0WQCvgdfVHhd9/q3clIP4+VuZVLBpAGzg7tGFms9ahGC1UJr0EhvP8yDiGhb4bOT2F9XqmvdaPn9L1Nkp6Ja70EAy0tqFysY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586259192; 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=dE++2ENBFDZXeC8O46+YFkXApsc7BwEk8WX5SA8fViI=; b=U2XeD8MZDTFubJ+bL7QVD8AUJYturnykqDwW+gpKuyxXs5PPqEEmk6eWYaib1q6mskPhDZPZrs7xuY1edcBFM4J0fW+y61IoBZ3naYZKEo8jJT4uw+BQ89Jtcm3akrcSqelTVYPHozekMYPNTRloBvF2vUVAGsqicx1y+fj7V30= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586259192732441.85619551534353; Tue, 7 Apr 2020 04:33:12 -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-368-LE6qRtBaOm6WocblSXIgXw-1; Tue, 07 Apr 2020 07:31:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7168018C43C1; Tue, 7 Apr 2020 11:31:37 +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 487E5118F4A; Tue, 7 Apr 2020 11:31:37 +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 F0F6693A87; 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 037BVTPb005388 for ; Tue, 7 Apr 2020 07:31:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 08E1FDA103; Tue, 7 Apr 2020 11:31:29 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.193.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D3A4D766D; Tue, 7 Apr 2020 11:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586259191; 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=dE++2ENBFDZXeC8O46+YFkXApsc7BwEk8WX5SA8fViI=; b=emMEAcpmju0ePUP7ESGh2iXRxYpt0tfcHGJzZmSoRhVjPjUMe6QEbFbebjV3MSpbxXUOf+ ArX7OW0ioQrjZQzWtgw68cUIfxt90orxVvIQTaNBiuKaLc3jkb+BEIWpWo+rFasVdADtS0 9u3DjCsIwxMUTQ5+6iZCWVBOTJ8VJxA= X-MC-Unique: LE6qRtBaOm6WocblSXIgXw-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v2 3/6] guests: templates: Introduce a gitlab-runner systemd service template Date: Tue, 7 Apr 2020 13:31:18 +0200 Message-Id: <561034675008f507cd408b9213a697c8235190a5.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.11 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..5d494b2 --- /dev/null +++ b/guests/playbooks/update/templates/gitlab-runner.service.j2 @@ -0,0 +1,14 @@ +[Unit] +Description=3DGitLab Runner +After=3Dnetwork.target +ConditionFileIsExecutable=3D/home/gitlab/bin/gitlab-runner + +[Service] +User=3Dgitlab +WorkingDirectory=3D/home/gitlab +ExecStart=3D/home/gitlab/bin/gitlab-runner run --config /home/gitlab/.gitl= ab-runner/config.toml +Restart=3Dalways + +[Install] +WantedBy=3Dmulti-user.target + --=20 2.25.1 From nobody Wed May 15 15:48:48 2024 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=1586259110; cv=none; d=zohomail.com; s=zohoarc; b=Iuo0SOqSqBs+88MByWnunoSaXjC5g67Xi8qEv8VXuJV3ttKAc64eHHCw/8RRIaJI+/8tFdhMOKJvJFWLSuPfjfpX9Zo32ghstbdX7NRROdth8mvWHKLC2popwTqlCd3bduDtTihOf/oZ1+PbpYGhpViVgBd6vx5IbMfqTw8TFUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586259110; 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=l6MGCwZHTAeWeBGbuuukiY6Kk7UCzzZPAx6WF9+cFKA=; b=RvS+TvmcjRIKDYgAJai/MQhJcgwI7honmlq3nf9bWUn5saIOOwt7kGcd+c/VOs0oOX/etcXHUPk+3xgeSQkRhtm8Qp2KpHNRtd+IlRKUgx5HJpL4QOHSnVWw2RKNxDm2OEfkBt7HZiYMRxbnTMtn8RKRzrw6qE+BXr3K9f+pmpI= 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 1586259110195563.3394256228006; Tue, 7 Apr 2020 04:31:50 -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-342-2FmpQh5AOD6aCFHQXDyuPg-1; Tue, 07 Apr 2020 07:31:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2704518C43C5; Tue, 7 Apr 2020 11:31:41 +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 EFA9F97AF5; Tue, 7 Apr 2020 11:31:40 +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 A5C1693A86; Tue, 7 Apr 2020 11:31:40 +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 037BVUen005403 for ; Tue, 7 Apr 2020 07:31:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19547DA103; Tue, 7 Apr 2020 11:31:30 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.193.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EF72118F4A; Tue, 7 Apr 2020 11:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586259109; 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=l6MGCwZHTAeWeBGbuuukiY6Kk7UCzzZPAx6WF9+cFKA=; b=L20P92R56jN1l7ZvFXjoAStGLH/P7t0WoovKhXoLknh4AwYGT4cziOy0BVrqTz7HI1cfZP 45pgzC1pMTfkfnmL1Cv/wxGxino0HggTwRy9etj7PcK/H4hD0HFNE6uUmy63zToduZLJEk kGADIz8jhroUNDe/HfowKWfiDNea02Q= X-MC-Unique: 2FmpQh5AOD6aCFHQXDyuPg-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v2 4/6] guests: templates: Introduce a gitlab-runner RC init service template Date: Tue, 7 Apr 2020 13:31:19 +0200 Message-Id: <72e077a3f3d672a29431e8a00dce2943dd7fcdd2.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.13 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 --- .../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..bfd722b --- /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"/home/gitlab/bin/gitlab-runner" +command_args=3D"run --config ${user_home}/.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 Wed May 15 15:48:48 2024 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 From nobody Wed May 15 15:48:48 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=1586259190; cv=none; d=zohomail.com; s=zohoarc; b=LW3DQ5g5BxjxelnF04ac4k8RHCB18zSMSBn0BfDOrAwmBZ/zc+aB+zxYlNcYfUZIBYZYGGnothHqyHC+PSQWU3eXhTAu4tep0FMoRK6R+Y6NGSRwLuYb4IW6JCgBPR6IrL9a3bRgoPhh526A2ZA1uCV/ckwgM3NO2vLc6ZA+ioU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586259190; 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=LWBYA69HigIBHBq/QLZ8zX6O20D7jf3Sjt90zbfrcnU=; b=fPOseN2vLprOvWTHftJtYGeZTKzjMhZcsMKSfo0cRJxFfFieXAJHn9sH1oMHDiHI8NV/gk2olFajUhHmWXsnTr2tvSfR8lRlOkXCBJoxjzg9PI/4jeu2X/4KmLIf7VGE9MFX7oRBxptKZu0DmxI7sf6oHPHHDClQ9A0qnxL4hF0= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586259190209518.4183262816493; Tue, 7 Apr 2020 04:33:10 -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-350-qiR8fDsSMdGZTaofzdebKg-1; Tue, 07 Apr 2020 07:31:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12D70113784C; Tue, 7 Apr 2020 11:31:45 +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 DC0E3B19D7; Tue, 7 Apr 2020 11:31:44 +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 8BF7518089CF; Tue, 7 Apr 2020 11:31:44 +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 037BVWLM005422 for ; Tue, 7 Apr 2020 07:31:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 382A6D766D; Tue, 7 Apr 2020 11:31:32 +0000 (UTC) Received: from sturgeon.redhat.com (unknown [10.40.193.246]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E83B118F4F; Tue, 7 Apr 2020 11:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586259188; 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=LWBYA69HigIBHBq/QLZ8zX6O20D7jf3Sjt90zbfrcnU=; b=WUGuXx3CTKCb/Sdk7eUB8CmEAD8BDDX4cMfhSXzn1dl5ya+KN2ofO+4HvQuYgUrRvUNxLD M+cigw5TAAlnaJHySB3AiaOVzkJIWovzrOahv3zYkQIIsiyeUz5pQItunU33YQD6mD4NS2 2hA6qtPlCe3TlGoVlu+QS47KdcZh+4I= X-MC-Unique: qiR8fDsSMdGZTaofzdebKg-1 From: Erik Skultety To: libvir-list@redhat.com Subject: [libvirt-jenkins-ci PATCH v2 6/6] guests: lcitool: Enable the new 'gitlab' flavor in the lcitool script Date: Tue, 7 Apr 2020 13:31:21 +0200 Message-Id: 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.15 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 | 50 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 689a8cf..d9b2372 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,38 @@ class Config: =20 return root_pass_file =20 + def get_gitlab_runner_token_file(self): + 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): + 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 +481,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) @@ -469,7 +503,7 @@ class Application: playbook_base =3D os.path.join(base, "playbooks", playbook) playbook_path =3D os.path.join(playbook_base, "main.yml") =20 - extra_vars =3D json.dumps({ + extra_vars_d =3D { "base": base, "playbook_base": playbook_base, "root_password_file": root_pass_file, @@ -477,7 +511,13 @@ class Application: "selected_projects": selected_projects, "git_remote": git_remote, "git_branch": git_branch, - }) + } + + if flavor =3D=3D "gitlab": + extra_vars_d.update([ + ("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") if ansible_playbook is None: @@ -486,7 +526,7 @@ class Application: cmd =3D [ ansible_playbook, "--limit", ansible_hosts, - "--extra-vars", extra_vars, + "--extra-vars", json.dumps(extra_vars_d), ] =20 # Provide the vault password if available --=20 2.25.1