pantheon-systems / autotag

Git repository version tagging tool
http://godoc.org/github.com/pantheon-systems/autotag
Apache License 2.0
190 stars 42 forks source link

Not working in Drone CI, but works locally with same repo #68

Closed b-ferreira closed 2 years ago

b-ferreira commented 2 years ago

Hello,

I'm trying to use Autotag in one of my pipelines in Drone CI.

I always get the following error message:

2021/12/10 10:14:26 Error initializing: no stable (non pre-release) version tags found

Here's my pipeline configuration:

kind: pipeline
type: kubernetes
name: tag-repo

steps:
  - name: autotag
    image: node:14
    commands:
      - curl -sL https://git.io/autotag-install | sh -s -- -b /usr/bin
      - git --version
      - autotag -n -b dev

trigger:
  branch:
    - dev-ci
  event:
    - push

I'm adding git --version to make sure that I have git 2.X+ available in the PATH. And I'm using the -n option just to validate if Autotag is working correctly for now.

Here's the output:

1   + curl -sL https://git.io/autotag-install | sh -s -- -b /usr/bin
2   pantheon-systems/autotag info checking GitHub for latest tag
3   pantheon-systems/autotag info found version: 1.3.13 for v1.3.13/linux/amd64
4   pantheon-systems/autotag info installed /usr/bin/autotag
32  + git --version
33  git version 2.11.0
34  + autotag -n -b dev
35  2021/12/10 10:14:26 Error initializing: no stable (non pre-release) version tags found

If I run the same command locally in the same repository it manages to compute the next tag normaly.

Is there any trick or extra configuration that I need to make this work in Drone CI?

djschaap commented 2 years ago

Did you create/push a release tag as mentioned in the README - something like v0.0.0?

joemiller commented 2 years ago

Like @djschaap said, you need to have an initial tag that conforms to the pattern autotag is looking for.

You may also run into an issue with Drone only pulling a shallow clone like GHA and Azure DevOps both do. See this section in the readme for that https://github.com/pantheon-systems/autotag#error-getting-head-commit-object-does-not-exist-id-refsheadsmaster-rel_path-

b-ferreira commented 2 years ago

Hello guys, I'm sorry for the delay.

Yes, we had the initial tags in conformation with what autotag is looking for. The issue was that I needed to fetch the tags in Drone before using autotag, as you mentioned @joemiller.

Thank you for the support guys.