supercharge / mongodb-github-action

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

Add replset option #2

Closed StefanoDeVuono closed 4 years ago

StefanoDeVuono commented 4 years ago

I'd like to add code to allow a user to create a mongo server with a replica set. This could be useful for testing clients that want to do transactions or other replica set based things.

I've written some code and hopefully, it's not too messy. I think it works locally (I've used nektos/act to test it, but had to fudge some stuff.)

I'd like to contribute to this mongo action since it's the one with the most traction.

Lemme know if this is useful.

marcuspoehls commented 4 years ago

@StefanoDeVuono Hey Stefano, great idea! Adding an option to boot up a MongoDB replica set is very useful! I'd love to add this 😃

StefanoDeVuono commented 4 years ago

Thanks!

Here you go: https://github.com/supercharge/mongodb-github-action/pull/3

marcuspoehls commented 4 years ago

Thank you for your help adding replica set support to this GitHub Action. I really appreciate your support!

I’ve published a new release 1.2.0 with this feature.

Please notice, I used an Action input mongodb-replica-set instead of your proposed environment variable. The input can be defined inside of a with: block. I also added an example using a MongoDB replica set with this action to the Readme.

Here’s an example of using a replica set instead of a single MongoDB instance:

    - name: Start MongoDB (with replica set "test-rs")
      uses: supercharge/mongodb-github-action@1.2.0
      with:
        mongodb-version: 4.2
        mongodb-replica-set: test-rs

Enjoy!