jenkins maven rpmbuild“[信息]参数0:1:文件:未找到”

lsmd5eda  于 2023-02-11  发布在  Jenkins
关注(0)|答案(1)|浏览(133)

我已经使用以下指令创建了一个Docker映像:

FROM maven:3.5.0-jdk-8 as mavensrc   
FROM jenkins/ssh-agent:latest-jdk8   
COPY --from=mavensrc /usr/share/maven /usr/share/maven

ENV MAVEN_HOME /usr/share/maven
ENV USER_HOME_DIR="/home/jenkins"
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

RUN sed -i "s|PATH=|PATH=/usr/share/maven/bin:|" /etc/environment \   
       && apt-get update \
       && apt-get -y install binutils \
       && apt-get -y install rpm

这是一个jenkins代理,用于构建我的项目。所有工作正常,rpm生成,当安装时它按预期工作,但在构建日志中我发现了一个戳,我没有看到如果我在redhat7上构建它没有容器。
以下是日志:

[INFO] + cd /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT/BUILD
[INFO] + /bin/rm -rf /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT/buildroot
[INFO] + /bin/mkdir -p /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT
[INFO] + /bin/mkdir /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT/buildroot
[INFO] + [ -d /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT/buildroot ]
[INFO] + mv /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT/tmp-buildroot/usr /home/jenkins/maven-agent/workspace/MYPROJECT/distribution/target/rpm/MYPROJECT/buildroot
[INFO] + /usr/lib/rpm/brp-compress /usr
[INFO] + /usr/lib/rpm/brp-strip /usr/bin/strip
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] ARG0: 1: file: not found
[INFO] + /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
[INFO] find: ‘file’: No such file or directory
[INFO] find: ‘file’: No such file or directory
[INFO] find: ‘file’: No such file or directory
[INFO] find: ‘file’: No such file or directory
[INFO] find: ‘file’: No such file or directory
[INFO] find: ‘file’: No such file or directory
[INFO] find: ‘file’: No such file or directory

执行的脚本似乎正确,例如/usr/lib/rpm/brp-strip包含:

#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
        exit 0
fi

STRIP=${1:-strip}
NCPUS=${RPM_BUILD_NCPUS:-1}

case `uname -a` in
Darwin*) exit 0 ;;
*) ;;
esac

# Strip ELF binaries
find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \
    xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | grep -v ' shared object,' | sed -n -e 's/^\(.*\):[  ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0

谁能告诉我为什么会有这些指纹?
我还尝试通过连接到容器来手动运行脚本,它在没有任何报告的情况下运行,所以可能它取决于maven执行的上下文。

u0njafvf

u0njafvf1#

最后,我发现jenkins/ssh-agent:latest-jdk8debian派生映像,其中缺少命令file
增加:

apt-get -y install file

修复错误。

相关问题