---
# $ fly -t target sp -p concourse-ci-cookbook -c concourse.yml -l fly-vars.yml -l ~/credentials.yml
resources:
- name: src-git
  type: git
  source:
    uri: git://git.osdn.net/gitroot/metasearch/grid-chef-repo.git
    branch: master
    paths:
    - cookbooks/((cookbook-name))
- name: chefdk-cache
  type: docker-image
  source:
    repository: chef/chefdk
    tag: ((chefdk-version))
    # ((param)) style: fly >= 3.2.0
    registry_mirror: https://((registry-mirror-domain))  # e.g. https://registry.docker.example.com:5000
    ca_certs:
    - domain: ((registry-mirror-domain))  # e.g. registry.docker.example.com:5000
      cert: ((docker-reg-ca-cert))

jobs:
- name: build-cookbook
  plan:
  - get: src-git
    trigger: true
  - get: chefdk-cache
  - task: ci-build
    image: chefdk-cache
    config:
      platform: linux

      #image_resource:
      #  type: docker-image
      #  source:
      #    repository: chef/chefdk
      #    tag: ((chefdk-version))
          # NG, setting disable
          #registry_mirror: https://((registry-mirror-domain))
          #ca_certs:
          #- domain: ((registry-mirror-domain))
          #  cert: ((docker-reg-ca-cert))

      inputs:
      - name: src-git

      run:
        #dir: ./src-git/cookbooks/((cookbook-name))
        #path: rake
        path: /bin/bash
        args:
        - -c
        - |
          cd ./src-git/cookbooks/((cookbook-name))
          bundle install
          rake
