supercharge / mongodb-github-action

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

Can we use any mongodb version before 3.4.0 #60

Closed aravindnc closed 3 months ago

aravindnc commented 3 months ago

I have specific test cases to be run on old mongodb version. When I tested with mongodb 3.2.0. It gives me error.

Unable to find image 'mongo:3.2.0' locally
marcuspoehls commented 3 months ago

@aravindnc Hey, did you try another version in the MongoDB 3.2 release line? Like version 3.2.21? Same error?

marcuspoehls commented 3 months ago

@aravindnc or did you try just using '3.2' as the version? And are you putting the version number in quotes? And did you specify the version number in a matrix?

aravindnc commented 3 months ago

@marcuspoehls Thanks for replying. So I've tested like this.

strategy:
      matrix:
        node-version: [ 'lts/*' ]
        mongodb-version: ['3.2.21', latest]

Here is the build output...

Starting single-node instance, no replica set
    - port [27017]
    - version [3.2.21]
    - database []
    - credentials [:]
  Unable to find image 'mongo:3.2.21' locally
  3.2.21: Pulling from library/mongo
  a[9](https://github.com/aravindnc/mongoose-paginate-v2/actions/runs/9168586261/job/25207591562#step:5:11)2a4af0fb9c: Pulling fs layer
  74a2c7f3849e: Pulling fs layer
  927b52ab29bb: Pulling fs layer
  e941def14025: Pulling fs layer
  [ 
.........]
  61ba5f01559c: Pull complete
  db344da27f9a: Pull complete
  Digest: sha256:0463a91d8eff189747348c154507afc7aba045baa40e8d58d8a4c798e7[10](https://github.com/aravindnc/mongoose-paginate-v2/actions/runs/9168586261/job/25207591562#step:5:12)01f3
  Status: Downloaded newer image for mongo:3.2.21
  a5f73d20e3af7288432bacda175891bdee9d20fd23382b66219f20[16](https://github.com/aravindnc/mongoose-paginate-v2/actions/runs/9168586261/job/25207591562#step:5:18)2e187bb0
Waiting for MongoDB to accept connections
  OCI runtime exec failed: exec failed: unable to start container process: exec: "mongosh": executable file not found in $PATH: unknown
marcuspoehls commented 3 months ago

@aravindnc On which platform are you running the actions? Ubuntu latest?

aravindnc commented 3 months ago

@marcuspoehls Actually the error was OCI runtime exec failed, it did download the mongo version. And I'm on ubuntu-latest.

marcuspoehls commented 3 months ago

@aravindnc you found a bug ๐Ÿ˜ƒ the mongosh command was added in MongoDB 5.x. Until MongoDB 4.x, we used the mongo command. This MongoDB GitHub Action checks for MongoDB version 4, but now for versions lower than 4. That means, we try to run the MongoDB 3.x code with mongosh โ€ฆ and thatโ€™s not available in MongoDB 3.x ๐Ÿ‘‰ https://github.com/supercharge/mongodb-github-action/blob/b8277548e075c77cbebd996de03449994fd55594/start-mongodb.sh#L26

Do you want to submit a merge request changing the check for MongoDB 4 to a check MongoDB 4 or lower?

aravindnc commented 3 months ago

@marcuspoehls Sure. I will do a PR shortly if you insist.

aravindnc commented 3 months ago

@marcuspoehls PR has been added. Please take a look. Thanks.

marcuspoehls commented 3 months ago

Thank you! ๐Ÿ™‚

marcuspoehls commented 3 months ago

@aravindnc Merged! Iโ€™ll publish a new release by the end of today. Thank you for your help ๐Ÿ‘

aravindnc commented 3 months ago

Thanks for the immediate help. Much appreciated. Thanks for the package too. :) Super helpful.

marcuspoehls commented 3 months ago

Thank you very much @aravindnc ๐Ÿ™‚

Iโ€™ve published version 1.11.0. Itโ€™s available through the Actions Marketplace.