OSDN Git Service

77f4b1f38c448909496d498acb6f8df97f33d787
[metasearch/grid-chef-repo.git] / cookbooks / concourse-ci / concourse.yml
1 ---
2 # $ fly -t $CC_TARGET sp -p concourse-ci-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
3 resources:
4 - name: src-git
5   type: git
6   source:
7     uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
8     branch: master
9     paths:
10     - cookbooks/((cookbook-name))
11     private_key: ((git-private-key))
12     git_user: ((git-user-osdn))
13   #check_every: 1h  # default: 1m
14 - name: chefdk-cache
15   type: docker-image
16   source:
17     repository: chef/chefdk
18     tag: ((chefdk-version))
19     # ((param)) style: fly >= 3.2.0
20     registry_mirror: https://((registry-mirror-domain))  # e.g. https://registry.docker.example.com:5000
21     ca_certs:
22     - domain: ((registry-mirror-domain))  # e.g. registry.docker.example.com:5000
23       cert: ((docker-reg-ca-cert))
24   check_every: 6h  # default: 1m
25
26 jobs:
27 - name: test-cookbook
28   plan:
29   - aggregate:
30     - get: src-git
31       params:
32         depth: 5
33       trigger: true
34     - get: chefdk-cache
35   - task: ci-build
36     image: chefdk-cache
37     params:
38       http_proxy: ((http-proxy))  # e.g. http://proxy.example.com:3128
39       #HTTP_PROXY: ((http-proxy))
40     config:
41       platform: linux
42       #image_resource:
43       #  type: docker-image
44       #  source:
45       #    repository: chef/chefdk
46       #    tag: ((chefdk-version))
47           # NG, setting disable
48           #registry_mirror: https://((registry-mirror-domain))
49           #ca_certs:
50           #- domain: ((registry-mirror-domain))
51           #  cert: ((docker-reg-ca-cert))
52       inputs:
53       - name: src-git
54       run:
55         #dir: ./src-git/cookbooks/((cookbook-name))
56         #path: rake
57         path: /bin/bash
58         args:
59         - -c
60         - |
61           cd ./src-git/cookbooks/((cookbook-name))
62           bundle config --local silence_root_warning 1
63           bundle install
64           rake
65 - name: publish-cookbook
66   plan:
67   - aggregate:
68     - get: src-git
69       params:
70         depth: 5
71       trigger: false
72       passed: [test-cookbook]
73     - get: chefdk-cache
74       passed: [test-cookbook]
75   - task: publish
76     image: chefdk-cache
77     params:
78       http_proxy: ((http-proxy))
79       chef_username: ((chef-username))
80       chef_client_key: ((chef-client-key))
81     config:
82       platform: linux
83       inputs:
84       - name: src-git
85       run:
86         path: /bin/bash
87         args:
88         - -c
89         - |
90           echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
91           echo "$chef_client_key"  > /root/chef-client-key.pem
92           cd ./src-git/cookbooks/((cookbook-name))
93           bundle config --local silence_root_warning 1
94           bundle install
95           rake publish
96   - put: src-git
97     params:
98       repository: src-git
99       tag_prefix: ((cookbook-name))-
100       tag: src-git/cookbooks/((cookbook-name))/version
101       only_tag: true
102       annotate: src-git/cookbooks/((cookbook-name))/version