Add DEPENDENCIES file and source Vagrant and tests versions from it.

- One unique file to list all dependencies and dependencies' versions (except Go, currently defined in `build/Dockerfile`).
- Custom versions can now be injected into Vagrant VMs.
- Vagrant dev VMs, Vagrant test VMs, and `run-integration-tests.sh` all source from `DEPENDENCIES`, to keep things 'DRY'.
- Vagrant versions can be overriden using environment variables, like it was possible in `run-integration-tests.sh`.
This commit is contained in:
Marc CARRE committed 2017-02-13 19:54:38 +00:00
1 parent 3ce8aec039
commit 1b45e8662e
5 files changed
+22 -4

No files matched your search

+14
View File
@@ -1,6 +1,20 @@
VAGRANT_IMAGE = 'bento/ubuntu-16.04'
VAGRANTFILE_API_VERSION = '2'
def get_dependencies_version_from_file_and_env()
dependencies_file = File.join(File.dirname(__FILE__), 'DEPENDENCIES')
# Read default version from the DEPENDENCIES file:
versions = File.readlines(dependencies_file).map{|line| line.strip.split('=')}.to_h
# Override with environment variables if defined:
versions.each do |k,v|
versions[k] = ENV.key?(k) ? ENV[k] : v
end
end
def ansibleize(h)
h.map{|k,v| [k.downcase, v]}.to_h
end
def get_go_version_from_build_dockerfile()
go_regexp = /FROM golang:(\S*).*?/
dockerfile_path = File.expand_path(File.join(File.dirname(__FILE__), 'build', 'Dockerfile'))