Skip to main content

Pull Tags in Job

OneDev checks out the requested commit for a build. To make repository tags available to commands such as git describe --tags, fetch them explicitly after checking out the code.

  1. Add a Checkout Code step to the job. Keep enough commit history for the tag you want to describe; a shallow checkout may not contain the commits connecting the tag to the build commit.

  2. Add an Execute Commands step after checkout. Use an image with Git installed, or install Git before running the commands.

  3. Run:

    git fetch --tags
    git tag --list
    git describe --tags

OneDev configures the remote and code access credentials during checkout. The server URL configured in Administration > System Settings must be reachable from the job environment. In a container, localhost refers to that container, not the OneDev host.

For a local Docker Desktop test where OneDev runs on the host at http://localhost:6610, you can add this command before the fetch to rewrite that URL inside the job:

git config url.http://host.docker.internal:6610/.insteadOf http://localhost:6610/

For a deployed server, configure a server URL reachable by your executors instead.

git describe --tags requires a tag reachable from the checked-out commit. Create a tag on that commit or an ancestor first. Its output is either the tag name or a description such as v1.0-2-gabcdef0 when the build commit is after the tag. Fetching tags alone does not guarantee that any tag is reachable from the build commit.