• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: コミット

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


コミットメタ情報

リビジョンf9e672ca2e62fb060178cd94fb287587142b73c5 (tree)
日時2018-09-16 18:31:52
作者whitestar <whitestar@user...>
コミッターwhitestar

ログメッセージ

adds cache directories creation.

変更サマリ

差分

--- a/cookbooks/squid-proxy/CHANGELOG.md
+++ b/cookbooks/squid-proxy/CHANGELOG.md
@@ -1,5 +1,9 @@
11 # squid-proxy CHANGELOG
22
3+0.1.1
4+-----
5+- adds cache directories creation.
6+
37 0.1.0
48 -----
59 - Initial release of squid-proxy
--- /dev/null
+++ b/cookbooks/squid-proxy/Gemfile.lock
@@ -0,0 +1,22 @@
1+GEM
2+ remote: https://rubygems.org/
3+ specs:
4+ chef-api (0.8.0)
5+ logify (~> 0.1)
6+ mime-types
7+ logify (0.2.0)
8+ mime-types (3.2.2)
9+ mime-types-data (~> 3.2015)
10+ mime-types-data (3.2018.0812)
11+ stove (6.0.0)
12+ chef-api (~> 0.5)
13+ logify (~> 0.2)
14+
15+PLATFORMS
16+ ruby
17+
18+DEPENDENCIES
19+ stove
20+
21+BUNDLED WITH
22+ 1.16.0
--- a/cookbooks/squid-proxy/Rakefile
+++ b/cookbooks/squid-proxy/Rakefile
@@ -3,12 +3,56 @@ require 'rubocop/rake_task'
33 require 'foodcritic'
44 require 'stove/rake_task'
55
6+tpl_cookbook = '00cookbook'
7+cookbook_name = File.basename(Dir.pwd)
8+
9+desc 'Initialize project'
10+task :init do
11+ next if cookbook_name == tpl_cookbook
12+
13+ [
14+ '.foodcritic',
15+ '.rubocop.yml',
16+ 'Berksfile',
17+ 'concourse.yml',
18+ 'fly-vars.yml',
19+ 'fly-vars.local.yml',
20+ 'Gemfile',
21+ 'Gemfile.lock',
22+ 'version',
23+ ].each {|conf|
24+ sh "cp ../#{tpl_cookbook}/#{conf} ./" unless File.exist?(conf)
25+ }
26+
27+ ruby [
28+ %(-pne '$_.gsub!(/^cookbook-name: .*$/, "cookbook-name: #{cookbook_name}")'),
29+ '-i fly-vars.local.yml',
30+ ].join(' ')
31+end
32+
33+desc 'Update project'
34+task :update do
35+ next if cookbook_name == tpl_cookbook
36+
37+ [
38+ 'Rakefile',
39+ 'concourse.yml',
40+ 'fly-vars.yml',
41+ 'Gemfile',
42+ 'Gemfile.lock',
43+ ].each {|conf|
44+ sh "cp ../#{tpl_cookbook}/#{conf} ./"
45+ }
46+end
47+
48+desc 'fly set-pipeline'
649 task :'set-pipeline' do
750 sh [
8- "fly -t $CC_TARGET sp -p #{File.basename(Dir.pwd)}-cookbook -c concourse.yml",
9- '-l fly-vars.yml -l ~/sec/credentials-prod.yml',
51+ "fly -t $CC_TARGET sp -p #{cookbook_name}-cookbook -c concourse.yml",
52+ '-l fly-vars.yml -l fly-vars.local.yml -l ~/sec/credentials-prod.yml',
1053 ].join(' ')
1154 end
55+desc 'rake set-pipeline alias'
1256 task sp: 'set-pipeline'
1357
1458 namespace :style do
--- a/cookbooks/squid-proxy/concourse.yml
+++ b/cookbooks/squid-proxy/concourse.yml
@@ -1,13 +1,14 @@
11 ---
2-# $ fly -t $CC_TARGET sp -p squid-proxy-cookbook -c concourse.yml -l fly-vars.yml -l ~/credentials.yml
32 resources:
43 - name: src-git
54 type: git
65 source:
7- uri: git://git.osdn.net/gitroot/metasearch/grid-chef-repo.git
6+ uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
87 branch: master
98 paths:
109 - cookbooks/((cookbook-name))
10+ private_key: ((git-private-key))
11+ git_user: ((git-user-osdn))
1112 #check_every: 1h # default: 1m
1213 - name: chefdk-cache
1314 type: docker-image
@@ -22,7 +23,7 @@ resources:
2223 check_every: 6h # default: 1m
2324
2425 jobs:
25-- name: build-cookbook
26+- name: test-cookbook
2627 plan:
2728 - aggregate:
2829 - get: src-git
@@ -33,11 +34,10 @@ jobs:
3334 - task: ci-build
3435 image: chefdk-cache
3536 params:
36- http_proxy: ((http-proxy))
37+ http_proxy: ((http-proxy)) # e.g. http://proxy.example.com:3128
3738 #HTTP_PROXY: ((http-proxy))
3839 config:
3940 platform: linux
40-
4141 #image_resource:
4242 # type: docker-image
4343 # source:
@@ -48,10 +48,8 @@ jobs:
4848 #ca_certs:
4949 #- domain: ((registry-mirror-domain))
5050 # cert: ((docker-reg-ca-cert))
51-
5251 inputs:
5352 - name: src-git
54-
5553 run:
5654 #dir: ./src-git/cookbooks/((cookbook-name))
5755 #path: rake
@@ -63,3 +61,41 @@ jobs:
6361 bundle config --local silence_root_warning 1
6462 bundle install
6563 rake
64+- name: publish-cookbook
65+ plan:
66+ - aggregate:
67+ - get: src-git
68+ params:
69+ depth: 5
70+ trigger: false
71+ passed: [test-cookbook]
72+ - get: chefdk-cache
73+ passed: [test-cookbook]
74+ - task: publish
75+ image: chefdk-cache
76+ params:
77+ http_proxy: ((http-proxy))
78+ chef_username: ((chef-username))
79+ chef_client_key: ((chef-client-key))
80+ config:
81+ platform: linux
82+ inputs:
83+ - name: src-git
84+ run:
85+ path: /bin/bash
86+ args:
87+ - -c
88+ - |
89+ echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
90+ echo "$chef_client_key" > /root/chef-client-key.pem
91+ cd ./src-git/cookbooks/((cookbook-name))
92+ bundle config --local silence_root_warning 1
93+ bundle install
94+ rake publish
95+ - put: src-git
96+ params:
97+ repository: src-git
98+ tag_prefix: ((cookbook-name))-
99+ tag: src-git/cookbooks/((cookbook-name))/version
100+ only_tag: true
101+ annotate: src-git/cookbooks/((cookbook-name))/version
--- /dev/null
+++ b/cookbooks/squid-proxy/fly-vars.local.yml
@@ -0,0 +1,2 @@
1+---
2+cookbook-name: squid-proxy
--- a/cookbooks/squid-proxy/fly-vars.yml
+++ b/cookbooks/squid-proxy/fly-vars.yml
@@ -1,3 +1,2 @@
11 ---
2-cookbook-name: squid-proxy
32 chefdk-version: 1.6.11
--- a/cookbooks/squid-proxy/metadata.rb
+++ b/cookbooks/squid-proxy/metadata.rb
@@ -4,7 +4,7 @@ maintainer_email ''
44 license 'Apache 2.0'
55 description 'Installs/Configures squid-proxy'
66 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7-version '0.1.0'
7+version IO.read(File.join(File.dirname(__FILE__), 'version')).chomp
88 source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
99 issues_url 'https://osdn.jp/projects/metasearch/ticket'
1010
--- a/cookbooks/squid-proxy/recipes/server.rb
+++ b/cookbooks/squid-proxy/recipes/server.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: squid-proxy
33 # Recipe:: default
44 #
5-# Copyright 2017, whitestar
5+# Copyright 2017-2018, whitestar
66 #
77 # Licensed under the Apache License, Version 2.0 (the "License");
88 # you may not use this file except in compliance with the License.
@@ -32,6 +32,18 @@ service 'squid' do
3232 action :enable
3333 end
3434
35+node['squid-proxy']['conf']['extra_confs'].each {|line|
36+ skip unless line.start_with?('cache_dir')
37+ cache_dir = line.split(' ')[2]
38+ directory cache_dir do
39+ owner 'proxy'
40+ group 'proxy'
41+ mode '0755'
42+ recursive true
43+ action :create
44+ end
45+}
46+
3547 template '/etc/squid/squid.conf' do
3648 source 'etc/squid/squid.conf'
3749 owner 'root'
--- /dev/null
+++ b/cookbooks/squid-proxy/version
@@ -0,0 +1 @@
1+0.1.1
旧リポジトリブラウザで表示