From patchwork Mon Jun 24 14:33:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ales Musil X-Patchwork-Id: 1951598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PEmOGoUF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W79St2wxqz20X6 for ; Tue, 25 Jun 2024 00:34:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0457B608F9; Mon, 24 Jun 2024 14:34:04 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id spz2lQVDIrAh; Mon, 24 Jun 2024 14:34:03 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D8146608D8 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PEmOGoUF Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id D8146608D8; Mon, 24 Jun 2024 14:34:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 65B83C0012; Mon, 24 Jun 2024 14:34:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F2BADC0011 for ; Mon, 24 Jun 2024 14:34:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E09CF80DE3 for ; Mon, 24 Jun 2024 14:34:00 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id pGliMt-BYE-Q for ; Mon, 24 Jun 2024 14:34:00 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org D477080D84 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D477080D84 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PEmOGoUF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id D477080D84 for ; Mon, 24 Jun 2024 14:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719239638; h=from:from: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; bh=MhvwhjecCkzxA5LhTxIQE1j3J5FRkNzBUWSNab/SooY=; b=PEmOGoUFSD5sIS1irkp7gVVlX3ZPSDGnhNCR5CXIaqmzadccAvIc1HE83JviBcqpfapdwK belVdkLhnwGg7LJ/bvXAepNHTUt9C2QkZ5GzRD+s/lm2NJY5/5+m6BXyK+Cv84qMppO6DB 53ongTDcgoNsyAFucLQB/NHLuScstak= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-332-VX0KNIskOZOuEtXVqcD79w-1; Mon, 24 Jun 2024 10:33:57 -0400 X-MC-Unique: VX0KNIskOZOuEtXVqcD79w-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1FFDB19560B2 for ; Mon, 24 Jun 2024 14:33:56 +0000 (UTC) Received: from amusil.redhat.com (unknown [10.45.224.204]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2D3311956048; Mon, 24 Jun 2024 14:33:53 +0000 (UTC) From: Ales Musil To: dev@openvswitch.org Date: Mon, 24 Jun 2024 16:33:51 +0200 Message-ID: <20240624143352.370620-1-amusil@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2 1/2] ci: Move common build steps into script. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dceara@redhat.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Move common preparation steps into script that can be invoked by both container builds. This will ensure that any update will be reflected in both containers, and it reduces the duplication between both containers. At the same time use the --user argument which avoids the error below and allows pip to upgrade itself: ERROR: Cannot uninstall pip 24.0, RECORD file not found. Hint: The package was installed by debian. Signed-off-by: Ales Musil Acked-by: Eelco Chaudron --- v2: Use --user for pip update. Add ack from Eelco. --- utilities/automake.mk | 1 + utilities/containers/fedora/Dockerfile | 35 ++++-------------------- utilities/containers/prepare.sh | 37 ++++++++++++++++++++++++++ utilities/containers/ubuntu/Dockerfile | 37 +++++--------------------- 4 files changed, 49 insertions(+), 61 deletions(-) create mode 100755 utilities/containers/prepare.sh diff --git a/utilities/automake.mk b/utilities/automake.mk index de4f6efb5..03e9096fa 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -42,6 +42,7 @@ EXTRA_DIST += \ utilities/containers/Makefile \ utilities/containers/openbfdd.patch \ utilities/containers/py-requirements.txt \ + utilities/containers/prepare.sh \ utilities/containers/fedora/Dockerfile \ utilities/containers/ubuntu/Dockerfile \ utilities/docker/Makefile \ diff --git a/utilities/containers/fedora/Dockerfile b/utilities/containers/fedora/Dockerfile index 019e9f138..f28c00b5d 100755 --- a/utilities/containers/fedora/Dockerfile +++ b/utilities/containers/fedora/Dockerfile @@ -45,41 +45,16 @@ RUN dnf -y update \ && \ dnf clean all -# Compile sparse from source -WORKDIR /workspace/sparse +ENV PATH "${PATH}:${HOME}/bin:${HOME}/.local/bin" -RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ - /workspace/sparse \ - && \ - make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install - -# Compile OpenBFDD from source -WORKDIR /workspace/OpenBFDD +WORKDIR /workspace COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch -RUN git clone https://github.com/dyninc/OpenBFDD.git \ - /workspace/OpenBFDD \ - && \ - git apply /tmp/openbfdd.patch \ - && \ - ./autogen.sh \ - && \ - ./configure --enable-silent-rules \ - && \ - make \ - && \ - make install - -WORKDIR /workspace - COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt -# Update and install pip dependencies -RUN python3 -m pip install --upgrade pip \ - && \ - python3 -m pip install wheel \ - && \ - python3 -m pip install -r /tmp/py-requirements.txt +COPY $CONTAINERS_PATH/prepare.sh /tmp/prepare.sh + +RUN /tmp/prepare.sh CMD ["/usr/sbin/init"] diff --git a/utilities/containers/prepare.sh b/utilities/containers/prepare.sh new file mode 100755 index 000000000..b3baa4345 --- /dev/null +++ b/utilities/containers/prepare.sh @@ -0,0 +1,37 @@ +#!/bin/bash -xe + +function compile_sparse() +{ + git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ + /workspace/sparse + + pushd sparse + make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install + popd +} + +function compile_openbfdd() +{ + git clone https://github.com/dyninc/OpenBFDD.git \ + /workspace/OpenBFDD + + pushd OpenBFDD + git apply /tmp/openbfdd.patch + ./autogen.sh + ./configure --enable-silent-rules + make + make install + popd +} + +function install_python_dep() +{ + # The --user should be removed once pip can be upgraded on Ubuntu. + python3 -m pip install --user --upgrade pip + python3 -m pip install wheel + python3 -m pip install -r /tmp/py-requirements.txt +} + +compile_sparse +compile_openbfdd +install_python_dep diff --git a/utilities/containers/ubuntu/Dockerfile b/utilities/containers/ubuntu/Dockerfile index ce7ce16c6..49ba861ac 100755 --- a/utilities/containers/ubuntu/Dockerfile +++ b/utilities/containers/ubuntu/Dockerfile @@ -45,48 +45,23 @@ RUN apt update -y \ && \ apt clean -# Compile sparse from source -WORKDIR /workspace/sparse +ENV PATH "${PATH}:${HOME}/bin:${HOME}/.local/bin" -RUN git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git \ - /workspace/sparse \ - && \ - make -j4 PREFIX=/usr HAVE_LLVM= HAVE_SQLITE= install - -# Compile OpenBFDD from source -WORKDIR /workspace/OpenBFDD +WORKDIR /workspace COPY $CONTAINERS_PATH/openbfdd.patch /tmp/openbfdd.patch -RUN git clone https://github.com/dyninc/OpenBFDD.git \ - /workspace/OpenBFDD \ - && \ - git apply /tmp/openbfdd.patch \ - && \ - ./autogen.sh \ - && \ - ./configure --enable-silent-rules \ - && \ - make \ - && \ - make install - -WORKDIR /workspace - COPY $CONTAINERS_PATH/py-requirements.txt /tmp/py-requirements.txt +COPY $CONTAINERS_PATH/prepare.sh /tmp/prepare.sh + # Ubuntu 24.04 marks the Python installation as externally managed, allow pip # to install the packages despite that. ENV PIP_BREAK_SYSTEM_PACKAGES 1 -# Update and install pip dependencies -RUN python3 -m pip install --upgrade pip \ - && \ - python3 -m pip install wheel \ - && \ - python3 -m pip install -r /tmp/py-requirements.txt - # The Python Babel fails to detect timezone when it is set to UTC only. ENV TZ Etc/UTC +RUN /tmp/prepare.sh + CMD ["/sbin/init"]