repos:
- name: reference-docs
  remote: https://github.com/kubernetes-sigs/reference-docs.git
  # This and the generate-command below needs a change when reference-docs has
  # branches properly defined
  branch: master
  generate-command: |
    cd $GOPATH
    # set the branch, ex: v1.17.0 while K8S_RELEASE=1.17
    # CAUTION: The script won't work if you set K8S_RELEASE=1.18.0 before 1.18 is formally released.
    # The `v${K8S_RELEASE}` string must be a valid tag name from the kubernetes repo, which
    # is only created after the formal release.
    git clone --depth=1 --single-branch --branch v${K8S_RELEASE} https://github.com/kubernetes/kubernetes.git src/k8s.io/kubernetes
    cd src/k8s.io/kubernetes
    make generated_files
    cp -L -R vendor $GOPATH/src
    rm -r vendor/github.com/spf13/cobra
    rm -r vendor/github.com/spf13/pflag

    # kubectl cmd pkg
    cp -R vendor/k8s.io/kubectl/pkg/cmd  pkg/kubectl/
    cd $GOPATH
    go get -v github.com/kubernetes-sigs/reference-docs/gen-compdocs
    cd src/github.com/kubernetes-sigs/reference-docs/

    # generate component tool pages
    make comp
    cd $GOPATH
    go get -v github.com/kubernetes-sigs/reference-docs/gen-kubectldocs
    cd src/github.com/kubernetes-sigs/reference-docs/

    # create versioned dirs if needed and fetch v${K8S_RELEASE}:swagger.json
    make updateapispec
    # generate kubectl cmd reference
    make copycli
    # generate api reference
    cd $GOPATH
    rm -rf src/vendor
    go get -u github.com/go-openapi/loads
    go get -u github.com/go-openapi/spec
    go get -v github.com/kubernetes-sigs/reference-docs/gen-apidocs
    cd src/github.com/kubernetes-sigs/reference-docs/
    make copyapi

  files:
  #- src: gen-compdocs/build/cloud-controller-manager.md
  #  dst: content/en/docs/reference/command-line-tools-reference/
  - src: gen-compdocs/build/kube-apiserver.md
    dst: content/en/docs/reference/command-line-tools-reference/
  - src: gen-compdocs/build/kube-controller-manager.md
    dst: content/en/docs/reference/command-line-tools-reference/
  # We have problems generating docs for kubelet, it is done manually now
  # - src: gen-compdocs/build/kubelet.md
  #   dst: content/en/docs/reference/command-line-tools-reference/
  - src: gen-compdocs/build/kube-proxy.md
    dst: content/en/docs/reference/command-line-tools-reference/
  - src: gen-compdocs/build/kube-scheduler.md
    dst: content/en/docs/reference/command-line-tools-reference/
  - src: gen-compdocs/build/kubectl.md
    dst: content/en/docs/reference/kubectl/
  - src: gen-compdocs/build/kubeadm*.md
    dst: content/en/docs/reference/setup-tools/kubeadm/generated/
