From nobody Thu May 2 22:17:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521473412545818.042603807221; Mon, 19 Mar 2018 08:30:12 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D1E5626AC66; Mon, 19 Mar 2018 15:30:09 +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 3041118668; Mon, 19 Mar 2018 15:30:09 +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 A45744CA99; Mon, 19 Mar 2018 15:30:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2JFU5RY015211 for ; Mon, 19 Mar 2018 11:30:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id EE3751102E32; Mon, 19 Mar 2018 15:30:04 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 938851102E30 for ; Mon, 19 Mar 2018 15:30:04 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 19 Mar 2018 16:29:55 +0100 Message-Id: <20180319152957.4951-2-abologna@redhat.com> In-Reply-To: <20180319152957.4951-1-abologna@redhat.com> References: <20180319152957.4951-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 1/3] guests: Rename 'ci' flavor to 'jenkins' 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 19 Mar 2018 15:30:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Having the name of the user that can access the machine match the name of the flavor, as is already the case for the 'test' flavor, makes some things easier. We can change this safely because the CentOS CI is the only user of the 'ci' flavor, and we can easily coordinate a configuration change to avoid breakages. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/README.markdown | 9 +++++---- guests/lcitool | 12 ++++++------ guests/site.yml | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/guests/README.markdown b/guests/README.markdown index fa1e8a5..bc780f3 100644 --- a/guests/README.markdown +++ b/guests/README.markdown @@ -79,11 +79,12 @@ single time you want to connect. Just add to your `~/.ssh/config` file to achieve all of the above. =20 =20 -CI use ------- +Jenkins CI use +-------------- =20 -You'll need to configure `lcitool` to use the `ci` flavor for guests: -to do so, just write `ci` in the `~/.config/lcitool/flavor` file. +You'll need to configure `lcitool` to use the `jenkins` flavor for +guests: to do so, just write `jenkins` in the `~/.config/lcitool/flavor` +file. =20 Once a guest has been prepared, you'll be able to log in as root either via SSH (your public key will have been authorized) or on the serial diff --git a/guests/lcitool b/guests/lcitool index ccd0a59..5b2efb9 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -67,20 +67,20 @@ load_config() { VAULT_PASS_FILE=3D"$CONFIG_DIR/vault-password" ROOT_PASS_FILE=3D"$CONFIG_DIR/root-password" =20 - # Two flavors are supported: test (default) and ci. Read the + # Two flavors are supported: test (default) and jenkins. Read the # flavor from configuration, validate it and write it back in case # it was not present FLAVOR=3D"$(cat "$FLAVOR_FILE" 2>/dev/null)" FLAVOR=3D${FLAVOR:-test} - test "$FLAVOR" =3D test || test "$FLAVOR" =3D ci || { + test "$FLAVOR" =3D test || test "$FLAVOR" =3D jenkins || { die "$PROGRAM_NAME: Invalid flavor '$FLAVOR'" } echo "$FLAVOR" >"$FLAVOR_FILE" || { die "$PROGRAM_NAME: $FLAVOR_FILE: Unable to save flavor" } =20 - test "$FLAVOR" =3D ci && { - # The vault password is only needed for the ci flavor, so only + test "$FLAVOR" =3D jenkins && { + # The vault password is only needed for the jenkins flavor, so only # validate it in that case test -f "$VAULT_PASS_FILE" && test "$(cat "$VAULT_PASS_FILE")" || { die "$PROGRAM_NAME: $VAULT_PASS_FILE: Missing or invalid passw= ord" @@ -160,8 +160,8 @@ do_install() *kickstart*|*ks*) EXTRA_ARGS=3D"ks=3Dfile:/${INSTALL_CONFIG##*/}" = ;; esac =20 - # Only configure autostart for the guest for the ci flavor - test "$FLAVOR" =3D ci && { + # Only configure autostart for the guest for the jenkins flavor + test "$FLAVOR" =3D jenkins && { AUTOSTART=3D"--autostart" } =20 diff --git a/guests/site.yml b/guests/site.yml index 5df18e6..cb4ec0e 100644 --- a/guests/site.yml +++ b/guests/site.yml @@ -30,7 +30,7 @@ # Configure the Jenkins agent - include: tasks/jenkins.yml when: - - flavor =3D=3D 'ci' + - flavor =3D=3D 'jenkins' - projects is defined # jenkins is a pseudo-project - ( 'jenkins' in projects ) --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 22:17:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521473423268983.614263317147; Mon, 19 Mar 2018 08:30:23 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id DB4F681F01; Mon, 19 Mar 2018 15:30:20 +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 9172EBA85; Mon, 19 Mar 2018 15:30:20 +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 E46484CA9C; Mon, 19 Mar 2018 15:30:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2JFU7Fl015218 for ; Mon, 19 Mar 2018 11:30:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 58A6C10B0F20; Mon, 19 Mar 2018 15:30:07 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 001A710B2B27 for ; Mon, 19 Mar 2018 15:30:05 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 19 Mar 2018 16:29:56 +0100 Message-Id: <20180319152957.4951-3-abologna@redhat.com> In-Reply-To: <20180319152957.4951-1-abologna@redhat.com> References: <20180319152957.4951-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 2/3] guests: Factor out user creation 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 19 Mar 2018 15:30:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some steps involved in creating the user account are the same regardless of flavor, and more common steps will be introduced later on, so it makes sense to have them all in the same place instead of duplicating them. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/site.yml | 6 +----- guests/tasks/jenkins.yml | 6 ------ guests/tasks/test.yml | 21 --------------------- guests/tasks/user.yml | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 32 deletions(-) delete mode 100644 guests/tasks/test.yml create mode 100644 guests/tasks/user.yml diff --git a/guests/site.yml b/guests/site.yml index cb4ec0e..5f69cfd 100644 --- a/guests/site.yml +++ b/guests/site.yml @@ -17,6 +17,7 @@ # Prepare the base environment - include: tasks/base.yml - include: tasks/compat.yml + - include: tasks/user.yml =20 # Install build dependencies for each project - include: tasks/packages.yml @@ -34,8 +35,3 @@ - projects is defined # jenkins is a pseudo-project - ( 'jenkins' in projects ) - - # Configure the test environment - - include: tasks/test.yml - when: - - flavor =3D=3D 'test' diff --git a/guests/tasks/jenkins.yml b/guests/tasks/jenkins.yml index 9bb150b..94c2404 100644 --- a/guests/tasks/jenkins.yml +++ b/guests/tasks/jenkins.yml @@ -7,12 +7,6 @@ set_fact: jenkins_secret: '{{ vault.jenkins_secrets[inventory_hostname] }}' =20 -- name: Create Jenkins user account - user: - name: jenkins - comment: Jenkins - password: '*' - - name: Download Jenkins agent get_url: url: https://ci.centos.org/jnlpJars/slave.jar diff --git a/guests/tasks/test.yml b/guests/tasks/test.yml deleted file mode 100644 index 10146b9..0000000 --- a/guests/tasks/test.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Create test user account - user: - name: test - comment: test - password: $6$xSlfvkcsDgPmRAMX$mFh9qRmFFW9cyW1n5/jeHvq4OmJA8WzSD70Mfis3= VHc3Z5imZeiQAg9VNL4sFEtmDy/siU3nJL.QeAapCgfL20 - shell: '{{ bash }}' - -- name: Configure ssh access for the test user - authorized_key: - user: test - key: '{{ lookup("file", lookup("env", "HOME") + "/.ssh/id_rsa.pub") }}' - state: present - -- name: Grant passwordless sudo access to the test user - lineinfile: - path: '{{ sudoers }}' - line: 'test ALL=3D(ALL) NOPASSWD: ALL' - state: present - backup: yes - validate: 'visudo -cf %s' diff --git a/guests/tasks/user.yml b/guests/tasks/user.yml new file mode 100644 index 0000000..781c3d4 --- /dev/null +++ b/guests/tasks/user.yml @@ -0,0 +1,32 @@ +--- +- name: '{{ flavor }}: Create user account' + user: + name: '{{ flavor }}' + comment: '{{ flavor }}' + password: '*' + shell: '{{ bash }}' + +- name: '{{ flavor }}: Set password' + user: + name: '{{ flavor }}' + password: '$6$xSlfvkcsDgPmRAMX$mFh9qRmFFW9cyW1n5/jeHvq4OmJA8WzSD70Mfis= 3VHc3Z5imZeiQAg9VNL4sFEtmDy/siU3nJL.QeAapCgfL20' + when: + - flavor =3D=3D 'test' + +- name: '{{ flavor }}: Configure ssh access' + authorized_key: + user: '{{ flavor }}' + key: '{{ lookup("file", lookup("env", "HOME") + "/.ssh/id_rsa.pub") }}' + state: present + when: + - flavor =3D=3D 'test' + +- name: '{{ flavor }}: Grant passwordless sudo access' + lineinfile: + path: '{{ sudoers }}' + line: '{{ flavor }} ALL=3D(ALL) NOPASSWD: ALL' + state: present + backup: yes + validate: 'visudo -cf %s' + when: + - flavor =3D=3D 'test' --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 22:17:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152147342120347.296178150256424; Mon, 19 Mar 2018 08:30:21 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id EEF827E9E1; Mon, 19 Mar 2018 15:30:18 +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 A376018537; Mon, 19 Mar 2018 15:30:18 +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 CE9B74CA99; Mon, 19 Mar 2018 15:30:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2JFU8oM015227 for ; Mon, 19 Mar 2018 11:30:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id EADF410B0F20; Mon, 19 Mar 2018 15:30:07 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9224810B0F23 for ; Mon, 19 Mar 2018 15:30:07 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 19 Mar 2018 16:29:57 +0100 Message-Id: <20180319152957.4951-4-abologna@redhat.com> In-Reply-To: <20180319152957.4951-1-abologna@redhat.com> References: <20180319152957.4951-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 3/3] guests: Configure ccache 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 19 Mar 2018 15:30:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Disk size for guests is somewhat limited, so we need to tell ccache to only consume a reasonable chunk of it. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/files/ccache.conf | 1 + guests/tasks/user.yml | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 guests/files/ccache.conf diff --git a/guests/files/ccache.conf b/guests/files/ccache.conf new file mode 100644 index 0000000..48c3756 --- /dev/null +++ b/guests/files/ccache.conf @@ -0,0 +1 @@ +max_size =3D 2G diff --git a/guests/tasks/user.yml b/guests/tasks/user.yml index 781c3d4..3db5258 100644 --- a/guests/tasks/user.yml +++ b/guests/tasks/user.yml @@ -30,3 +30,13 @@ validate: 'visudo -cf %s' when: - flavor =3D=3D 'test' + +- name: '{{ flavor }}: Configure ccache' + file: + path: /home/{{ flavor }}/.ccache + state: directory + +- name: '{{ flavor }}: Configure ccache' + copy: + src: files/ccache.conf + dest: /home/{{ flavor }}/.ccache/ccache.conf --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list