sqitchers / docker-sqitch

Docker Image packaging for Sqitch
MIT License
35 stars 39 forks source link

docker-sqitch.bat #32

Closed lastlink closed 3 years ago

lastlink commented 3 years ago

fixes #31

theory commented 3 years ago

Oh, amazing, have needed this for a while, thanks! LMK when it’s ready.

Should probably consider adding something to the test workflow to make sure this scripts work properly…

lastlink commented 3 years ago

@theory the test workflow pipeline may need fixing, this file makes no changes, but the test flow is failing. It now successfully mounts, idk about getting the help command to work.

theory commented 3 years ago

It looks like the Docker Hub auth fails. WTF.

lastlink commented 3 years ago

@theory I've separated the pull request pipeline to only validate the build, the other one will still run once a month and on merges to main, I think the docker key may need to be fixed for auth. Also I've updated the readme for using the sh script on a windows machine and cleaned up the .sh file for a windows machine uname. The .bat file is progress in the right direction I'll see if I can get the mount working.

lastlink commented 3 years ago

@theory .bat file for windows cmd is READY!!. Also I updated the readme for clearer instructions on running mac, windows. I also added instructions for using original script using git bash on windows.

notes

.bat script will run the help command correctly and shuts off docker image after closing. I did not understand # Iterate over optional Sqitch and engine variables. I need an example of running the sh command w/ the optional variables in the bash shell to understand how to correct, I did a similar thing for the bat file that will check if the optional variable is set and add the argument. Also did not understand what # Determine the name of the container home directory. should do but I set the default regardless.

theory commented 3 years ago

I did not understand # Iterate over optional Sqitch and engine variables.

It just looks to see if each variable is set, and if so, passes it to the container. That said, I think it may not be necessary to test them, just pass them all to docker, and it will set them if the exist and ignore them if they don't. Not sure if we could run into command-line length issues, though.

Also did not understand what # Determine the name of the container home directory. should do but I set the default regardless.

Inside the container, the home directory is /home unless you run it as root, in which case it/s /root inside the container. This is important for mapping the the home directory to the proper home directory inside the container, so that one's configuration files get read. I don't know how much this would impact Windows; does one use a file named .pgpass in one's home directory on Windows? Doesn't look like it. So to be fully transparent will be more difficult on Windows, since %APPDATA%\postgresql\pgpass.conf will not be converted to ~/.pgass inside the container. That issue will likely hold for a bunch of other database clients too, I expect.

theory commented 3 years ago

Merged, thank you! Quick note: I deleted the MINGW32_NT*|MINGW64_NT*) bit because $SQITCH_ORIG_FULLNAME is supposed to be a full name, not a username. LMK if I'm making a false assumption here.

Also, should echo %passopt% be commented out?

theory commented 3 years ago

Oh, and is curl standard on Windows boxes now?

lastlink commented 3 years ago

Curl works on windows, however, not all the parameters work. Iv had to tweak added parameters on it before. Also for the full username without a tweak on Windows it's like a 50 line username info so I was giving it the short name. It needs to be filtered down on windows.

lastlink commented 3 years ago

It's wget that doesn't work on windows. I don't know when curl became standard on Windows, I think it also works on windows 7.

theory commented 3 years ago

Also for the full username without a tweak on Windows it's like a 50 line username info so I was giving it the short name. It needs to be filtered down on windows.

Something like this should do the trick, eh? I tried on my work PC, but, oddly, my username doesn't seem to be included in net user. Does it work for you? (Change %USERNAME% to $USERNAME for git-bash.