burrunan / gradle-cache-action

GitHub Action to properly cache ~/.gradle folder
Apache License 2.0
150 stars 13 forks source link

Unable to use action inside a self-hosted runner #44

Closed braedongough closed 3 years ago

braedongough commented 3 years ago

We're currently in the process of migrating to a self-hosted runner setup. We've been actively using 1.10 in our workflows for months without a problem with Github-hosted runners.

When trying to run this action inside of our self-hosted runners we receive the following error:

Error: ~/.gradle-cache-action/layer-dependencies-gradle.json is not found

Downgrading the action to 1.9 resolved the above error and we were able to run the workflow without issue in our branch, however, when we merged into our default branch, the action failed with the same error.

Our current self-hosted runner image is fairly bare-bones. We're extending the summerwind/actions-runner only to add node and kubectl, relying on setup actions for other necessary dependencies, primarily actions/setup-java@v2.1.0 in this case.

For reference, this is how we're using the action in one place:

      - name: Gradle Build
        uses: burrunan/gradle-cache-action@v1.10
        env:
          GITHUB_TOKEN: ${{ secrets.TOKEN }}
        with:
          arguments: build -x test
          gradle-version: wrapper
          save-local-build-cache: ${{ github.ref == env.default_branch_ref }}
          save-generated-gradle-jars: ${{ github.ref == env.default_branch_ref }}

Are you aware of any necessary dependencies that must be present on the runner for us to leverage this action? We're pretty stumped on this one!

Here's a gist of the complete output including debug logs for this step: https://gist.github.com/braedongough/4aa7aa6311d8caad7470c0512f70b9ab

braedongough commented 3 years ago

I figured out what our issue was. For anyone else leveraging actions-runner-controller, we updated our working dir in the RunnerDeployment to be /home/runner/work/ to align with the working dir of the Github-hosted runners.

By default the working dir is set to /home/runner/_work/

JohannesZick commented 2 years ago

Hi, we stumbled on the same issue, I believe. We have several older projects built on self-hosted runners, and those work fine. A newly created project doesn't with the error message above. I don't know which version the other projects used originally, but to me it seems like a regression. Older version can set up correctly on self-hosted runners, newer cannot.