diff --git a/Dockerfile b/Dockerfile index 02512ad..2daf9c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,63 +21,37 @@ ARG SWARM_REPO=https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm ARG SLAVE_REPO=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting USER root + +# Install additional software +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update && apt-get install -y apt-utils -RUN apt-get update && apt-get install -y curl git unzip lsof nano wget curl +RUN apt-get update && apt-get install -y curl git unzip lsof nano wget subversion RUN apt-get update && apt-get install -y ant ant-doc ant-optional ant-contrib RUN apt-get update && apt-get install -y maven maven-ant-helper +RUN echo 'debconf debconf/frontend select Dialog' | debconf-set-selections # Install agent script COPY jenkins-agent /usr/local/bin/jenkins-agent RUN chmod ugo+x /usr/local/bin/jenkins-agent # Install slave -# TODO: get rid of double load -RUN curl --create-dirs -sSLo ${JAR_PATH}/slave.jar ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.jar \ - && chmod 755 ${JAR_PATH} \ - && chmod 644 ${JAR_PATH}/slave.jar -# Save slave source jar and docs -RUN mkdir -p ${SRC_PATH}/slave -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.jar -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.jar.md5 -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-sources.jar -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-sources.jar.md5 -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-tests.jar -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-tests.jar.md5 -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.pom -RUN cd ${SRC_PATH}/slave && wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.pom.md5 +COPY install-slave /tmp/install-slave +RUN chmod u+x /tmp/install-slave && /tmp/install-slave # Install swarm -# TODO: get rid of double load -RUN curl --create-dirs -sSLo ${JAR_PATH}/swarm.jar ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.jar \ - && chmod 755 ${JAR_PATH} \ - && chmod 644 ${JAR_PATH}/swarm.jar -# Save swarm source jar and docs -RUN mkdir -p ${SRC_PATH}/swarm -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.jar -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.jar.md5 -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-javadoc.jar -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-javadoc.jar.md5 -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-sources.jar -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-sources.jar.md5 -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.pom -RUN cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.pom.md5 +COPY install-swarm /tmp/install-swarm +RUN chmod u+x /tmp/install-swarm && /tmp/install-swarm -# Set initial labels -RUN touch ${LABELS} -RUN printf " sca" >>${LABELS} -RUN printf " ant" >>${LABELS} -RUN printf " maven" >>${LABELS} -RUN chown jenkins:jenkins ${LABELS} -RUN ls -la ${LABELS} +# Initialize labels +RUN touch ${LABELS}; printf " sca ant maven" >>${LABELS}; chown jenkins:jenkins ${LABELS}; ls -la ${LABELS}; USER jenkins + RUN mkdir /home/jenkins/.jenkins VOLUME /home/jenkins/.jenkins WORKDIR /home/jenkins # Show info in build log -RUN uname -a -RUN cat /etc/issue -RUN cat ${LABELS} +RUN uname -a; cat /etc/issue; cat ${LABELS} ENTRYPOINT ["jenkins-agent"] diff --git a/install-slave b/install-slave new file mode 100755 index 0000000..eb3b860 --- /dev/null +++ b/install-slave @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -o nounset +set -o noclobber +set -o errexit +set -o pipefail + +echo "Jars: ${JAR_PATH}" +echo "Source: ${SRC_PATH}" +echo "Repo: ${SLAVE_REPO}" +echo "Version: ${SLAVE_VERSION}" + +# Save slave executable +curl --create-dirs -sSLo ${JAR_PATH}/slave.jar ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.jar +chmod 755 ${JAR_PATH} +chmod 644 ${JAR_PATH}/slave.jar + +# Save slave source jar and docs +mkdir -p ${SRC_PATH}/slave +cd ${SRC_PATH}/slave +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.jar +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.jar.md5 +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-sources.jar +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-sources.jar.md5 +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-tests.jar +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}-tests.jar.md5 +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.pom +wget ${SLAVE_REPO}/${SLAVE_VERSION}/remoting-${SLAVE_VERSION}.pom.md5 + +echo "Sources ..." +ls -la ${SRC_PATH}/slave +echo "Jars ..." +ls -la ${JAR_PATH} diff --git a/install-swarm b/install-swarm new file mode 100755 index 0000000..f8dc7fc --- /dev/null +++ b/install-swarm @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -o nounset +set -o noclobber +set -o errexit +set -o pipefail + +echo "Jars: ${JAR_PATH}" +echo "Source: ${SRC_PATH}" +echo "Repo: ${SLAVE_REPO}" +echo "Version: ${SLAVE_VERSION}" + +# Save slave executable +curl --create-dirs -sSLo ${JAR_PATH}/swarm.jar ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.jar +chmod 755 ${JAR_PATH} +chmod 644 ${JAR_PATH}/swarm.jar + +# Save swarm source jar and docs +mkdir -p ${SRC_PATH}/swarm +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.jar +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.jar.md5 +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-javadoc.jar +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-javadoc.jar.md5 +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-sources.jar +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}-sources.jar.md5 +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.pom +cd ${SRC_PATH}/swarm && wget ${SWARM_REPO}/${SWARM_VERSION}/swarm-client-${SWARM_VERSION}.pom.md5 + +echo "Sources ..." +ls -la ${SRC_PATH}/swarm +echo "Jars ..." +ls -la ${JAR_PATH}