diff --git a/.travis.yml b/.travis.yml index 7d4f3e1b..2dffb1cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,11 @@ services: - docker before_install: -- docker-compose build +- ./rename.py travis install: +- docker-compose build + +script: - docker-compose up -d slave - docker-compose stop diff --git a/docker-compose.yml b/docker-compose.yml index 041066ca..ef8a72fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ jenkins: - SERVICE_NAME=SPACENAME-ci git: - image: openmicroscopy/tags:5.1.1 + build: git volumes: - /src command: 'true' diff --git a/git/Dockerfile b/git/Dockerfile new file mode 100644 index 00000000..97f04b1e --- /dev/null +++ b/git/Dockerfile @@ -0,0 +1,13 @@ +FROM mini/base +MAINTAINER ome-devel@lists.openmicroscopy.org.uk + +ENV TAG 5.1.4 + +RUN apk-install git && \ + mkdir /src + +RUN time git clone --bare --depth=1 -b v$TAG git://github.com/ome/scripts/ /src/scripts.git +RUN time git clone --bare --depth=1 -b v$TAG git://github.com/openmicroscopy/openmicroscopy /src/omero.git +RUN time git clone --bare --depth=1 -b v$TAG git://github.com/openmicroscopy/bioformats /src/bio-formats.git + +WORKDIR /src diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index 1022e72b..86796778 100644 --- a/jenkins/Dockerfile +++ b/jenkins/Dockerfile @@ -2,9 +2,8 @@ FROM jenkins MAINTAINER OME USER root -RUN usermod -u 11521 jenkins +RUN usermod -u SPACEUSER jenkins RUN chown -R jenkins /usr/share/jenkins/ -RUN chown -R jenkins /var/log/copy_reference_file.log USER jenkins COPY plugins.txt /usr/share/jenkins/plugins.txt diff --git a/rename.py b/rename.py index da8b6fd0..d907678d 100755 --- a/rename.py +++ b/rename.py @@ -5,20 +5,33 @@ import fnmatch import os -def replace(name, branch): +def replace(name, branch, uid): + cnt = 0 for root, dir, files in os.walk("."): yml = list(fnmatch.filter(files, "*.yml")) xml = list(fnmatch.filter(files, "*.xml")) + dkr = list(fnmatch.filter(files, "Dockerfile")) for f in yml + xml: fname = os.path.join(root, f) print "Setting space to '%s' in %s" % (name, fname) for line in fileinput.input([fname], inplace=True): - line = line.replace("SPACENAME", name) - line = line.replace("SPACEBRANCH", name) + if "SPACE" in line: + cnt += 1 + line = line.replace("SPACENAME", name) + line = line.replace("SPACEBRANCH", name) print line, + for f in dkr: + fname = os.path.join(root, f) + for line in fileinput.input([fname], inplace=True): + if "SPACE" in line: + cnt += 1 + line = line.replace("SPACEUSER", str(uid)) + print line, + return cnt if __name__ == "__main__": parser = argparse.ArgumentParser() + parser.add_argument("--uid", type=int, default=os.getuid()) parser.add_argument("name") parser.add_argument("branch", nargs="?") ns = parser.parse_args() @@ -27,5 +40,6 @@ def replace(name, branch): if not branch: branch = name - replace(name, branch) + # This number will need to be updated when new changes are commited. + assert 19 == replace(name, branch, ns.uid) print "Done. You may want to review and commit your changes now" diff --git a/slave/Dockerfile b/slave/Dockerfile index 3e22643d..9c001154 100644 --- a/slave/Dockerfile +++ b/slave/Dockerfile @@ -6,7 +6,7 @@ ENV JENKINS_SWARM_VERSION 1.24 ENV HOME /home/jenkins-slave RUN useradd -c "Jenkins Slave user" -d $HOME -m jenkins-slave -RUN usermod -u 11521 jenkins-slave +RUN usermod -u SPACEUSER jenkins-slave RUN curl --create-dirs -sSLo /usr/share/jenkins/swarm-client-$JENKINS_SWARM_VERSION-jar-with-dependencies.jar http://maven.jenkins-ci.org/content/repositories/releases/org/jenkins-ci/plugins/swarm-client/$JENKINS_SWARM_VERSION/swarm-client-$JENKINS_SWARM_VERSION-jar-with-dependencies.jar \ && chmod 755 /usr/share/jenkins