containerci 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 308d69ece4c977ad2c95c3572eea0dfbbba58ccf
4
- data.tar.gz: 4efab62562715451af5fe4d8098bf54841c5dfe1
3
+ metadata.gz: 93858c0d6e36c0ef633a539616944fe4509b743d
4
+ data.tar.gz: 93fcc68718de639b9e620f13b576e4e45832dea9
5
5
  SHA512:
6
- metadata.gz: 1072683cb94e37691a9b3b2a8426cc2d30262e70c954477bfac762b3b5ea79f09b5e1b61772358e24229763ea00d3585dda4a46c5d82acb6750db0759f715c8c
7
- data.tar.gz: 0588b6ac0b5fc61f146ba462a8c982b80072554ac3e181cb72dfd95e11f1a80e579b4bbd941e4d2db1d42ac54402385b4de7adc456bd0e822195edc76aeafa65
6
+ metadata.gz: 76bf0b9484ab7a0a8c54a005eec9a58402efaea989a44f1c148980d95d90d6ee704eaff7a7ef2820e75c1f8403558481a71023521d4aeed793dc05e2b4da806b
7
+ data.tar.gz: 6439ed23bfdc3e97257e41c926346073388737a5b07fadafac6aa6517fa7a03f3d25a7b13b344b9048343bae4195db08df12490c79a9cbabc788f8d89ce9a614
data/ChangeLog.md CHANGED
@@ -9,3 +9,7 @@
9
9
  ## Changes since ContainerCI 0.3.0
10
10
 
11
11
  Fix git commands to handle tags correctly
12
+
13
+ ## Changes since ContainerCI 0.3.1
14
+
15
+ Improve caching approach.
data/README.md CHANGED
@@ -103,6 +103,12 @@ task :trigger_next_builds do
103
103
  end
104
104
  ```
105
105
 
106
+ ## Caching
107
+
108
+ ContainerCI takes advantage of the CircleCI cache to avoid rebuilding parts of the image that have not changed. Pulling images from Docker Hub is expensive; pulling in the cache is less so (but still takes a while!).
109
+
110
+ If you have made changes early on in your Dockerfile, you'll find that the cache kept by CircleCI is no longer valid--use CircleCI's 'Rebuild without cache' functionality to regenerate the cache based on newer information.
111
+
106
112
  ## Development
107
113
 
108
114
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,4 +1,4 @@
1
1
  # Rakefile toolkit for creating automated builds for Docker containers.
2
2
  module ContainerCI
3
- VERSION = '0.3.1'
3
+ VERSION = '0.4.0'
4
4
  end
data/lib/containerci.rb CHANGED
@@ -48,27 +48,25 @@ module ContainerCI
48
48
  puts 'done'
49
49
  end
50
50
 
51
- @dsl.define_task(:restore_cache) do
51
+ # XXX: I shouldn't save cache again and should instead rely on
52
+ # me flushing cache every once in a while. Maybe automate by
53
+ # looking for cache freshness.
54
+ @dsl.define_task(:docker_pull) do
55
+ docker_pull_cmds = 'false; ' \
56
+ 'until [ $? -eq 0 ]; do ' \
57
+ "docker pull #{USER}/#{PROJECT_NAME}:latest < /dev/null; done"
52
58
  puts 'Restoring from docker cache...'
53
59
  sh "if [ -e ~/docker/#{PROJECT_NAME}.tar ]; " \
54
60
  'then ' \
55
61
  ' echo "restoring from cache"; ' \
56
62
  " docker load -i ~/docker/#{PROJECT_NAME}.tar;" \
63
+ " #{docker_pull_cmds};" \
64
+ 'else ' \
65
+ ' echo "recreating cache"; ' \
66
+ " #{docker_pull_cmds};" \
67
+ " mkdir -p ~/docker; docker save #{USER}/#{PROJECT_NAME}:latest " \
68
+ " > ~/docker/#{PROJECT_NAME}.tar; " \
57
69
  'fi; '
58
- puts 'done'
59
- end
60
-
61
- @dsl.define_task(:raw_docker_pull) do
62
- puts 'Pulling from dockerhub...'
63
- sh 'false; ' \
64
- 'until [ $? -eq 0 ]; do ' \
65
- "docker pull #{USER}/#{PROJECT_NAME}:latest < /dev/null; done"
66
- puts 'done'
67
- end
68
-
69
- @dsl.define_task(:save_new_cache) do
70
- sh "mkdir -p ~/docker; docker save #{USER}/#{PROJECT_NAME}:latest > " \
71
- " ~/docker/#{PROJECT_NAME}.tar"
72
70
  end
73
71
 
74
72
  @dsl.define_task(:get_docker_machine) do
@@ -87,9 +85,6 @@ module ContainerCI
87
85
  'fi'
88
86
  end
89
87
 
90
- @dsl.define_task(docker_pull:
91
- [:restore_cache, :raw_docker_pull, :save_new_cache])
92
-
93
88
  @dsl.define_task(dependencies:
94
89
  [:update_github_project,
95
90
  :docker_pull,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: containerci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vince Broz