CI: Do not install swtpm if it cannot work anyway
PATCH 1/3 CI: Do not install swtpm if it cannot work anyway
Do not need to waste CPU cycles and time to install swtpm in CI container if distribution does not have tssstartup, because we will be not able to start it.
--- .github/workflows/ci.yml | 8 +++++++- .travis.yml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-)
workflows/ci.yml +7 -1
@@ -112,7 +112,13 @@ jobs: ARCH="$ARCH" CC="$CC" TSS="$TSS" ./ci/$INSTALL.sh - name: Build swtpm - run: if [ ! "$VARIANT" ]; then which tpm_server || which swtpm || ./tests/install-swtpm.sh; fi + run: | + if [ ! "$VARIANT" ]; then + which tpm_server || which swtpm || \ + if which tssstartup; then + ./tests/install-swtpm.sh; + fi + fi - name: Compiler version run: $CC --version
.travis.yml +1 -1
@@ -93,4 +93,4 @@ before_install: script: - INSTALL="${DISTRO%%:*}" - INSTALL="${INSTALL%%/*}" - - $CONTAINER run $CONTAINER_ARGS -t ima-evm-utils /bin/sh -c "if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./ci/$INSTALL.$VARIANT.sh; fi && ARCH=\"$ARCH\" CC=\"$CC\" TSS=\"$TSS\" ./ci/$INSTALL.sh && if [ ! \"$VARIANT\" ]; then which tpm_server || which swtpm || ./tests/install-swtpm.sh; fi && CC=\"$CC\" VARIANT=\"$VARIANT\" ./build.sh" + - $CONTAINER run $CONTAINER_ARGS -t ima-evm-utils /bin/sh -c "if [ \"$VARIANT\" ]; then ARCH=\"$ARCH\" ./ci/$INSTALL.$VARIANT.sh; fi && ARCH=\"$ARCH\" CC=\"$CC\" TSS=\"$TSS\" ./ci/$INSTALL.sh && if [ ! \"$VARIANT\" ]; then which tpm_server || which swtpm || if which tssstartup; then ./tests/install-swtpm.sh; fi; fi && CC=\"$CC\" VARIANT=\"$VARIANT\" ./build.sh"
Signature · 1 line
2.29.3
PATCH 2/3 CI: Do not use sudo when it does not needed
Some distributions, such as ALT, cannot use sudo under root by default. Error message will appear:
root is not in the sudoers file. This incident will be reported.
--- tests/install-swtpm.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
install-swtpm.sh +11 -3
@@ -1,5 +1,13 @@ -#!/bin/sh -set -ex +#!/bin/sh -ex + +# No need to run via sudo if we already have permissions. +# Also, some distros do not have sudo configured for root: +# `root is not in the sudoers file. This incident will be reported.' +if [ -w /usr/local/bin ]; then + SUDO= +else + SUDO=sudo +fi version=1637
@@ -9,5 +17,5 @@ cd ibmtpm$version tar --no-same-owner -xvzf ../download cd src make -j$(nproc) -sudo cp tpm_server /usr/local/bin/ +$SUDO cp tpm_server /usr/local/bin/ cd ../..
Signature · 1 line
2.29.3
PATCH 3/3 CI: Add support for ALT Linux
In reply to Vitaly ChikunovBuild on Sisyphus branch which is bleeding edge repository. Package manager is apt-rpm (not APT as it may look from the scripts).
--- .github/workflows/ci.yml | 5 +++++ .travis.yml | 4 ++++ ci/alt.sh | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100755 ci/alt.sh
workflows/ci.yml +5 -0
@@ -92,6 +92,11 @@ jobs: CC: clang TSS: ibmtss + - container: "alt:sisyphus" + env: + CC: gcc + TSS: libtpm2-tss-devel + container: image: ${{ matrix.container }} env: ${{ matrix.env }}
.travis.yml +4 -0
@@ -67,6 +67,10 @@ matrix: env: DISTRO=debian:stable TSS=ibmtss compiler: gcc + - os: linux + env: DISTRO=alt:sisyphus TSS=libtpm2-tss-devel + compiler: gcc + before_install: # Tumbleweed requires podman and newest runc due docker incompatible with glibc 2.33 (faccessat2) - CONTAINER="${CONTAINER:-docker}"
alt.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh -ex +# SPDX-License-Identifier: GPL-2.0-only +# +# Install build env for ALT Linux + +apt-get update -y + +# rpm-build brings basic build envirenment with gcc, make, autotools, etc. +apt-get install -y \ + $CC \ + $TSS \ + asciidoc \ + attr \ + docbook-style-xsl \ + libattr-devel \ + libkeyutils-devel \ + libssl-devel \ + openssl \ + openssl-gost-engine \ + rpm-build \ + wget \ + xsltproc \ + xxd +
Signature · 1 line
2.29.3
Mimi Zohar
maintainerQuoted 5 lines · Vitaly Chikunov
Do not need to waste CPU cycles and time to install swtpm in CI container if distribution does not have tssstartup, because we will be not able to start it.
Signed-off-by Vitaly Chikunov <[email protected]>
Thanks! This and the other two patches are queued in next-testing (sf, github).
Mimi