Stuck with custom clone step (Windows build)

Hi there,

I’ve got an issue with Drone 1.0.0 in a multi-machine configuration (2 agents Linux/Windows).

In my build script called in build step, I’m using git project version with command: $ git describe --tags --always HEAD
That command returns nothing because Drone clone step does not use the --tags flag.

I’ve changed my YML file to do so, and it’s working for Linux but I still have issue with Windows.
I tried many things, but no ones were satisfying:

  • Tried the same code as written in documentation, with plugin/git or drone/git (because it’s for windows). It failed because drone/git:windows-1809-amd64 have a special entry point with drone-git.exe. Right ? Result: Crash in Drone Web UI
clone:
  disable: true
  
steps:
- name: clone
  image: drone/git
  commands:
  - git clone ${DRONE_REPO_LINK}
  • Tried to use the same image but with environment variables (from documentation). Result: variables seem to be not taken in account.
clone:
  disable: true
  
steps:
- name: clone
  image: drone/git
  environment:
    DRONE_REMOTE_URL: ${DRONE_COMMIT_LINK}
  • Tried to create my own Windows image (based on microsoft/windowsservercore:1803) with git installation through Choco and create a custom step. Result: The container freeze on "Cloning repo_name …"
clone:
  disable: true
  
steps:
- name: clone
  image: custom/git
  commands:
  - git clone ${DRONE_REPO_LINK}

I’m just stuck by this clone step on windows and I just wanna get the git project version, it’s my last difficulty to finish my CI installation.
FYI, I start Drone on Pull Request.

Any ideas ?

Many thanks,

You do not need to disable the clone step to fetch tags. Instead you should re-enable the default clone step, and then you can add a step to your pipeline that fetches tags. Like this:

kind: pipeline
name: default

steps:
- name: get_tags
  image: docker/git
  commands:
  - git fetch --tags

Note that on windows you will need to find a Docker image that is compatible with windows. I do not think the image in the above example will work on windows.

Thanks for your quick answer.

I didn’t found any compatible images. So, I built my own Git image with your YML recommendation but Drone was stuck on command "git fetch --tags". I was unable to get any additional information with --verbose flag.

I cloned drone-git and update powershell script to add --tags flag and build a custom drone/git image.

Thansk again for your help.