Can't find RAILWAY_GIT_COMMIT_SHA and other Git Variables
dwaynemac
PROOP

2 years ago

Hi!

I can't find RAILWAY_GIT_COMMIT_SHA and other Git Variables listed in the docs

(https://docs.railway.app/reference/variables) on my build.

Should I enable something?

My deploy is triggerd by github so, as I read the docs, they should be available.

13 Replies

2 years ago

Those variables are auto injected into your depoyment's env variables when you deploy, you can't really find them anywhere


dwaynemac
PROOP

2 years ago

so they aren't available on my app on code execution, only during build. is that it?


dwaynemac
PROOP

2 years ago

what i'm trying to achieve is inform Appsignal.com of my current's deploy git sha


2 years ago

so they aren't available on my app on code execution, only during build. is that it?

They'll be available during code execution, I'm just saying you wouldn't find it anywhere in Railway's predefined service variable list in your service config; Do you mean to say they appear as undefined during code execution?


dwaynemac
PROOP

2 years ago

Exactly. On my code (ruby) I search through all available ENV variables and the is no RAILWAY_GIT_xxx


2 years ago

We will look into this.


dwaynemac
PROOP

2 years ago

thx


2 years ago

Unfortunately I was not able to reproduce with a deployment made from GitHub -

https://utilities.up.railway.app/env-vars?prefix=RAILWAY_GIT_


dwaynemac
PROOP

2 years ago

I deploy with nixpacks. Same thing?


2 years ago

These variables would be available at runtime as demonstrated.


brody

These variables would be available at runtime as demonstrated.

ricardovf
PRO

9 months ago

Would be good if i could use this on the variables list so i can rename to another var...


9 months ago

You could always assign the variable's value to another variable from within a build command or similar -

VITE_GIT_SHA=$RAILWAY_GIT_COMMIT_SHA

ricardovf
PRO

9 months ago

Can you help?


Loading...