How can I remove the --no-tags parameter of the git fetch command?

By default, drone will execute first:
git remote add origin <repository.git>

Then execute:
git fetch --no-tags origin +refs/heads/master

But I don’t want to have the --no-tags parameter on the second command. What should I do?

The reason is that I need to execute git describe --tags in the shell to get the current version.

Thank you all!

1 Like

UPDATED as of Drone 1.x tags are no longer fetched by default. If you would like to fetch tags you can add the following step to your pipeline:

kind: pipeline
type: docker
name: default

steps:
+ - name: fetch
+   image: alpine/git
+   commands:
+   - git fetch --tags

  - name: build
    image: golang
    commands:
    - go build
    - go test
2 Likes

Not sure why, but this doesn’t work for me.

@rmorshea the syntax in this post is intended for older version of Drone (I will edit accordingly). For newer versions of Drone you can use this guide to customize cloning:
https://docs.drone.io/pipeline/docker/syntax/cloning/