Build SHA as env variable
macwilko
HOBBYOP

2 years ago

Can I expose the current build SHA as an env var to the app?

15 Replies

dev
MODERATOR

2 years ago

Would probably need to use dockerfile and define an env var there with some kind of library you add during build


macwilko
HOBBYOP

2 years ago

ty, ideally it would be the git SHA for the current release


macwilko
HOBBYOP

2 years ago

hmmm


macwilko
HOBBYOP

2 years ago

RAILWAYDEPLOYMENTID


macwilko
HOBBYOP

2 years ago

maybe this would work


macwilko
HOBBYOP

2 years ago

RAILWAYGITCOMMIT_SHA


macwilko
HOBBYOP

2 years ago

oooo


macwilko
HOBBYOP

2 years ago

even better!!


blarfoon
PRO

10 months ago

@macwilko how did you solve this? I tried using RAILWAY_GIT_COMMIT_SHA but I get an empty string


brody
EMPLOYEE

10 months ago

RAILWAY_GIT_COMMIT_SHA works fine.

1361081167453094100


brody
EMPLOYEE

10 months ago

are you perhaps trying to reference it in a service variable? or are you using a dockerfile?


blarfoon
PRO

10 months ago

oh I can't reference it from a service variable? I was trying to create an alias to APP_VERSION


blarfoon
PRO

10 months ago

I will reference it directly then, thanks


blarfoon
PRO

10 months ago

it's weird that some variables work and some don't. RAILWAY_ENVIRONMENT_NAME for example can be used in service variables just fine


brody
EMPLOYEE

10 months ago

the SHA variable is a dynamic variable and by its nature would only be available on container build and start since it's only know when you push to GitHub, how would the dashboard have any way of knowing it's value?


Loading...