Skip to content

Commit

Permalink
layer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Aug 6, 2017
1 parent dec73b7 commit d24bfe3
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 39 deletions.
52 changes: 13 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
33 changes: 33 additions & 0 deletions install-slave
Original file line number Diff line number Diff line change
@@ -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}
32 changes: 32 additions & 0 deletions install-swarm
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit d24bfe3

Please sign in to comment.