Coder Social home page Coder Social logo

Comments (15)

ringsaturn avatar ringsaturn commented on June 12, 2024 1

@marcuspoehls Thanks, it’s problem of Ubuntu 22.04 runner not this action.


For anyone interested in this problem, please track these issues:

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024 1

@AdamGerthel yep, the mongo command is no longer part of the MongoDB 6.0 installation. Sorry, I missed that detail. MongoDB 6.0 uses mongosh

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

@scspijker Hey Stijn, you should have either the mongodb command when using the MongoDB 4.x release line or mongosh in MongoDB 5.x and 6.x. Can you please check your GitHub Actions logs for this package and have a look which version has been used to start the MongoDB container?

from mongodb-github-action.

timmyg avatar timmyg commented on June 12, 2024

@scspijker @marcuspoehls seeing similar issue - we relied on this giving us mongo and mongoimport and now getting:

mongo: not found
and
mongoimport: not found

Using mongo:5.0

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

@timmyg Hey Tim, thanks for confirming the issue.

@scspijker @timmyg Tim, Stijn, can you please share a link to a failed GitHub Actions job? I need more details on the error and some context in which it fails.

from mongodb-github-action.

ringsaturn avatar ringsaturn commented on June 12, 2024

@marcuspoehls Hi, I made an example repo https://github.com/ringsaturn/mongodb-action-debug for this issue and a sample CI:

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

@ringsaturn Thank you for the repo! That helps.

You're using Ubuntu 22.04 on that runner. The new 22.04 runners don't have MongoDB installed anymore. MongoDB was available on 20.04, but removed on 22.04.

That's the reason you can't use the mongo, mongosh, and mongoimport commands directly. They would be available from within the MongoDB docker container. But not directly on the 22.04 host

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

@ringsaturn Thanks for sharing the links!

from mongodb-github-action.

AdamGerthel avatar AdamGerthel commented on June 12, 2024

Any ideas on how to work around this? I tried installing mongo:

      - name: Install mongosh
        run: |
          sudo apt-get update
          sudo apt-get install gnupg
          wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
          echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
          sudo apt-get update
          sudo apt-get install -y mongodb-mongosh

But that didn't help. Still getting mongo: command not found

This is the whole file

name: Run Tests

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      TEST_MONGODB_URI: mongodb://localhost:27017/test

    steps:
      - uses: actions/checkout@v3

      - name: Use Node.js 16.x
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'yarn'

      - name: Install mongosh
        run: |
          sudo apt-get update
          sudo apt-get install gnupg
          wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
          echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
          sudo apt-get update
          sudo apt-get install -y mongodb-mongosh

      - name: Start MongoDB
        uses: supercharge/[email protected]
        with:
          mongodb-version: 6.0

      - run: yarn install
      - run: yarn build
      - run: mongo --eval "db.getSiblingDB('test')"
      - run: yarn test

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

@AdamGerthel Hey Adam, GitHub Action runners using Ubuntu-latest doesn’t have MongoDB installed on the host system. That means you can’t use the mongo command. You’re installing the MongoDB Shell mongosh and not MongoDB directly on the host. If I understand it correctly, you must install MongoDB itself to have the mongo command available.

from mongodb-github-action.

AdamGerthel avatar AdamGerthel commented on June 12, 2024

@marcuspoehls

Ubuntu-latest doesn’t have MongoDB installed on the host system. That means you can’t use the mongo command.

Yeah I know - that's what I was trying to fix by adding the "Install mongosh" step.

You’re installing the MongoDB Shell mongosh and not MongoDB directly on the host.

Ok, I just followed the official install instructions and thought that would work. What would be the way to install mongodb and not mongosh then?

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

@AdamGerthel

Your MongoDB installation is missing step 4:

sudo apt-get install -y mongodb-org

from mongodb-github-action.

AdamGerthel avatar AdamGerthel commented on June 12, 2024

Ok, thanks! Still getting the same error nonetheless:

Run mongo --eval "db.getSiblingDB('test')"
/home/runner/work/_temp/596db73b-b917-44a6-b5e8-49f67dea387e.sh: line 1: mongo: command not found
Error: Process completed with exit code 127.

It looks like the install went well, so I'm not sure what the problem is. I've tried using Act to be able to test it locally, but for some reason, I haven't been able to get it working (which seems to be because my repo is private).

Any ideas on why mongo still isn't found?

from mongodb-github-action.

AdamGerthel avatar AdamGerthel commented on June 12, 2024

Works - thanks!

from mongodb-github-action.

marcuspoehls avatar marcuspoehls commented on June 12, 2024

Sweet!

from mongodb-github-action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.