coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: SOURCE_COMMIT doesn't work as expected for Preview Deployments

Open ton77v opened this issue 2 months ago • 3 comments

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)

  1. Add a GitHub repo
  2. Configure the repo-based resource and add e.g. echo "SOURCE_COMMIT=$SOURCE_COMMIT" for example as post-build command
  3. 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

ton77v avatar May 03 '24 06:05 ton77v