Replace default "clone" plugin step

Hello,

I am running Drone on a cluster of ARM 64 devices and the agents are failing when attempting to execute the default clone step at the beginning of the build.

This makes sense, as Docker image plugins/git is a Linux amd64 image which won’t run on Linux aarch64.

Is it possible to replace the default clone step or somehow change the image it is using?
I have my own aarch64 image that I’d like to use in place of the stock plugins/git one.

I tried placing a clone plugin step with my own image at the top of my pipeline, but that did not prevent the build from running the stock clone step which points to the default plugins/git image.

Thanks in advance,
Vassil

if you are using drone 0.6, you can customize the clone step as described in the 0.6 documentation. See http://docs.drone.io/cloning/ for examples

Thanks Brad - exactly what I needed!
I’ll give it a try.

Cheers,
Vassil

I tried the following:


clone:
  git:
    image: vassilvk/aarch64-drone-git

pipeline:
  build:
    image: vassilvk/aarch64-golang:1.8.1
    commands:
      - ls .
      - go get -v -d -insecure
      - go vet ./...
      - golint -set_exit_status ./...

When the build kicks in, I get two tasks executed simultaneously - “git” and “build”.
The “git” task always completes successfully, the “build” task fails with no messages in the build log (see image).

The strange thing is that it looks like the tasks run in parallel and most times “build” finishes before the “git” task completes.

I am running Drone 0.6.0-rc.1 in Docker swarm mode - both drone server and agent based on this image.

have you tried with drone/drone:0.6.0 stable instead of rc.1?

Hi Brad,

This morning I cut a new Drone 0.6.0 image and tested the same scenario (recreated database and project repo activation, etc.).

I got the same result.

There are two tasks running in parallel - “git” and “build”.

The “git” task passes with exit code 0.

The “build” task fails at different spots in the execution – sometimes at the beginning of the build script, sometimes in the middle. Exit code is always 127 (see new snapshot below – this time it made it past the ls command but got cut off while doing go get).

It looks like a timing issue caused by the fact that both tasks run in parallel while I think “build” should not run before cloning is complete.
Another odd thing is that the “git” task seems to be doing git init instead of git clone, yet the repo is cloned as evident by the result of ls (see snapshot).

Am I overriding the clone task correctly? I followed the docs.

Here are the logs from the agent and the server:

Agent

pipeline: received next execution: 7
pipeline: finish uploading logs: application/json+logs: step 7: git
pipeline: finish uploading logs: 7: step git
pipeline: finish uploading logs: application/json+logs: step 7: build
pipeline: finish uploading logs: 7: step build
pipeline: execution complete: 7
pipeline: cancel channel closed: 7
pipeline: request next execution
pipeline: cancel ping loop: 7

Server

time="2017-05-22T12:34:02Z" level=error msg="pull queue item: 7: successfully removed from backup" 

Front-end

Cheers,
Vassil

try adding a dummy argument to your plugin configuration (it can be called anything)

clone:
  git:
    image: vassilvk/aarch64-drone-git
    dummy: true

the logic to determine if something is a plugin vs service vs build step currently assumes that a plugin has to have > 0 configuration parameters. So in this case I think it is assuming your plugin is actually a service and it is therefore being daemonized.

Hi Brad,

This seems to help, somewhat.
The tasks execute sequentially now, but the build still fails without any output (besides exit code 127).

When I change the build to simply list the current folder’s content, the build passes, but I see no output in the build logs.

Build definition

clone:
  git:
    image: vassilvk/aarch64-drone-git
    dummy: true

pipeline:
  build:
    image: vassilvk/aarch64-golang:1.8.1
    commands:
      - ls .

Front-end with “ls” only - note how both tasks include no output:

I feel like I’m missing something. Note that the repository is set as “Trusted” - switching back to non-Trusted doesn’t seem to make a difference.

Is it possible that the issue is caused by the fact that I’m running this in Docker Swarm mode, and not Docker Compose? Technically there should be no difference as both tools simply orchestrate containers, but who knows…

Cheers,
Vassil

Does your swarm instance use a custom logging driver?

No, it’s a vanilla Docker Swarm mode setup with 4 nodes (Docker version 17.04.0-ce) running off of the following docker-compose.yml:


version: "3"

services:
  drone:
    image: vassilvk/aarch64-drone:0.6.0

    volumes:
      - drone_data:/var/lib/drone/
    ports:
      - "8000:8000"
    environment:
      - DRONE_OPEN=false
      - DRONE_ADMIN=vassilvk
      - DRONE_GITHUB=true
      - DRONE_SERVER_HOST=http://
      - DRONE_GITHUB_CLIENT=
      - DRONE_GITHUB_SECRET=
      - DRONE_SECRET=

  agent:
    image: vassilvk/aarch64-drone:0.6.0
    entrypoint: "sh -c 'sleep 5 && /drone agent'"
    command: ""
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SECRET=
      - DRONE_SERVER=ws://drone:8000/ws/broker

volumes:
  drone_data:
    driver: local
    driver_opts:
      type: nfs
      o: addr=nas,rw,nfsvers=4
      device: ":/volume1/nfs/app/drone/data"


I am pulling the server\agent logs from the respective container’s stdout\sterr.

I’m wondering if there is a place where I can see the build logs on the back-end or on one of the container’s file system?