From nobody Fri May 3 12:22:12 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=1588330383; cv=none; d=zohomail.com; s=zohoarc; b=h5EPVEekq1N9UVZ+QqHJrqX9oZFz8B2btlxF2A1XwI9hEVTRpZZ3uC7GsvFqh6XSxm334c2UrUH9KAHxlnqeU5Y7yV/2YTDB4WK5Kpq0ZJvMPl/ZPcyNQbtkq742BEELeBW0W/LmEgX3FXiRE4aHZtDQrOEEWR0KosWz2G/p/K8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588330383; h=Content-Type:Content-Transfer-Encoding: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=a4iTkVxn+nbxLu9Myc9i6+h9Mt1gHtH1BNY1rzJpb9s=; b=K5IVyEdc/DhguHzXZ3tcqBgxXO9FsHrcXGm0fKHfNL1dc3Tfqtwq5HCdifHEJPNtNrSMQ9us6yzWZnxEgj2QwfHHgUL5asVN4i1y+1wfqd51rkRCOq/igtSReC4TG6f5xw2EAbizf1Z6A5r+xspZm2pQ4w1rzzWRZ4kPDrdCPhs= 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 1588330383678455.0277112921044; Fri, 1 May 2020 03:53:03 -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-WaG0MfLiMP-jhB4jezZlCA-1; Fri, 01 May 2020 06:52:59 -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 E7CD91008301; Fri, 1 May 2020 10:52:48 +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 BFBC15B818; Fri, 1 May 2020 10:52:48 +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 8159A4CAA8; Fri, 1 May 2020 10:52:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 041Aqd8Z007219 for ; Fri, 1 May 2020 06:52:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96EA660C84; Fri, 1 May 2020 10:52:39 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F6B060BE1; Fri, 1 May 2020 10:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588330382; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=a4iTkVxn+nbxLu9Myc9i6+h9Mt1gHtH1BNY1rzJpb9s=; b=AStuZTuE+AM7/lyOHCPc1h8RkvYXJzGD2s0Ab9M0900KklJzeSzkXkuQpWKBILgEvsvBTT yQG75U4fRA2VN/u8Gbmn/piRHdvLbeZUQDQ/WCdVgn9lADvIdz9ZTfpKQhnFyNOy5cSPZ+ t+GyxaQLCb7+6isw+hW5dwu1GoVXtu0= X-MC-Unique: WaG0MfLiMP-jhB4jezZlCA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt-ci PATCH 1/2] gitlab: rename job for building check-dco container Date: Fri, 1 May 2020 11:52:31 +0100 Message-Id: <20200501105232.2224793-2-berrange@redhat.com> In-Reply-To: <20200501105232.2224793-1-berrange@redhat.com> References: <20200501105232.2224793-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: Daniel P. Berrang=C3=A9 Reviewed-by: Andrea Bolognani --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6de69d6..a1ac31a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ stages: after_script: - docker logout =20 -build-dco: +check-dco-container: <<: *build_container_definition variables: NAME: check-dco --=20 2.25.4 From nobody Fri May 3 12:22:12 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=1588330372; cv=none; d=zohomail.com; s=zohoarc; b=PeCMk9awfhpFoHwDKXDwcUAOrHauOvJyO8Zbf7NCUpLn46WW2I+CSnP1gW4AX3iVzjyMdIh33Nc7deDOF6pacFUYY/WV/7zIy3IqTsJykYjxVd6LTJfphoD6DuAgLGbFclscq8w8106sfF0a3grIz3TBb4a+jHPDEi8xdTRP6QU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588330372; h=Content-Type:Content-Transfer-Encoding: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=LiaHywogbEeVbzeGzcotKROabolkRct0nUv21mCDF4o=; b=mIjMUDKiV07X1MSsMeAseqNPbMAxrGMeONJduww5T9TQPHiPonQJjfb9RV64n54ZJsJV2mw6KLBG3cnono9g6qouLSaCy4VQbfskQch39Ig2/RtpqZmx5ccTIiHuxTuQ4dsUjJmXiG8Vi5A1nBExL126NozudT05A50AdyImTcE= 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 1588330372126999.1809827347479; Fri, 1 May 2020 03:52:52 -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-61-7hLKkb4YM1-gIXNYvtyHLg-1; Fri, 01 May 2020 06:52:48 -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 34196801504; Fri, 1 May 2020 10:52:43 +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 F10ED61524; Fri, 1 May 2020 10:52: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 B0E3F180954D; Fri, 1 May 2020 10:52:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 041Aqf73007231 for ; Fri, 1 May 2020 06:52:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3BDD460CC0; Fri, 1 May 2020 10:52:41 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E95660BE1; Fri, 1 May 2020 10:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588330370; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=LiaHywogbEeVbzeGzcotKROabolkRct0nUv21mCDF4o=; b=VD8OM0gsoavB/VAefZd3ltlDLmRuWu6reHs0Ad0YYPPvhQgXhybf9AizEKpiKvLeBqU1Y3 HYK/iQ1PUMp1b09YmpDgMB/vuFMafH5aprpmYRNqflvgs9XpGYNA/9uozrHJnky35Gy+HO xn8kWM1Cjjl2wgKizB8SzrTFZCjAHKA= X-MC-Unique: 7hLKkb4YM1-gIXNYvtyHLg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt-ci PATCH 2/2] containers: add a standard container for running go fmt Date: Fri, 1 May 2020 11:52:32 +0100 Message-Id: <20200501105232.2224793-3-berrange@redhat.com> In-Reply-To: <20200501105232.2224793-1-berrange@redhat.com> References: <20200501105232.2224793-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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" The "go fmt" code style checking tool is something we wish to run on all Go code, so it is useful to have a common container that can be used by all relevant projects. Signed-off-by: Daniel P. Berrang=C3=A9 --- .gitlab-ci.yml | 5 +++++ containers/go-fmt/Dockerfile | 9 +++++++++ containers/go-fmt/README.rst | 20 ++++++++++++++++++++ containers/go-fmt/go-fmt.sh | 24 ++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 containers/go-fmt/Dockerfile create mode 100644 containers/go-fmt/README.rst create mode 100755 containers/go-fmt/go-fmt.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1ac31a..080c8d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,11 @@ check-dco-container: variables: NAME: check-dco =20 +go-fmt-container: + <<: *build_container_definition + variables: + NAME: go-fmt + # Check that all commits are signed-off for the DCO. Skip # on master branch and -maint branches, since we only need # to test developer's personal branches. diff --git a/containers/go-fmt/Dockerfile b/containers/go-fmt/Dockerfile new file mode 100644 index 0000000..9079fea --- /dev/null +++ b/containers/go-fmt/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.14 + +RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ + apt-get update && \ + apt-get install --no-install-recommends -y \ + diffstat && \ + apt-get autoclean -y + +COPY go-fmt.sh /go-fmt diff --git a/containers/go-fmt/README.rst b/containers/go-fmt/README.rst new file mode 100644 index 0000000..0af6998 --- /dev/null +++ b/containers/go-fmt/README.rst @@ -0,0 +1,20 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Container for running go fmt code style check +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This container provides a simple way to invoke ``go fmt`` to validate code +style across a Golang codebase. It should be integrated into a CI by adding +the following snippet to ``.gitlab-ci.yml`` + +:: + + go-fmt: + stage: prebuild + image: registry.gitlab.com/libvirt/libvirt-ci/go-fmt:master + script: + - /go-fmt + artifacts: + paths: + - go-fmt.patch + expire_in: 1 week + when: on_failure diff --git a/containers/go-fmt/go-fmt.sh b/containers/go-fmt/go-fmt.sh new file mode 100755 index 0000000..9fda79d --- /dev/null +++ b/containers/go-fmt/go-fmt.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +GOFMT=3D$(go env GOROOT)/bin/gofmt + +find -name '*.go' | xargs $GOFMT -d -e > go-fmt.patch + +if test -n go-fmt.patch +then + echo + echo "=E2=9D=8C ERROR: some files failed go fmt code style check" + echo + diffstat go-fmt.patch + echo + echo "See the go-fmt patch artifact for full details of mistakes." + echo + echo "For guidance on how to configure Emacs or Vim to automatically" + echo "run go fmt when saving files read" + echo + echo " https://blog.golang.org/gofmt" + echo + exit 1 +fi + +echo "=E2=9C=94 OK: all files passed go fmt code style check" --=20 2.25.4