• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: コミット

Grid環境構築用のChefリポジトリです。


コミットメタ情報

リビジョン667551d0cf13dc7f720b386f6e073c81b8a483a8 (tree)
日時2018-08-22 21:32:15
作者whitestar <whitestar@user...>
コミッターwhitestar

ログメッセージ

adds the latest docker-compose installation.

変更サマリ

差分

--- a/cookbooks/docker-grid/README.md
+++ b/cookbooks/docker-grid/README.md
@@ -51,7 +51,7 @@ This cookbook sets up Docker engine etc.
5151 |`['docker-grid']['compose']['install_flavor']`|String|`'dockerproject'` or `'os-repository'` or `'pypi'`|`'dockerproject'`|
5252 |`['docker-grid']['compose']['skip_setup']`|Boolean||`false`|
5353 |`['docker-grid']['compose']['auto_upgrade']`|Boolean|upgrade/reinstall the docker-compose automatically. Note: this flag is ignored in the case of `os-repository`.|`false`|
54-|`['docker-grid']['compose']['version']`|String|Note: this version is ignored in the case of `os-repository`, do not use empty value.|`'1.21.1'`|
54+|`['docker-grid']['compose']['version']`|String|Note: this version is ignored in the case of `os-repository`. `''` (empty) means the latest version. This version is ignored in the case of `'os-repository'`.|`'1.21.1'`|
5555 |`['docker-grid']['compose']['release_base_url']`|String||`"https://github.com/docker/compose/releases/download/#{['docker-grid']['compose']['version']}"`|
5656 |`['docker-grid']['compose']['release_url']`|String||`"#{node['docker-grid']['compose']['release_base_url']}/docker-compose-#{node['kernel']['name']}-#{node['kernel']['machine']}"`|
5757 |`['docker-grid']['compose']['home_dir']`|String||`'/opt/docker-compose'`|
--- a/cookbooks/docker-grid/recipes/compose.rb
+++ b/cookbooks/docker-grid/recipes/compose.rb
@@ -78,8 +78,20 @@ when 'dockerproject'
7878 release_url = node['docker-grid']['compose']['release_url']
7979 expected_ver = release_url.match(/(\d+\.\d+.\d+)/)
8080 expected_ver = expected_ver[1] unless expected_ver.nil?
81- # TODO: latest version
82- # %x(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name).chomp
81+ # latest version
82+ if expected_ver.nil?
83+ pkgs = ['jq']
84+ pkgs.prepend('epel-release') if node['platform_family'] == 'rhel'
85+ pkgs.each {|pkg|
86+ resources(package: pkg) rescue package pkg do
87+ action :install
88+ end
89+ }
90+
91+ result = shell_out!('curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name')
92+ expected_ver = result.stdout.chomp if result.exitstatus.zero? && !result.stdout.chomp.empty?
93+ release_url = "https://github.com/docker/compose/releases/download/#{expected_ver}/docker-compose-#{node['kernel']['name']}-#{node['kernel']['machine']}"
94+ end
8395
8496 execute 'install_docker_compose' do
8597 user 'root'
@@ -113,6 +125,6 @@ when 'pypi'
113125 command "pip install docker-compose#{pin_ver}"
114126 action :run
115127 not_if "pip list | grep docker-compose | grep '(#{expected_ver})'" unless expected_ver.empty?
116- not_if "pip list | grep docker-compose" unless auto_upgrade
128+ not_if 'pip list | grep docker-compose' unless auto_upgrade
117129 end
118130 end
旧リポジトリブラウザで表示