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: 
        - dev
  ## 构建
  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: 
        - dev

  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: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    channel: alpha
    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: 
        - dev
  
  ## 更换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.2-alpha
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.2
    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.2
    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: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-arm64
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    channel: alpha-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: 
        - dev
  
  ## 更换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.2-alpha-arm64
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.2-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
  
  # 生成最终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.2-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

  docker-ppc64le:
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    base: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-ppc64le
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    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.2-alpha-ppc64le
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.2-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.2-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: registry.cn-qingdao.aliyuncs.com/wod-devops/ui-base:2.0-mips64le
    dockerfile: .beagle/dockerfile
    repo: wod/apaas-ui
    version: v3.0.2
    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.2-alpha-mips64le
    target: registry.cn-qingdao.aliyuncs.com/wod/apaas-ui:v3.0.2-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.2-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.2-alpha
    when:
      branch: 
        - dev
        
        
