[GH DEPLOY] Build dynamically-versioned project fails due to missing
git tags
teocns
PROOP

a year ago

Deploying a python project that leverages dynamic __version__ resolution, build will fail.

This is perhaps caused due due to the builder not fetching git tags? git fetch --tags or git fetch --all solves the issue at least locally.

  • This does not occur in CI.

  • Does not occur with docker build . (given that tags are fetched)

Project reference
Example working GHA CI wf

Relevant logs

``RuntimeError: Error getting the version from sourceversioningit`: NotSdistError: /opt/prefect does not contain a PKG-INFO file

versioningit could not find a version for the project in /opt/prefect!

You may be installing from a shallow clone, in which case you need to unshallow it first.

Alternatively, you may be installing from a Git archive, which is not supported by default. Install from a git+https://… URL instead.
```

Solved

7 Replies

teocns
PROOP

a year ago

7ad3e487-7ac0-4f37-b940-9c0f0ce2d2ef


teocns
PROOP

a year ago

[GH DEPLOY] Build dynamically-versioned projectfails due to missing git tags


teocns
PROOP

a year ago

[GH DEPLOY] Build dynamically-versioned project fails due to missing git tags


a year ago

I would assume this is because the .git folder is not downloaded when we build your app.


teocns
PROOP

a year ago

# Use the Dockerfile explicitly
builder = "DOCKERFILE"
# Ensure git history is preserved
buildCommand = """
git config --global --add safe.directory /opt/prefect
git fetch --unshallow --tags || true
"""

[deploy]
# Running prefect server after build
startCommand = "prefect server start"
restartPolicyType = "ON_FAILURE"

Also tried using a railway.toml without luck


a year ago

Sorry but there is no way to have Railway download the .git folder.


a year ago

!s


Status changed to Solved brody 11 months ago


Loading...