kind: pipeline
name: zjk
trigger:
  branch:
    - master
clone:
  disable: true

volumes:
  - name: docker-sock
    host:
      path: /var/run/docker.sock

##-------------------------------流水线⬇-------------------------------##
steps:
  - name: fetch
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-git:1.0
    network_mode: host

  - name: s3-cache
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-s3-cache:1.0
    network_mode: host
    settings:
      endpoint: http://cache.wodcloud.com
      access_key:
        from_secret: ACCESS_KEY_MINIO
      secret_key:
        from_secret: SECRET_KEY_MINIO

  - name: build
    image: hub.wodcloud.com/base/openjdk17:17-jdk-slim
    commands:
      - mvn clean install -Dmaven.test.skip=true

  - name: s3-cache-build
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-s3-cache:1.0
    network_mode: host
    settings:
      rebuild: true
      hash: pom.xml
      mount:
        - .repository
      endpoint: http://cache.wodcloud.com
      access_key:
        from_secret: ACCESS_KEY_MINIO
      secret_key:
        from_secret: SECRET_KEY_MINIO
  #  - name: docker-system-amd64
  #    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
  #    volumes:
  #      - name: docker-sock
  #        path: /var/run/docker.sock
  #    settings:
  #      base: registry.cn-qingdao.aliyuncs.com/wod/openjdk:11.0-jdk-amd64 # 基础镜像
  #      dockerfile: .beagle/dockerfile.system
  #      repo: zjk/system
  #      version: "1.0"
  #      channel: amd64
  #      args: "TARGETOS=linux,TARGETARCH=amd64"
  #      registry: hub.wodcloud.com
  #      registry_user:
  #        from_secret: REGISTRY_USER
  #      registry_password:
  #        from_secret: REGISTRY_PASSWORD
  #  - name: docker-auth-amd64
  #    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
  #    volumes:
  #      - name: docker-sock
  #        path: /var/run/docker.sock
  #    settings:
  #      base: registry.cn-qingdao.aliyuncs.com/wod/openjdk:11.0-jdk-amd64 # 基础镜像
  #      dockerfile: .beagle/dockerfile.auth
  #      repo: zjk/auth
  #      version: "1.0"
  #      channel: amd64
  #      args: "TARGETOS=linux,TARGETARCH=amd64"
  #      registry: hub.wodcloud.com
  #      registry_user:
  #        from_secret: REGISTRY_USER
  #      registry_password:
  #        from_secret: REGISTRY_PASSWORD
  #  - name: docker-resource-amd64
  #    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
  #    volumes:
  #      - name: docker-sock
  #        path: /var/run/docker.sock
  #    settings:
  #      base: registry.cn-qingdao.aliyuncs.com/wod/openjdk:11.0-jdk-amd64 # 基础镜像
  #      dockerfile: .beagle/dockerfile.resource
  #      repo: zjk/resource
  #      version: "1.0"
  #      channel: amd64
  #      args: "TARGETOS=linux,TARGETARCH=amd64"
  #      registry: hub.wodcloud.com
  #      registry_user:
  #        from_secret: REGISTRY_USER
  #      registry_password:
  #        from_secret: REGISTRY_PASSWORD
  #  - name: docker-zjkapi-amd64
  #    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
  #    volumes:
  #      - name: docker-sock
  #        path: /var/run/docker.sock
  #    settings:
  #      base: registry.cn-qingdao.aliyuncs.com/wod/openjdk:11.0-jdk-amd64 # 基础镜像
  #      dockerfile: .beagle/dockerfile.zjkapi
  #      repo: zjk/zjk-api
  #      version: "1.0"
  #      channel: amd64
  #      args: "TARGETOS=linux,TARGETARCH=amd64"
  #      registry: hub.wodcloud.com
  #      registry_user:
  #        from_secret: REGISTRY_USER
  #      registry_password:
  #        from_secret: REGISTRY_PASSWORD

  - name: docker-zjkapi-arm64
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - name: docker-sock
        path: /var/run/docker.sock
    settings:
      base: hub.wodcloud.com/base/openjdk17:17-jdk-slim
      dockerfile: .beagle/dockerfile.resource
      repo: zjk/zjk-api
      version: "1.0"
      channel: arm64
      args: "TARGETOS=linux,TARGETARCH=arm64"
      registry: hub.wodcloud.com
      registry_user:
        from_secret: REGISTRY_USER
      registry_password:
        from_secret: REGISTRY_PASSWORD
  - name: docker-auth-arm64
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - name: docker-sock
        path: /var/run/docker.sock
    settings:
      base: hub.wodcloud.com/base/openjdk17:17-jdk-slim
      dockerfile: .beagle/dockerfile.auth
      repo: zjk/auth
      version: "1.0"
      channel: arm64
      args: "TARGETOS=linux,TARGETARCH=arm64"
      registry: hub.wodcloud.com
      registry_user:
        from_secret: REGISTRY_USER
      registry_password:
        from_secret: REGISTRY_PASSWORD
  - name: docker-system-arm64
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - name: docker-sock
        path: /var/run/docker.sock
    settings:
      base: hub.wodcloud.com/base/openjdk17:17-jdk-slim
      dockerfile: .beagle/dockerfile.system
      repo: zjk/system
      version: "1.0"
      channel: arm64
      args: "TARGETOS=linux,TARGETARCH=arm64"
      registry: hub.wodcloud.com
      registry_user:
        from_secret: REGISTRY_USER
      registry_password:
        from_secret: REGISTRY_PASSWORD
  - name: docker-resource-arm64
    image: registry.cn-qingdao.aliyuncs.com/wod/devops-docker:1.0
    volumes:
      - name: docker-sock
        path: /var/run/docker.sock
    settings:
      base: hub.wodcloud.com/base/openjdk17:17-jdk-slim
      dockerfile: .beagle/dockerfile.resource
      repo: zjk/resource
      version: "1.0"
      channel: arm64
      args: "TARGETOS=linux,TARGETARCH=arm64"
      registry: hub.wodcloud.com
      registry_user:
        from_secret: REGISTRY_USER
      registry_password:
        from_secret: REGISTRY_PASSWORD



##--------------对于需要保密的信息隐藏，减少账户信息的泄密⬇-----------------##
---
kind: secret
name: REGISTRY_USER
get:
  name: REGISTRY_USER
  path: devops-secrets
---
kind: secret
name: REGISTRY_PASSWORD
get:
  name: REGISTRY_PASSWORD
  path: devops-secrets
---
kind: secret
name: KUBERNETES_SERVER
get:
  name: KUBERNETES_SERVER
  path: devops-secrets
---
kind: secret
name: KUBERNETES_TOKEN
get:
  name: KUBERNETES_TOKEN
  path: devops-secrets
---
kind: secret
name: ACCESS_KEY_MINIO
get:
  name: ACCESS_KEY_MINIO
  path: devops-secrets

---
kind: secret
name: SECRET_KEY_MINIO
get:
  name: SECRET_KEY_MINIO
  path: devops-secrets
