pipeline:
  test_emi:
    image: hub.ersoft.cn:5000/neutron/base
    pull: true
    commands:
      # 自动化测试
      - echo 'Test complete!'
      # 测试失败测则读取测试结果并退出
      # - exit '...测试失败'

  # 使用plugins/docker插件，构建release/master分支镜像，推送到harbor
  docker_emi_develop:
    image: plugins/docker
    dockerfile: emi/docker/Dockerfile
    tags: develop
    registry: harbor.peoplus.cn
    repo: harbor.peoplus.cn/neutron/emi
    secrets: [ docker_username, docker_password ]
    when:
      branch: develop

  docker_emi_release:
    image: plugins/docker
    dockerfile: emi/docker/Dockerfile
    tags: release
    registry: harbor.peoplus.cn
    repo: harbor.peoplus.cn/neutron/emi
    secrets: [ docker_username, docker_password ]
    when:
      branch: release

  docker_emi_master:
    image: plugins/docker
    dockerfile: emi/docker/Dockerfile
    tags: master
    registry: harbor.peoplus.cn
    repo: harbor.peoplus.cn/neutron/emi
    secrets: [ docker_username, docker_password ]
    when:
      branch: master
  
  wechat-success:
    image: clem109/drone-wechat
    # to_party/plugin_to_party The party ids to send message, |间隔
    # to_user/plugin_to_user The user ids to send the message to，|间隔
    # to_tag/plugin_to_tag The tag ids to send the message to，|间隔
    to_user: wangqg|zhengd
    secrets: [plugin_corpid, plugin_corp_secret, plugin_agent_id]
    title: Neutron Stars / ${DRONE_REPO_NAME} / ${DRONE_COMMIT_BRANCH}
    description: Oh yeah, ${DRONE_BUILD_NUMBER}号Build成功！更新内容：${DRONE_COMMIT_MESSAGE}, ${DRONE_COMMIT_AUTHOR}真棒！
    msg_url: ${DRONE_BUILD_LINK}
    btn_txt: 点击查看
    when:
      status: [ success ]

  wechat-failure:
    image: clem109/drone-wechat
    to_user: wangqg|zhengd
    secrets: [plugin_corpid, plugin_corp_secret, plugin_agent_id]
    title: Neutron Stars / ${DRONE_REPO_NAME} / ${DRONE_COMMIT_BRANCH}
    description: Oops, ${DRONE_BUILD_NUMBER} 号Build失败！更新内容：${DRONE_COMMIT_MESSAGE}，请 ${DRONE_COMMIT_AUTHOR} 检查并修复。
    msg_url: ${DRONE_BUILD_LINK}
    btn_txt: 点击查看
    when:
      status: [ failure ]

branches: [develop, release, master]


