-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use with GitHub Actions and NodeJS #3023
Comments
In your GitHub Actions workflow, you'd first want a step that downloads Flyway. You can achieve that with the following script:
Then you can add Flyway to the
You should then be able to call Flyway inside your GitHub Actions workflow as normal i.e. This isn't the only solution of course, you could also:
Does this work for you? |
thanks much! I don't see how the docker image can help me if I don't want to run the flyaway stuff inside an image but thanks for the other tip. |
I notice that you've deleted the comments now, so presumably you have it working? The issues I noticed:
A correct command would look like |
Almost there, you were on the right track. The problem is I wonder if I need to escape something:
I replaced some of the real stuff above, but this gets across what I'm running. The problem I have now is I don't know if I need to escape something because it seems to cut off some of the command when github actions runs it: |
You could try passing the user and password in separately with |
Thanks yea so it's the password I think. It outputs I also wondered if it had anything to do with the |
Does it successfully connect when you pass the username and password in as separate arguments? You shouldn't have to escape anything, and if the password is incorrect the driver should throw an authentication error Since your database is running in a container, it's also possible that the container isn't ready yet |
My database isn't running in a container. It's trying to connect to my live Google Cloud DB instance which I thought this could do? The database is running fine in google cloud, I'm able to connect to it with the same params/connection values with pgAdmin as well. So I tried again with separating
(again I replaced the real IP and pwd here for privacy, but this illustrates an example password that has a ^ in it for example causing that weird |
It's so odd, I don't know why I see |
It appears as asterisks due to masking, it won't be using You could also try downloading the Flyway CLI and running the above command. If it runs then we know there's something specific to running it as a GitHub Action |
You can download it for your platform from the following link: https://flywaydb.org/download/community |
The error indicates that the URL is incorrect - there's no database there to connect to. Since you're trying to connect to a Google Cloud database instance, the URL is formatted differently - see their documentation on how to set up your JDBC URL. |
The problem is the statement is malformed, the same problem I've had from the beginning but yes, thanks for the find on the google version of the jdbc. I still have the same problems even when running this
Besides the malformed string problems I'm having, the gcloud jdbc says that you have to install https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory which is Java based. I'm running node. |
Flyway however is Java based and uses JDBC to connect to the database. You need to download the socket factory JAR in your Actions workflow and make it available on the classpath so that it can be used One way would be by running a similar Closing for now as this is no longer a Flyway issue |
You also need to download dependencies yourself too. You can find what you need in the |
I assume those should all be downloaded to the |
They all need to be available on the classpath, and Flyway ensures everything in the |
As I ventured down this path to resolving the compiled dependencies, am finding I'm chasing a rabbit hole now of dependencies which is tough because I'm manually having to find, download, and hope for the best since I'm not in an actual Java Project. And who knows once I do chase all these down if they're even the right version.
Result:
so I think I'm there, I'll try adding a migration now and see how that goes. the only thing that's strange is I see |
We have lift-off. Thanks much @DoodleBobBuffPants |
Blog post about it https://t.co/34zFN3kopx |
Glad to hear it works:) I appreciate that manually downloading dependencies is a pain. Would it be feasible to create a Java project with Maven for the sole purpose of grabbing dependencies automatically? You could then follow this post to grab the dependencies |
I want to use the command-line for my GitHub Actions pipelines for a NodeJS service. My NodeJS service is going to be tested against a postgres DB which locally I plan on running the DB in a docker container.
Is there a way to install flyaway so that I can run commands in GitHub Actions, Travis, and other build tools with a NodeJS app? How would I actually install flyaway in this situation for GitHub Actions for example so that npm scripts could run flyaway cli? I don't want to install flyaway in my container. I want to apply migrations from my NodeJS app itself during CI/CD from scripts run from my build.yaml
The text was updated successfully, but these errors were encountered: