Skip to content

Commit

Permalink
move builder commands to service (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed Feb 18, 2017
1 parent 2350119 commit b8f688f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
3 changes: 1 addition & 2 deletions R/container.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ gce_vm_template <- function(template = c("rstudio","shiny","opencpu",
collapse = "\n")

cloud_init_file <- sprintf(cloud_init_file,
the_file,
build_tag, build_tag)
build_tag, build_tag, the_file)

} else {
warning("No template settings found for ", template)
Expand Down
2 changes: 1 addition & 1 deletion R/ssh_admin.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ gce_ssh_setup <- function(instance,
instance = ins,
project = project,
zone = zone)
gce_check_zone_op(job, verbose = FALSE)
gce_wait(job, verbose = FALSE)
myMessage("Public SSH key uploaded to instance", level = 3)
}

Expand Down
22 changes: 18 additions & 4 deletions inst/cloudconfig/builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@ users:
uid: 2000

write_files:
- path: /etc/systemd/system/builddocker.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Start Docker build service
[Service]
Type=oneshot
RemainAferExit=yes
Environment="HOME=/home/gcer"
ExecStartPre=/usr/share/google/dockercfg_update.sh
ExecStart=/usr/bin/docker build -t %s /home/gcer/build/
ExecStart=/usr/bin/docker push %s
- path: /home/gcer/build/Dockerfile
permissions: 0644
owner: root
content: |
%s

runcmd:
- cd /home/gcer/build && docker build -t %s .
- /usr/share/google/dockercfg_update.sh
- docker push %s
- systemctl daemon-reload
- systemctl start builddocker.service
2 changes: 1 addition & 1 deletion tests/testthat/test_bb_create_vm.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ test_that("We can set metadata on a VM", {

print(job)

gce_check_zone_op(job)
gce_wait(job)

vm <- gce_get_instance("rstudio-test")

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_instances.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ test_that("We can reset a VM", {

expect_equal(job$kind, "compute#operation")

gce_check_zone_op(job, wait = 10)
gce_wait(job, wait = 10)

cat("\nmarkdev VM reset")
inst <- gce_get_instance("markdev")
Expand All @@ -97,7 +97,7 @@ test_that("We can stop a VM", {

expect_equal(job$kind, "compute#operation")

gce_check_zone_op(job, wait = 10)
gce_wait(job, wait = 10)

cat("\nmarkdev VM stopped")
inst <- gce_get_instance("markdev")
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_machinetype.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test_that("We can change a machine type", {

expect_equal(mt$kind, "compute#operation")

job <- gce_check_zone_op(mt)
job <- gce_wait(mt)

expect_equal(job$status, "DONE")

Expand All @@ -62,7 +62,7 @@ test_that("We can change a machine type", {

expect_equal(mt$kind, "compute#operation")

job <- gce_check_zone_op(mt)
job <- gce_wait(mt)

expect_equal(job$status, "DONE")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_zzz_cleanup.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test_that("We can delete the test VMs",{

expect_equal(del$kind, "compute#operation")

vm <- gce_check_zone_op(del, wait = 10)
vm <- gce_wait(del, wait = 10)

expect_equal(vm$kind, "compute#operation")
expect_equal(vm$status, "DONE")
Expand Down

0 comments on commit b8f688f

Please sign in to comment.