From fcf76a668e56de723562a9edab5953916409eaa6 Mon Sep 17 00:00:00 2001 From: whitestar Date: Sun, 23 Sep 2018 16:39:05 +0900 Subject: [PATCH] adds the latest Ubuntu support. --- cookbooks/docker-grid/CHANGELOG.md | 4 ++++ cookbooks/docker-grid/recipes/engine.rb | 1 + .../default/etc/apt/sources.list.d/docker.list | 26 ++++++++++++++++++++-- cookbooks/docker-grid/version | 2 +- roles/docker4latest_ubuntu.rb | 8 +++---- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/cookbooks/docker-grid/CHANGELOG.md b/cookbooks/docker-grid/CHANGELOG.md index d57d135..f3a1545 100644 --- a/cookbooks/docker-grid/CHANGELOG.md +++ b/cookbooks/docker-grid/CHANGELOG.md @@ -1,5 +1,9 @@ # docker-grid CHANGELOG +1.3.2 +----- +- adds the latest Ubuntu support. + 1.3.1 ----- - removes an extra attribute. diff --git a/cookbooks/docker-grid/recipes/engine.rb b/cookbooks/docker-grid/recipes/engine.rb index a08c36e..34d5996 100644 --- a/cookbooks/docker-grid/recipes/engine.rb +++ b/cookbooks/docker-grid/recipes/engine.rb @@ -287,6 +287,7 @@ when 'debian' owner 'root' group 'root' mode '0644' + helpers Chef::Mixin::ShellOut notifies :run, 'bash[apt-key_adv_docker_tools_key]', :before notifies :run, "execute[#{apt_get_update}]", :immediately end diff --git a/cookbooks/docker-grid/templates/default/etc/apt/sources.list.d/docker.list b/cookbooks/docker-grid/templates/default/etc/apt/sources.list.d/docker.list index 5611a98..16c32a9 100644 --- a/cookbooks/docker-grid/templates/default/etc/apt/sources.list.d/docker.list +++ b/cookbooks/docker-grid/templates/default/etc/apt/sources.list.d/docker.list @@ -14,13 +14,35 @@ if !override_apt_line.nil? && !override_apt_line.empty? <%= override_apt_line %> <% else + apt_repo_url = node['docker-grid']['apt_repo']['url'] + if enable_new_repo + codename = node['lsb']['codename'] + codename = +codename # unfreeze + + # for the latest Ubuntu + if node['platform'] == 'ubuntu' + lap_behind = ['trusty', 'xenial', 'yakkety', 'zesty'] + result = shell_out!(%q(curl -sS https://download.docker.com/linux/ubuntu/dists/ | awk -F']*>' '/<\/a>/ {print $2}' | tr -d / | grep -v '\.\.' | sort)) + codenames = result.stdout.chomp.split("\n") if result.exitstatus.zero? && !result.stdout.chomp.empty? + if codenames.include?(codename) + Chef::Log.info("Ubuntu #{codename} is supported by the dockerproject.") + else + codenames.reverse_each {|cn| + next if lap_behind.include?(cn) + + Chef::Log.warn("Ubuntu #{codename} is not supported by the dockerproject yet, use #{cn} repository instead.") + codename = cn # latest codename + break + } + end + end -%> -deb [arch=<%= arch %>] <%= node['docker-grid']['apt_repo']['url'] %> <%= node['lsb']['codename'] %> <%= node['docker-grid']['dockerproject']['apt_new_repo_sections'] %> +deb [arch=<%= arch %>] <%= apt_repo_url %> <%= codename %> <%= node['docker-grid']['dockerproject']['apt_new_repo_sections'] %> <% else -%> -deb <%= node['docker-grid']['apt_repo']['url'] %> <%= platform %>-<%= node['lsb']['codename'] %> main +deb <%= apt_repo_url %> <%= platform %>-<%= codename %> main <% end end diff --git a/cookbooks/docker-grid/version b/cookbooks/docker-grid/version index 3a3cd8c..1892b92 100644 --- a/cookbooks/docker-grid/version +++ b/cookbooks/docker-grid/version @@ -1 +1 @@ -1.3.1 +1.3.2 diff --git a/roles/docker4latest_ubuntu.rb b/roles/docker4latest_ubuntu.rb index 3992e4b..ee95ee1 100644 --- a/roles/docker4latest_ubuntu.rb +++ b/roles/docker4latest_ubuntu.rb @@ -1,5 +1,5 @@ # -# Copyright 2016-2017, whitestar +# Copyright 2016-2018, whitestar # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ # name 'docker4latest_ubuntu' -description 'Docker for the latest Ubuntu' +description '*DEPRECATED* Docker for the latest Ubuntu' run_list( 'role[docker]', @@ -36,8 +36,8 @@ override_attributes( 'apt_repo' => { # new repo. # Check https://download.docker.com/linux/ubuntu/dists - 'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable', - #'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable', + 'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable', + #'override_apt_line' => 'deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable', # old repo. #'override_apt_line' => 'deb https://apt.dockerproject.org/repo ubuntu-zesty main', #'override_apt_line' => 'deb https://apt.dockerproject.org/repo ubuntu-xenial main', -- 2.11.0