File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : MongoDB
2+ description : ' Set up a MongoDB server'
3+
4+ inputs :
5+ mongo-version :
6+ description : ' MongoDB Server version'
7+ required : true
8+ replica-set :
9+ description : ' Replica Set Name'
10+ required : false
11+ default : ' _standalone_'
12+ runs :
13+ using : composite
14+ steps :
15+ - name : Start MongoDB Standalone
16+ if : ${{ inputs.replica-set == '_standalone_' }}
17+ run : docker run --rm -d -p 27017:27017 --name mongo mongo:${{ inputs.mongo-version }} --bind_ip_all
18+ - name : Start MongoDB Replica Set
19+ if : ${{ inputs.replica-set != '_standalone_' }}
20+ run : |
21+ echo 'replica'
22+ docker run --rm -d -p 27017:27017 --name mongo mongo:${{ inputs.mongo-version }} --replSet ${{ inputs.replica-set }} --bind_ip_all
23+ sleep 5 # Give mongo a chance to start up
24+ docker run --rm mongo:${{ inputs.mongo-version }} mongosh --host 172.17.0.1 --eval 'rs.initiate({_id: "${{ inputs.replica-set }}", members: [{_id: 0, host: "172.17.0.1:27017"}]})'
Original file line number Diff line number Diff line change @@ -23,12 +23,11 @@ jobs:
2323 with :
2424 java-version : ${{ matrix.java-version }}
2525 develocity-access-key : ' ${{ secrets.DEVELOCITY_ACCESS_KEY }}'
26- - name : Start MongoDB
27- run : docker run --rm -d -p 27017:27017 --name mongo mongo:${{ matrix.mongo-version }} --replSet rs0 --bind_ip_all
2826 - name : Initialize MongoDB
29- run : |
30- sleep 5 # Give mongo a chance to start up
31- docker run --rm mongo:${{ matrix.mongo-version }} mongosh --host 172.17.0.1 --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "172.17.0.1:27017"}]})'
27+ uses : ./.github/actions/mongodb/
28+ with :
29+ mongo-version : ${{ matrix.mongo-version }}
30+ replica-set : ' rs0'
3231 - name : Build
3332 uses : spring-projects/spring-data-release/actions/maven-build@main
3433 with :
You can’t perform that action at this time.
0 commit comments