setup-micromamba icon indicating copy to clipboard operation
setup-micromamba copied to clipboard

Cache key contains `[object Promise]`

Open echoix opened this issue 1 year ago • 2 comments

We use the pinned v2.0.4 version of this action. I only recently observed that the cache key contains a literal [object Promise]. I don't think it is intended, and I don't remember seeing this before (maybe it was ellipsed with ... so I couldn't see it). I also see the same on my fork of the repo too.

Here's a part of our macOS workflow, from https://github.com/OSGeo/grass/actions/runs/13599472432/workflow?pr=5223

      - name: Get current date cache key segment
        id: date
        # Year and week of year so cache key changes weekly
        run: echo "date=$(date +%Y-%U)" >> "${GITHUB_OUTPUT}"
      - name: Prepare Conda environment file
        env:
          test_dependencies: |
            ipython
            pytest
            pytest-github-actions-annotate-failures
            pytest-timeout
            pytest-xdist
            pyyaml
        run: |
          cp ./macos/files/conda-requirements-dev-arm64.txt "${RUNNER_TEMP}/macos_dependencies.txt"
          echo "$test_dependencies" | sed "s/ /\n/g" >> "${RUNNER_TEMP}/macos_dependencies.txt"
      - name: Setup Mamba
        uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4
        with:
          init-shell: bash
          environment-file: ${{ runner.temp }}/macos_dependencies.txt
          environment-name: grass-env
          # Persist on the same period (date).
          cache-environment-key: environment-${{ steps.date.outputs.date }}

Screenshot: Image Screenshot from a fork, showing that this problem was there on Feb 15 too: Image

I tried to search for existing issues and PRs for this, and I wrote this issue since it seemed unreported yet.

echoix avatar Mar 01 '25 13:03 echoix

I see that in your tests too, last month, the same situation can be seen on the three OS tested:

https://github.com/mamba-org/setup-micromamba/actions/runs/13108368515/job/36566957523#step:3:38 Image

https://github.com/mamba-org/setup-micromamba/actions/runs/13108368515/job/36566957331#step:3:39 Image

https://github.com/mamba-org/setup-micromamba/actions/runs/13108368515/job/36566957064#step:3:33 Image

Even on dec 2, 2024: https://github.com/mamba-org/setup-micromamba/actions/runs/12116512082/job/33777075740

I cannot go further than 3 months in the logs, and that is pretty much the oldest run that was made on the main branch

echoix avatar Mar 01 '25 13:03 echoix

I am noticing this bug as well. It appears the bug is here, binHash is a Promise: https://github.com/mamba-org/setup-micromamba/blob/b09ef9b599704322748535812ca03efb2625677b/src/cache.ts#L38-L45

Line 43 should be something like

const binHash = sha256(fs.readFileSync(options.micromambaBinPath));

Another problem is that this faulty key is appended to the cache-environment-key that I set. I would expect cache-environment-key to be used by itself when provided.

emlys avatar Jun 13 '25 19:06 emlys

Thanks!

echoix avatar Sep 18 '25 22:09 echoix