supercharge / mongodb-github-action

Use MongoDB in GitHub Actions
MIT License
222 stars 46 forks source link

Feature: Add --auth Functionality #26

Closed biodrone closed 2 years ago

biodrone commented 2 years ago

Hi folks!

Started using this action and found the need for quick initial root user creation, also saw an open issue that didn't appear to have been solved so I thought I'd sort out a solution.

This PR:

Hopefully fixes #12

Also, sidenote: I've tested the vars as blank strings and the container just ignores them, I almost added them to the test matrices but it wound up making like 86 jobs per test because of al the node and JS versions being tested :shrug:

marcuspoehls commented 2 years ago

@biodrone Hey Josh, thank you for going ahead and creating the pull request 🙌

I'll look through it on Monday and report back.

One question: you changed all tests and GitHub Actions workflow files to use the three new variables (database, user, password). Are the fields now required to be defined?

biodrone commented 2 years ago

No, it's fine if they're left blank. The only caveat is that for user/pass you have to use both or neither, one and not the other won't activate --auth (underlying container behaviour 🤷).

I did some tests with blank variables for those in the matrix but because it then becomes 3x3x2x2x2 tests it creates like 85 tests 😅 Recommend trying it once to make sure you're happy with the new behaviour but probably not something to leave on long term...

marcuspoehls commented 2 years ago

@biodrone Thank you for the pull request Josh! I’ll release a new version of this action tomorrow 👍

biodrone commented 2 years ago

Awesome, you're welcome @marcuspoehls ! Looking forward to using it :smile: