containerci 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +4 -0
- data/README.md +6 -0
- data/lib/containerci/version.rb +1 -1
- data/lib/containerci.rb +13 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93858c0d6e36c0ef633a539616944fe4509b743d
|
4
|
+
data.tar.gz: 93fcc68718de639b9e620f13b576e4e45832dea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76bf0b9484ab7a0a8c54a005eec9a58402efaea989a44f1c148980d95d90d6ee704eaff7a7ef2820e75c1f8403558481a71023521d4aeed793dc05e2b4da806b
|
7
|
+
data.tar.gz: 6439ed23bfdc3e97257e41c926346073388737a5b07fadafac6aa6517fa7a03f3d25a7b13b344b9048343bae4195db08df12490c79a9cbabc788f8d89ce9a614
|
data/ChangeLog.md
CHANGED
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.
|
data/lib/containerci/version.rb
CHANGED
data/lib/containerci.rb
CHANGED
@@ -48,27 +48,25 @@ module ContainerCI
|
|
48
48
|
puts 'done'
|
49
49
|
end
|
50
50
|
|
51
|
-
|
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,
|