New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Service and Source connection (both source repo and docker image) #21
Fix for Service and Source connection (both source repo and docker image) #21
Conversation
Looks like there might be a few potential issues with the implementation and the tests are missing too. I can take over, finish, and merge this on Sunday. |
Thank you @pksunkara ! |
@wertlex I took a look over the weekend. I seem to getting something weird:
Looks like railway is not creating the service instances for the environments after we create the service. Can you look into this and see if you are getting the same? |
@pksunkara is there any branch where I could take a look on the |
I pushed to this branch. Command for running the test:
|
yep, will take a look |
So, it seems like there are couple things to deal with:
|
@pksunkara performed some updates for the parameters (an idea of making them a pointers was looking good at glance 😅 ). P.S. probably you'll be able to run CI/CD pipeline till that time |
Everything works. I wasn't able to properly make sure that the
but that's probably because I don't have github connected to the test account. |
20c93ed
to
d5fe7f1
Compare
But I am quite confused about why they added |
3bd4679
into
terraform-community-providers:master
Well, in my eyes it is more like they made a decision to require
But these are just my guesses. I was trying to get some information about this in Railway Discord, but didn't had any luck. |
Hey guys!
Motivation
It seems like the only valid way to attach the source (both repo and image) to the Railway Service is by using the
serviceConnect
method. While other methods still seem to work, in fact, they are doing only part of the job, for instance by assigning a docker image, but not triggering a deployment.I performed a series of experiments (I wish Railway docs would be better, but..) and moved both repo and service connectivity to that new method. The same thing is relevant for disconnecting service from a repo or image:
serviceDisconnect
seems to be the only vital option right away.Branch name is a required property when using the git repo
An additional thing, that initially triggered me to jump into these deep waters is actually the fact that starting from the beginning of the year 2024, the git repository branch became a mandatory parameter. While omitting the branch was not leading to explicit error returned by API, all the calls with git repo set, but no branch specified were leading to silent failure.
I tried different approaches to deal with it, starting from the most obvious one: falling back to the default branch name (
main
ormaster
) when a branch was not specified. However, during this journey, I found that this was too impractical for a couple of reasons:master
vsmain
) problemSo in order not to introduce any real troubles I decided that the most straight option would be to demand
source_repo_branch
to be explicitly specified whensource_repo
is specified. For existing TF configurations without asource_repo_branch
it will lead to the error being rendered in the planning phase, so there will be no room for unintentional changesService schema refined
To cover all these things I decided to refine the Schema for Service just a little bit:
source_image
is checked to be mutually exclusive with all source repo parameters (they are not working anyway when both are provided)source_repo
andsource_repo_branch
are also demanding to be specified together if at least one of them is specifiedTesting
Unfortunately, I had not enough time to build really good automated tests, so I performed some intensive manual testing. My go-to config:
Fixes #16