10 months 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.
```
7 Replies
[GH DEPLOY] Build dynamically-versioned projectfails due to missing git tags
[GH DEPLOY] Build dynamically-versioned project fails due to missing git tags
10 months ago
I would assume this is because the .git folder is not downloaded when we build your app.
# 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
10 months ago
Sorry but there is no way to have Railway download the .git folder.
10 months ago
!s
Status changed to Solved brody • 10 months ago