Cache authentication required #155

Open
opened 2023-04-27 22:32:14 +00:00 by simeonradivoev · 13 comments

When I use the cache action I get:

36 cloning https://gitea.com/actions/cache to /root/.cache/act/actions-cache@v3
37 Unable to clone https://gitea.com/actions/cache refs/heads/v3: authentication required
38 authentication required

This is the action, basically taken from github docs

     - name: Cache node modules
        id: cache-npm
        uses: actions/cache@v3
        env:
          cache-name: cache-node-modules
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-
            ${{ runner.os }}-build-
            ${{ runner.os }}-
      - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
        name: List the state of node modules
        continue-on-error: true
        run: npm list
When I use the cache action I get: ``` 36 cloning https://gitea.com/actions/cache to /root/.cache/act/actions-cache@v3 37 Unable to clone https://gitea.com/actions/cache refs/heads/v3: authentication required 38 authentication required ``` This is the action, basically taken from github docs ``` - name: Cache node modules id: cache-npm uses: actions/cache@v3 env: cache-name: cache-node-modules with: path: ~/.npm key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} name: List the state of node modules continue-on-error: true run: npm list ```
Owner

https://gitea.com/actions/cache doesn't exist. Maybe you need to use absolute address like uses: https://github.com/actions/cache.

`https://gitea.com/actions/cache` doesn't exist. Maybe you need to use absolute address like `uses: https://github.com/actions/cache`.
Author

I did and it fails. Not to mention the hashFiles('**/package-lock.json') didn't work, had to hash them manually in a run.

::debug::Resolved Keys:
2
::debug::["Linux-build-cache-node-modules-","Linux-build-cache-node-modules-","Linux-build-","Linux-"]
3
::debug::Checking zstd --quiet --version
4
::debug::Unable to locate executable file: zstd. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
5
::debug::
6
::debug::zstd version: null
7
::debug::Resource Url: http://172.23.0.2:39157/_apis/artifactcache/cache?keys=Linux-build-cache-node-modules-%252CLinux-build-cache-node-modules-%252CLinux-build-%252CLinux-&version=9e0ba804245d8292e3d31c4651caa1d2c2e10e81739c3a6224daf431cd079309
8
::debug::getCacheEntry - Attempt 1 of 2 failed with error: connect ETIMEDOUT 172.23.0.2:39157
9
::debug::Resource Url: http://172.23.0.2:39157/_apis/artifactcache/cache?keys=Linux-build-cache-node-modules-%252CLinux-build-cache-node-modules-%252CLinux-build-%252CLinux-&version=9e0ba804245d8292e3d31c4651caa1d2c2e10e81739c3a6224daf431cd079309
10
::debug::getCacheEntry - Attempt 2 of 2 failed with error: connect ETIMEDOUT 172.23.0.2:39157
11
::warning::Failed to restore: getCacheEntry failed: connect ETIMEDOUT 172.23.0.2:39157
12
::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
13
Cache not found for input keys: Linux-build-cache-node-modules-, Linux-build-cache-node-modules-, Linux-build-, Linux-
I did and it fails. Not to mention the `hashFiles('**/package-lock.json')` didn't work, had to hash them manually in a run. ``` ::debug::Resolved Keys: 2 ::debug::["Linux-build-cache-node-modules-","Linux-build-cache-node-modules-","Linux-build-","Linux-"] 3 ::debug::Checking zstd --quiet --version 4 ::debug::Unable to locate executable file: zstd. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable. 5 ::debug:: 6 ::debug::zstd version: null 7 ::debug::Resource Url: http://172.23.0.2:39157/_apis/artifactcache/cache?keys=Linux-build-cache-node-modules-%252CLinux-build-cache-node-modules-%252CLinux-build-%252CLinux-&version=9e0ba804245d8292e3d31c4651caa1d2c2e10e81739c3a6224daf431cd079309 8 ::debug::getCacheEntry - Attempt 1 of 2 failed with error: connect ETIMEDOUT 172.23.0.2:39157 9 ::debug::Resource Url: http://172.23.0.2:39157/_apis/artifactcache/cache?keys=Linux-build-cache-node-modules-%252CLinux-build-cache-node-modules-%252CLinux-build-%252CLinux-&version=9e0ba804245d8292e3d31c4651caa1d2c2e10e81739c3a6224daf431cd079309 10 ::debug::getCacheEntry - Attempt 2 of 2 failed with error: connect ETIMEDOUT 172.23.0.2:39157 11 ::warning::Failed to restore: getCacheEntry failed: connect ETIMEDOUT 172.23.0.2:39157 12 ::debug::Failed to delete archive: Error: ENOENT: no such file or directory, unlink '' 13 Cache not found for input keys: Linux-build-cache-node-modules-, Linux-build-cache-node-modules-, Linux-build-, Linux- ```
Member

