Running Railway Up from CLI

Anonymous
TRIAL

2 years ago

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

0 Replies

Anonymous
TRIAL

2 years ago

2999b3ba-4058-47fa-95a8-078486652ecc


Anonymous
TRIAL

2 years ago

Also, this command is being run in a non-interactive setting (since it is being run in my ci)


2 years ago

the command does not wait, there is project webhooks though, the webhook is fired for every state for all services within your project


Anonymous
TRIAL

2 years ago

Okay thank you


Anonymous
TRIAL

2 years ago

I'm guessing that there is no way to make railway up wait


Anonymous
TRIAL

2 years ago

via built in command


Anonymous
TRIAL

2 years ago

or option


2 years ago

currently so such feature exists


Anonymous
TRIAL

2 years ago

gotcha


Anonymous
TRIAL

2 years ago

thanks


2 years ago

can you tell me more about your usecase though?


Anonymous
TRIAL

2 years ago

Sure


Anonymous
TRIAL

2 years ago

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


2 years ago

makes sense


2 years ago

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


Anonymous
TRIAL

2 years ago

exactly that would be ideal


2 years ago

hi hi @salvage - bet you could implement this in 5 minutes


2 years ago

that challenge has been set, now we wait


Anonymous
TRIAL

2 years 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 😆


2 years ago

he can


2 years ago

cold - give me a sec when im home (currently at football). I’ll lyk when I start working on it


2 years ago

I think cold is a British term


2 years ago

it is it just means alright or cool


2 years ago

I’ll be back in about 6 hours - got some pretty big in fitness stuff


Anonymous
TRIAL

2 years ago

Absolute beast


Anonymous
TRIAL

2 years ago

on the keyboard and on the field


Anonymous
TRIAL

2 years ago

it is all much appreciated


2 years ago

🙏


2 years 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


2 years ago

(usually takes 5 days or so)


Anonymous
TRIAL

2 years ago

Okay noted, I can live with that


Anonymous
TRIAL

2 years ago

I imagine if I regularly check railway/cli on gh there will be a release note that says this feature has been released


Anonymous
TRIAL

2 years ago

If not do you know where I can regularly check for the release?


2 years ago

Could you not also download the source code from the pr and run your own build?


2 years ago

so it wouldn’t be generally available, but you could still use the feature


Anonymous
TRIAL

2 years ago

I definitely could do that too… If milo could let me know the PR number that would be idea


Anonymous
TRIAL

2 years ago

ideal


Anonymous
TRIAL

2 years ago

could also check


2 years ago

this is where you see the releases
but you can also do this on the repo to get notified when a new release is published

1171499187909706000


Anonymous
TRIAL

2 years ago

Either way, I look forward to it


Anonymous
TRIAL

2 years ago

@milo / salvage Hey there, how goes the wait feature?


Anonymous
TRIAL

2 years ago

taggin you here


2 years ago

oops, just got home. ill start working on it soon (just need to do some bugfixes on a project)


Anonymous
TRIAL

2 years ago

Sounds good


a year 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


a year ago

1231845807473295400


a year ago

This will wait for the build to either deploy or fail and will exit with 0 or 1 accordingly


a year 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?


a year ago

that is correct


a year ago

thank you very much, I will give it a try, have a nice day 🫂


a year ago

you too!


Running Railway Up from CLI - Railway Help Station