rancher / community-catalog

Catalog entries contributed by the community
384 stars 636 forks source link

Drone: fail to work with cache volume "Failed to unmarshal Volumes" #610

Closed aisensiy closed 6 years ago

aisensiy commented 7 years ago

Try to use drone with its Volume Cache with the following .drone.yml but get an error:

Failed to unmarshal Volumes

I already add a volume /tmp:/tmp for drone agent but it still doesn't work.

pipeline:
  restore-cache:
    image: drillster/drone-volume-cache
    restore: true
    mount: [ /drone/.gradle, /drone/.m2 ]
    volumes: /tmp/cache:/cache

  build:
    image: java:openjdk-8
    environment:
      - M2_HOME=/drone/.m2
      - MAVEN_HOME=/drone/.m2
      - GRADLE_USER_HOME=/drone/.gradle
    commands:
      - ./gradlew test

  rebuild-cache:
    image: drillster/drone-volume-cache
    rebuild: true
    mount: [ /drone/.gradle, /drone/.m2 ]
    volumes: /tmp/cache:/cache
    when: 
      status: [ success, failure ]

Drone version: drone: 0.8.0-rc.1-rancher1

Rancher versions: rancher/server: 1.6.7 rancher/agent: 1.2.5

Infrastructure Stack versions: healthcheck: 0.3.1 ipsec: network-services: 0.11.7 scheduler: 0.8.2

Docker version: (docker version,docker info preferred)

Client: Version: 1.12.6 API version: 1.24 Go version: go1.7.6 Git commit: a82d35e Built: Wed Aug 16 00:03:08 2017 OS/Arch: linux/amd64

Server: Version: 1.12.6 API version: 1.24 Go version: go1.7.6 Git commit: a82d35e Built: Wed Aug 16 00:03:08 2017 OS/Arch: linux/amd64

Operating system and kernel: (cat /etc/os-release, uname -r preferred)

NAME="Container Linux by CoreOS" ID=coreos VERSION=1465.6.0 VERSION_ID=1465.6.0 BUILD_ID=2017-08-16-0012 PRETTY_NAME="Container Linux by CoreOS 1465.6.0 (Ladybug)" ANSI_COLOR="38;5;75" HOME_URL="https://coreos.com/" BUG_REPORT_URL="https://issues.coreos.com" COREOS_BOARD="amd64-usr"

Type/provider of hosts: (VirtualBox/Bare-metal/AWS/GCE/DO)

vultr and aws

Setup details: (single node rancher vs. HA rancher, internal DB vs. external DB)

docker version rancher with internal DB

Environment Template: (Cattle/Kubernetes/Swarm/Mesos)

Cattle

And docker-compose.yml:

version: '2'
services:
  server:
    image: drone/drone:0.8.0-rc.1
    environment:
      DRONE_ADMIN: XXXXXXXX
      DRONE_DEBUG: 'false'
      DRONE_GITHUB: 'true'
      DRONE_GITHUB_CLIENT: XXXXXXX
      DRONE_GITHUB_SECRET: XXXXXXXXX
      DRONE_HOST: XXXXXXXXX
      DRONE_OPEN: 'false'
      DRONE_SECRET: XXXXXXXXXX
      GIN_MODE: release
      NO_PROXY: drone
      no_proxy: drone
    volumes_from:
    - server-volume
    labels:
      io.rancher.scheduler.affinity:host_label: drone=true
      io.rancher.sidekicks: server-volume
      io.rancher.container.hostname_override: container_name
  agent:
    privileged: true
    image: drone/agent:0.8.0-rc.1
    environment:
      DRONE_SECRET: XXXXXXXX
      DRONE_SERVER: drone:9000
      NO_PROXY: drone
      no_proxy: drone
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - /tmp:/tmp
    links:
    - server:drone
    command:
    - agent
    labels:
      io.rancher.scheduler.affinity:host_label: drone=true
      io.rancher.container.hostname_override: container_name
  lb:
    image: rancher/lb-service-haproxy:v0.6.4
    ports:
    - 8080:8080/tcp
    labels:
      io.rancher.scheduler.affinity:host_label: drone=true
      io.rancher.container.agent.role: environmentAdmin
      io.rancher.container.create_agent: 'true'
      io.rancher.scheduler.global: 'true'
  server-volume:
    image: rawmind/alpine-volume:0.0.2-1
    environment:
      SERVICE_GID: '0'
      SERVICE_UID: '0'
      SERVICE_VOLUME: /var/lib/drone
    network_mode: none
    volumes:
    - /var/lib/drone
    labels:
      io.rancher.container.start_once: 'true'
      io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
      io.rancher.container.hostname_override: container_name
vchav73 commented 6 years ago

I'm having a similar issue. Were you able to fix your issue? If so, how?

aisensiy commented 6 years ago

I think the issue is that DO NOT cache things out of the current directory. The mount: [ /drone/.gradle, /drone/.m2 ] is out of the current directory. Try use ./.gradle and ./.m2.