-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from alexdlukens/main
Allow user-defined container name
- Loading branch information
Showing
4 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,6 +202,48 @@ jobs: | |
CI: true | ||
``` | ||
|
||
### With Custom Container Name | ||
The container name of the created MongoDB instance can be configured using the `container-name` input | ||
|
||
The following example will parameterize the MongoDB container name based on the `node-version` and `mongodb-version` being used from the matrix: | ||
|
||
```yaml | ||
name: Run with Custom Container Names | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
mongodb-version: ['4.2', '4.4', '5.0', '6.0'] | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
mongodb-version: ${{ matrix.mongodb-version }} | ||
container-name: mongodb-${{ matrix.node-version }}-${{ matrix.mongodb-version }} | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Run tests | ||
run: npm test | ||
env: | ||
CI: true | ||
``` | ||
|
||
**Caveat:** due to [this issue](https://github.com/docker-library/mongo/issues/211), you **cannot enable user creation AND replica sets** initially. Therefore, if you use this action to setup a replica set, please create your users through a separate script. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ inputs: | |
type: string | ||
mongodb-password: | ||
type: string | ||
container-name: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters