supercharge / mongodb-github-action

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

Fails with "docker: invalid reference format." #4

Closed alephnull closed 4 years ago

alephnull commented 4 years ago

Full trace below:

Run supercharge/mongodb-github-action@1.2.0
/usr/bin/docker run --name d00b33c5c17f1d10ab413ea94c275d5ee5830c_ac6eec --label d00b33 --workdir /github/workspace --rm -e INPUT_MONGODB-VERSION -e INPUT_MONGODB-REPLICA-SET -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/tyk-analytics/tyk-analytics":"/github/workspace" d00b33:c5c17f1d10ab413ea94c275d5ee5830c  "" "test"
Starting as single node replica set (in replica set [test])
docker: invalid reference format.
See 'docker run --help'.
Waiting for MongoDB to accept connections
Error: No such container: mongodb
.
Error: No such container: mongodb
.
Error: No such container: mongodb
.
Error: No such container: mongodb
.
Error: No such container: mongodb
##[error]The operation was canceled.
marcuspoehls commented 4 years ago

@alephnull Hey, are you passing down a MongoDB version via the mongodb-version input? Inputs in a GitHub workflow are below a "with" tag.

alephnull commented 4 years ago

~This appears to be due to the _ in --name d00b33c5c17f1d10ab413ea94c275d5ee5830c_ac6eec. I'm not sure how this is populated though.~

alephnull commented 4 years ago

@alephnull Hey, are you passing down a MongoDB version via the mongodb-version input? Inputs in a GitHub workflow are below a "with" tag.

Should have mentioned. This is how I'm using it:

on:
  pull_request:
    branches: [master]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [ubuntu-latest, ubuntu-16.04]
        mongodb-versions: [4.0, 4.2]
        redis-versions: [4, 5]

    steps:
      - uses: actions/checkout@v2

      - name: start MongoDB
        uses: supercharge/mongodb-github-action@1.2.0
        with:
          mongodb-version: ${{ matrix.mongodb-version }}
          # mongodb-replica-set: test
marcuspoehls commented 4 years ago

I think it's the mongodb-versions key in the strategy matrix. It should be singular mongodb-version even though you're using an array. If want to use the plural, you must update the ${{ matrix.mongodb-version }} value to plural as well -> ${{ matrix.mongodb-versions }}

Does this fix the problem?

alephnull commented 4 years ago

Thanks you for your patience. This actions is better than the service container model in github as it enables matrix testing. Thank you very much for making this available.

marcuspoehls commented 4 years ago

Thank you! I'm happy to hear this action is useful for you 😃