# .cnb.yml
include:
  - https://cnb.cool/kevisual/cnb/-/blob/main/.cnb/template.yml

.common_env: &common_env
  env:
    TO_REPO: kevisual/cnb
    TO_URL: git.xiongxiao.me
    KUBECONFIG_CONTEXT: dev-cluster
    KUBECONFIG_DEPLOYMENT: blog
    KUBECONFIG_NAMESPACE: default
  imports:
    - https://cnb.cool/kevisual/env/-/blob/main/.env.development
  services:
    - docker
  
$:
  vscode:
    - docker:
        image: docker.cnb.cool/kevisual/dev-env:latest
      services:
        - vscode
        - docker
      imports: !reference  [.common_env, imports]
      # 开发环境启动后会执行的任务
      # stages:
      #   - name: pnpm install
      #     script: pnpm install

.common_sync_to_gitea: &common_sync_to_gitea
  - <<: *common_env
    stages: !reference [.common_sync_to_gitea_template, stages]

.common_sync_from_gitea: &common_sync_from_gitea
  - <<: *common_env
    stages: !reference [.common_sync_from_gitea_template, stages]

.common_deploy_kubectl: &common_deploy_kubectl
  - <<: *common_env
    stages: !reference [.kubectl_deploy_template, stages]

.common_build: &common_build
  - <<: *common_env
    stages: !reference [.build_images_template, stages]

main:
  web_trigger_sync_to_gitea: 
    - <<: *common_sync_to_gitea
  web_trigger_sync_from_gitea:
    - <<: *common_sync_from_gitea
  api_trigger_sync_to_gitea:
    - <<: *common_sync_to_gitea
  api_trigger_sync_from_gitea:
    - <<: *common_sync_from_gitea
  # other
  web_trigger_deploy_kubectl:
    - <<: *common_deploy_kubectl
  api_trigger_deploy_kubectl:
    - <<: *common_deploy_kubectl
  web_trigger_build:
    - <<: *common_build
  api_trigger_build:
    - <<: *common_build


