coolify
coolify copied to clipboard
[Bug]: SOURCE_COMMIT doesn't work as expected for Preview Deployments
Description
Environment variable SOURCE_COMMIT should contain the commit hash for the git-based resources: https://coolify.io/docs/knowledge-base/environment-variables#predefined-variables
However, for the Preview Deployments it's always "HEAD". Tried with Nixpacks & Docker Compose
Minimal Reproduction (if possible, example repository)
- Add a GitHub repo
- Configure the repo-based resource and add e.g.
echo "SOURCE_COMMIT=$SOURCE_COMMIT"
for example as post-build command - Enable Preview Deployments, create PR and push there.
Alternatively, just execute printenv
in "Command" menu for any container with PR branch deployed
You'll see:
SOURCE_COMMIT=HEAD
Exception or Error
Also, the deployment logs for Docker Compose deployments (Preview Deployments only) would be like:
[COMMAND] docker exec XXXXXX bash -c 'SOURCE_COMMIT=HEAD docker compose --project-directory /artifacts/XXXXXX -f /artifacts/XXXXXX/docker-compose.yaml build'
Version
v4.0.0-beta.271