platform: 10.11.92.34

clone:
  git:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-git:1.0
    pull: true
    dns: 223.5.5.5

pipeline:
  ## 读缓存
  read-cache:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-cache:1.0
    restore: true
    mount:
      - ./node_modules
    volumes:
      - /data/cache:/cache
    when:
      branch: 
        - gzga
  ## 构建
  build:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-node:12.18.0-stretch
    dns: 223.5.5.5
    volumes:
      - /data/cache/yarn:/usr/local/share/.cache/yarn
    commands:
      - yarn
      - yarn build
    when:
      branch: 
        - gzga

  # store-cache:
  #   image: registry.cn-qingdao.aliyuncs.com/wod/devops-cache:1.0
  #   rebuild: true
  #   mount:
  #     - ./node_modules
  #   volumes:
  #     - /data/cache:/cache
  #   when:
  #     branch: 
  #       - dev
    
  ## 编译成静态文件
  docker:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: hub.wodcloud.com/wod/ui-base:2.0-apaasv3
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.4
    channel: gzga
    args: "TARGETOS=linux,TARGETARCH=amd64" ## 不同架构的构建参数
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - gzga
  
  ## 更换dev生成镜像的名称
  harbor:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-alpha
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4
    registry: registry.cn-qingdao.aliyuncs.com
    secrets: 
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - master

  # 生成最终amd版本
  latest:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0
    registry: registry.cn-qingdao.aliyuncs.com
    secrets: 
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - master
  
  # 构建arm64位镜像
  docker-arm64:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: hub.wodcloud.com/wod/ui-base:2.0-apaasv3-arm64
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.4
    channel: gzga-arm64
    args: "TARGETOS=linux,TARGETARCH=arm64"
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - gzga
  
  ## 更换dev生成arm64镜像的名称
  # harbor-arm64:
  #   image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
  #   dns: 223.5.5.5
  #   volumes:
  #     - /var/run/docker.sock:/var/run/docker.sock
  #   source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-alpha-arm64
  #   target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-arm64
  #   registry: registry.cn-qingdao.aliyuncs.com
  #   secrets: 
  #     - source: REGISTRY_USER_ALIYUN
  #       target: REGISTRY_USER
  #     - source: REGISTRY_PASSWORD_ALIYUN
  #       target: REGISTRY_PASSWORD
  #   when:
  #     branch: 
  #       - [master,dev]
  
  # 生成最终arm版本
  # latest-arm64:
  #   image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
  #   dns: 223.5.5.5
  #   volumes:
  #     - /var/run/docker.sock:/var/run/docker.sock
  #   source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-arm64
  #   target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0-arm64
  #   registry: registry.cn-qingdao.aliyuncs.com
  #   secrets: 
  #     - source: REGISTRY_USER_ALIYUN
  #       target: REGISTRY_USER
  #     - source: REGISTRY_PASSWORD_ALIYUN
  #       target: REGISTRY_PASSWORD
  #   when:
  #     branch: 
  #       - [master,dev]

  docker-ppc64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: hub.wodcloud.com/wod/ui-base:2.0-apaasv3-ppc64le
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.4
    channel: alpha-ppc64le
    args: "TARGETOS=linux,TARGETARCH=ppc64le"
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - dev

  harbor-ppc64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-alpha-ppc64le
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-ppc64le
    registry: registry.cn-qingdao.aliyuncs.com
    secrets: 
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - master

  latest-ppc64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-ppc64le
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0-ppc64le
    registry: registry.cn-qingdao.aliyuncs.com
    secrets: 
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - master

  docker-mips64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: hub.wodcloud.com/wod/ui-base:2.0-apaasv3-mips64le
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.4
    channel: alpha-mips64le
    args: "TARGETOS=linux,TARGETARCH=mips64le"
    registry: registry.cn-qingdao.aliyuncs.com
    secrets:
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - dev

  harbor-mips64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-alpha-mips64le
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-mips64le
    registry: registry.cn-qingdao.aliyuncs.com
    secrets: 
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - master

  latest-mips64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker-tag:1.0
    dns: 223.5.5.5
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    source: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-mips64le
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0-mips64le
    registry: registry.cn-qingdao.aliyuncs.com
    secrets: 
      - source: REGISTRY_USER_ALIYUN
        target: REGISTRY_USER
      - source: REGISTRY_PASSWORD_ALIYUN
        target: REGISTRY_PASSWORD
    when:
      branch: 
        - master

  deploy:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-kubernetes:1.0
    namespace: apaas-v3
    deployment: apaas-ui
    container: apaas-ui
    registry: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.4-alpha
    when:
      branch: 
        - dev

     