Not to mention the hashFiles('**/package-lock.json') didn't work, had to hash them manually in a run.

Now Gitea Actions doesn't support hashFiles function. But there is a go-hashfiles action that can be used to get the hash. See https://gitea.com/actions/go-hashfiles

> Not to mention the `hashFiles('**/package-lock.json')` didn't work, had to hash them manually in a run. Now Gitea Actions doesn't support `hashFiles` function. But there is a `go-hashfiles` action that can be used to get the hash. See https://gitea.com/actions/go-hashfiles
wolfogre added the
kind
help wanted
reviewed
needs feedback
labels 2023-04-28 06:29:21 +00:00
Author

I just used sha1sum for the file hashing

I just used sha1sum for the file hashing
Owner

I just used sha1sum for the file hashing

I don't get it, have you tried using https://gitea.com/actions/go-hashfiles to replace ${{ hashFiles('**/package-lock.json') }}?

> I just used sha1sum for the file hashing I don't get it, have you tried using https://gitea.com/actions/go-hashfiles to replace `${{ hashFiles('**/package-lock.json') }}`?
Owner

Wait, I think the error is caused by

Attempt 1 of 2 failed with error: connect ETIMEDOUT 172.23.0.2:39157

That means the job container cannot connect to the act runner.

However, the hashFiles does't work too, it results in empty string.

::debug::Resource Url: http://172.23.0.2:39157/_apis/artifactcache/cache?keys=Linux-build-cache-node-modules-%252CLinux-build-cache-node-modules-%252CLinux-build-%252CLinux-&version=9e0ba804245d8292e3d31c4651caa1d2c2e10e81739c3a6224daf431cd079309

So the key is Linux-build-cache-node-modules-.

Wait, I think the error is caused by ```text Attempt 1 of 2 failed with error: connect ETIMEDOUT 172.23.0.2:39157 ``` That means the job container cannot connect to the act runner. However, the `hashFiles` does't work too, it results in empty string. ```text ::debug::Resource Url: http://172.23.0.2:39157/_apis/artifactcache/cache?keys=Linux-build-cache-node-modules-%252CLinux-build-cache-node-modules-%252CLinux-build-%252CLinux-&version=9e0ba804245d8292e3d31c4651caa1d2c2e10e81739c3a6224daf431cd079309 ``` So the key is `Linux-build-cache-node-modules-`.
Author

well the runner uses the network gitea_act_runner_default

for the hash I did:
${{ env.PACKAGE_HASH }}
and before that I ran
PACKAGE_HASH=$(sha1sum ${{ github.workspace }}/package-lock.json)

well the runner uses the network `gitea_act_runner_default` for the hash I did: `${{ env.PACKAGE_HASH }}` and before that I ran `PACKAGE_HASH=$(sha1sum ${{ github.workspace }}/package-lock.json)`
Owner

So does it work now?

So does it work now?
Author

no

no
Owner

I believe the network on your host is a little complex, so the runner can't detect the right ip to use.

I think you can specify the ip manually by config file.

See https://gitea.com/gitea/act_runner#configuration

# ...
cache:
  # ...
  host: "<the LAN IP of your host>"
# ...

Could you please set the host to the LAN IP and try again?

I believe the network on your host is a little complex, so the runner can't detect the right ip to use. I think you can specify the ip manually by config file. See https://gitea.com/gitea/act_runner#configuration ```yaml # ... cache: # ... host: "<the LAN IP of your host>" # ... ``` Could you please set the host to the LAN IP and try again?
Member

:⚠️:Failed to restore: getCacheEntry failed: connect ETIMEDOUT 172.23.0.2:39157

Hi @simeonradivoev, is your act_runner started by a docker image?

> ::warning::Failed to restore: getCacheEntry failed: connect ETIMEDOUT 172.23.0.2:39157 Hi @simeonradivoev, is your `act_runner` started by a docker image?
Author

yes

yes
Owner

:⚠️:Failed to restore: getCacheEntry failed: connect ETIMEDOUT 172.23.0.2:39157

Hi @simeonradivoev, is your act_runner started by a docker image?

I encountered the same error.

> > ::warning::Failed to restore: getCacheEntry failed: connect ETIMEDOUT 172.23.0.2:39157 > > Hi @simeonradivoev, is your `act_runner` started by a docker image? I encountered the same error.
Sign in to join this conversation.
No Milestone
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#155
No description provided.