OSDN Git Service

improves Concourse pipeline configurations.
authorwhitestar <whitestar@users.osdn.me>
Mon, 17 Jul 2017 01:35:41 +0000 (10:35 +0900)
committerwhitestar <whitestar@users.osdn.me>
Mon, 17 Jul 2017 01:35:41 +0000 (10:35 +0900)
cookbooks/00cookbook/concourse.yml
cookbooks/00cookbook/metadata.rb
cookbooks/00cookbook/version [new file with mode: 0644]

index 405ec4c..0be0b34 100644 (file)
@@ -1,13 +1,26 @@
 ---
-# $ fly -t target sp -p 00cookbook-cookbook -c concourse.yml -l fly-vars.yml -l ~/credentials.yml
+# $ fly -t target sp -p 00cookbook-cookbook -c concourse.yml -l fly-vars.yml -l ~/sec/credentials-prod.yml
+resource_types:
+- name: ya-git
+  type: docker-image
+  source:
+    repository: whitestar/git-resource
+    registry_mirror: https://((registry-mirror-domain))
+    ca_certs:
+    - domain: ((registry-mirror-domain))
+      cert: ((docker-reg-ca-cert))
+
 resources:
 - name: src-git
-  type: git
+  type: ya-git
+  #type: git
   source:
-    uri: git://git.osdn.net/gitroot/metasearch/grid-chef-repo.git
+    uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
     branch: master
     paths:
     - cookbooks/((cookbook-name))
+    private_key: ((git-private-key))
+    git_user: ((git-user-osdn))
   #check_every: 1h  # default: 1m
 - name: chefdk-cache
   type: docker-image
@@ -22,7 +35,7 @@ resources:
   check_every: 12h  # default: 1m
 
 jobs:
-- name: build-cookbook
+- name: test-cookbook
   plan:
   - aggregate:
     - get: src-git
@@ -37,7 +50,6 @@ jobs:
       #HTTP_PROXY: ((http-proxy))
     config:
       platform: linux
-
       #image_resource:
       #  type: docker-image
       #  source:
@@ -48,10 +60,8 @@ jobs:
           #ca_certs:
           #- domain: ((registry-mirror-domain))
           #  cert: ((docker-reg-ca-cert))
-
       inputs:
       - name: src-git
-
       run:
         #dir: ./src-git/cookbooks/((cookbook-name))
         #path: rake
@@ -59,7 +69,42 @@ jobs:
         args:
         - -c
         - |
-          hostname -i
           cd ./src-git/cookbooks/((cookbook-name))
           bundle install
           rake
+- name: publish-cookbook
+  plan:
+  - aggregate:
+    - get: src-git
+      params:
+        depth: 5
+      trigger: false
+    - get: chefdk-cache
+  - task: publish
+    image: chefdk-cache
+    params:
+      http_proxy: ((http-proxy))
+      chef_username: ((chef-username))
+      chef_client_key: ((chef-client-key))
+    config:
+      platform: linux
+      inputs:
+      - name: src-git
+      run:
+        path: /bin/bash
+        args:
+        - -c
+        - |
+          echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
+          echo "$chef_client_key"  > /root/chef-client-key.pem
+          cd ./src-git/cookbooks/((cookbook-name))
+          bundle install
+          rake publish
+  - put: src-git
+    params:
+      repository: src-git
+      tag_prefix: ((cookbook-name))-
+      tag: src-git/cookbooks/((cookbook-name))/version
+      only_tag: true
+      annotate: src-git/cookbooks/((cookbook-name))/version
+      #annotate:   # path to a file containing the annotation message.
index a84a383..7968621 100644 (file)
@@ -4,11 +4,11 @@ maintainer_email ''
 license          'Apache 2.0'
 description      'Installs/Configures 00cookbook'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.1.0'
+version          IO.read(File.join(File.dirname(__FILE__), 'version')).chomp
 source_url       'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
 issues_url       'https://osdn.jp/projects/metasearch/ticket'
 
-chef_version          '>= 12'
+chef_version     '>= 12'
 %w( centos redhat ).each do |os|
   supports os, '>= 7.0'
 end
diff --git a/cookbooks/00cookbook/version b/cookbooks/00cookbook/version
new file mode 100644 (file)
index 0000000..6e8bf73
--- /dev/null
@@ -0,0 +1 @@
+0.1.0