I've created a docker image with this directive:
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
This is a jenkins agent that is used to build my project. All works fine, rpm is generated and when installed it works as expected, but in the build log I found a stamps that I did not see if I build it on redhat7 without container.
Here is the log:
[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
The scripts executed seems right, for example /usr/lib/rpm/brp-strip
contains:
#!/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
could someone help me understand why there are such prints?
I also tried running the script manually by connecting to the container and it worked without any reports, so probably it depend on the context of the maven execution.
Finally I found that jenkins/ssh-agent:latest-jdk8
is a debian
derived image where the command file
is missing.
Adding:
apt-get -y install file
fix the errors.