R
Railway13mo ago
h246810

Running Railway Up from CLI

Does anybody know if the railway up command waits until the service has been successfully built and deployed to railway before returning with a success status? I am using it in this CI workflow, and it seems that railway up returns much quicker than the actual build and deploy times being showed on railway.app Here is a snippet of the CI
- name: Deploy
run: RAILWAY_TOKEN=$RAILWAY_TOKEN railway up --service backend
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

- name: Populate Database with Fake-Data
run: |
npm run test:tearDownDB
npm run test:setupDB
env:
NODE_ENV: prod
- name: Deploy
run: RAILWAY_TOKEN=$RAILWAY_TOKEN railway up --service backend
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}

- name: Populate Database with Fake-Data
run: |
npm run test:tearDownDB
npm run test:setupDB
env:
NODE_ENV: prod
34 Replies
Percy
Percy13mo ago
Project ID: 2999b3ba-4058-47fa-95a8-078486652ecc
h246810
h246810OP13mo ago
2999b3ba-4058-47fa-95a8-078486652ecc Also, this command is being run in a non-interactive setting (since it is being run in my ci)
Brody
Brody13mo ago
the command does not wait, there is project webhooks though, the webhook is fired for every state for all services within your project
h246810
h246810OP13mo ago
Okay thank you I'm guessing that there is no way to make railway up wait via built in command or option
Brody
Brody13mo ago
currently so such feature exists
h246810
h246810OP13mo ago
gotcha thanks
Brody
Brody13mo ago
can you tell me more about your usecase though?
h246810
h246810OP13mo ago
Sure The desired logical use case is as follows: So I have a backend that has a ci that's set to run on pull requests. When a pull request is opened, the ci will check out the code, install railway cli and other dependencies, and will push this code to railway via railway up. Once that service has been successfully deployed, I will run a series of e2e tests against the newly deployed service on railway and if those succeed, merge the PR. The problem is that I can't wait for confirmation that the service has been deployed... So the e2e tests that will fire will miss the newly deployed service
Brody
Brody13mo ago
makes sense so to recap, you are looking for something like a --wait flag so that the cli will wait until your service has been successfully deployed and switched over, then once and only once that is detected exit
h246810
h246810OP13mo ago
exactly that would be ideal
Brody
Brody13mo ago
hi hi @milo / salvage - bet you could implement this in 5 minutes that challenge has been set, now we wait
h246810
h246810OP13mo ago
lol if this personcan make a feature on the spot and deploy it to production for a use case, I will personally go on any forum/website and sing railways praises for a month 😆
Brody
Brody13mo ago
he can
milo
milo13mo ago
cold - give me a sec when im home (currently at football). I’ll lyk when I start working on it
Brody
Brody13mo ago
I think cold is a British term
milo
milo13mo ago
it is it just means alright or cool I’ll be back in about 6 hours - got some pretty big in fitness stuff
h246810
h246810OP13mo ago
Absolute beast on the keyboard and on the field it is all much appreciated
milo
milo13mo ago
🙏
Brody
Brody13mo ago
I'd like to note that once milo does this, the pr has to be merged and railway has to release a new version for it to then be installable via npm in ci
milo
milo13mo ago
(usually takes 5 days or so)
h246810
h246810OP13mo ago
Okay noted, I can live with that I imagine if I regularly check railway/cli on gh there will be a release note that says this feature has been released If not do you know where I can regularly check for the release?
Adam
Adam13mo ago
Could you not also download the source code from the pr and run your own build? so it wouldn’t be generally available, but you could still use the feature
h246810
h246810OP13mo ago
I definitely could do that too... If milo could let me know the PR number that would be idea ideal could also check
Brody
Brody13mo ago
this is where you see the releases https://github.com/railwayapp/cli/releases but you can also do this on the repo to get notified when a new release is published
No description
h246810
h246810OP13mo ago
Either way, I look forward to it @milo / salvage Hey there, how goes the wait feature? taggin you here
milo
milo13mo ago
oops, just got home. ill start working on it soon (just need to do some bugfixes on a project)
h246810
h246810OP13mo ago
Sounds good
Sang Dang
Sang Dang8mo ago
sorry to dig this up but may I know the status of this? currently we need exactly this, the ability to run e2e tests against the PR environment build
Brody
Brody8mo ago
This will wait for the build to either deploy or fail and will exit with 0 or 1 accordingly
Sang Dang
Sang Dang8mo ago
thanks @Brody , that is blasting fast, may I ask something more, as the CI/CD and github actions is not my expertise currently I let the Railway trigger the deployment automatically with the PR environment, does that mean in order to use this feature, I have to turn it off and write the github actions and use railway CLI to trigger it by myself?
Brody
Brody8mo ago
that is correct
Sang Dang
Sang Dang8mo ago
thank you very much, I will give it a try, have a nice day 🫂
Brody
Brody8mo ago
you too!
Want results from more Discord servers?
Add your server