diff --git a/README.md b/README.md index 9a854d4..be06c6c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository hosts the [Buildfarm](https://github.com/bazelbuild/bazel-buildf All commandline options override corresponding config settings. ``` -./mvnw clean package && java -jar target/bfmgr-0.0.1.jar +./mvnw clean package && java -jar target/bfmgr-.jar ``` Go to http://localhost:8080 and click Create. diff --git a/pom.xml b/pom.xml index 8494bbe..675b12e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.eightydegreeswest bfmgr - 0.0.1 + 0.0.2 bfmgr Buildfarm Manager diff --git a/src/main/java/com/eightydegreeswest/bfmgr/service/impl/BfMgrCtrlLocal.java b/src/main/java/com/eightydegreeswest/bfmgr/service/impl/BfMgrCtrlLocal.java index f6260bb..e088b65 100644 --- a/src/main/java/com/eightydegreeswest/bfmgr/service/impl/BfMgrCtrlLocal.java +++ b/src/main/java/com/eightydegreeswest/bfmgr/service/impl/BfMgrCtrlLocal.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Value; public class BfMgrCtrlLocal implements BfMgrCtrl { @@ -59,6 +60,12 @@ public class BfMgrCtrlLocal implements BfMgrCtrl { @Value("${remote.config.worker}") private String remoteWorkerConfig; + @Value("${tag.redis}") + private String redisTag; + + @Value("${tag.buildfarm}") + private String buildfarmTag; + @Override public List getBuildfarmClusters() throws UnknownHostException { List buildfarmClusters = new ArrayList<>(); @@ -105,6 +112,10 @@ public void createCluster(CreateClusterRequest createClusterRequest) throws IOEx downloadFile(remoteWorkerConfig, Paths.get(configPath + "/shard-worker.config").toFile()); createPath(casPath); + pullImage(redisRepo, redisTag); + pullImage(serverRepo, buildfarmTag); + pullImage(workerRepo, buildfarmTag); + CreateContainerResponse response = dockerClient.createContainerCmd(redisRepo) .withName(redisContainer) .withPortSpecs("6379:6379") @@ -160,4 +171,10 @@ private void downloadFile(String urlStr, File file) throws IOException { fos.close(); rbc.close(); } + + private void pullImage(String imageRepo, String tag) { + try { + dockerClient.pullImageCmd(imageRepo).withTag(tag).start().awaitCompletion(5, TimeUnit.MINUTES); + } catch (Exception e) { } + } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index df81b10..2ff6fa8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -10,4 +10,7 @@ config.path=/tmp/buildfarm cas.path=/tmp/worker remote.config.server=https://raw.githubusercontent.com/bazelbuild/bazel-buildfarm/master/examples/shard-server.config.example -remote.config.worker=https://raw.githubusercontent.com/bazelbuild/bazel-buildfarm/master/examples/shard-worker.config.example \ No newline at end of file +remote.config.worker=https://raw.githubusercontent.com/bazelbuild/bazel-buildfarm/master/examples/shard-worker.config.example + +tag.redis=5.0.9 +tag.buildfarm=latest \ No newline at end of file