Closed ware32 closed 1 year ago
I solved this problem by using a Gitea secret, that contains a Gitea authentication token. I then reference that token within the .gitea/workflow.yaml file.
A) Gitea site, path /user/settings/applications: Access Token: XXX [access: repository: READ]
B) Gitea site, path /user/settings/actions/secrets: GH_TOKEN_RO. This secret contains the token from A) above.
C) within the .gitea/workflow.yaml file:
jobs: ci-bake: runs-on: ubuntu-latest secrets: GIT_AUTH_TOKEN: ${{ secrets.GH_TOKEN_RO }}
I used a second secret to provide registry access to push the built image to my Gitea packages registry.
I solved this problem by using a Gitea secret, that contains a Gitea authentication token. I then reference that token within the .gitea/workflow.yaml file.
A) Gitea site, path /user/settings/applications: Access Token: XXX [access: repository: READ] B) Gitea site, path /user/settings/actions/secrets: GH_TOKEN_RO. This secret contains the token from A) above. C) within the .gitea/workflow.yaml file:
jobs: ci-bake: runs-on: ubuntu-latest secrets: GIT_AUTH_TOKEN: ${{ secrets.GH_TOKEN_RO }}
I used a second secret to provide registry access to push the built image to my Gitea packages registry.
Ok, but in my docker container, ¿how can I set the user who executes the commands? I think the act_runner doesnt know the user needed to git clone the repositories
In my workflow the actions/checkout@v3
uses environment variables passed by Gitea. That includes the repo URL.
I solved this problem by using a Gitea secret, that contains a Gitea authentication token. I then reference that token within the .gitea/workflow.yaml file.
A) Gitea site, path /user/settings/applications: Access Token: XXX [access: repository: READ] B) Gitea site, path /user/settings/actions/secrets: GH_TOKEN_RO. This secret contains the token from A) above. C) within the .gitea/workflow.yaml file:
jobs: ci-bake: runs-on: ubuntu-latest secrets: GIT_AUTH_TOKEN: ${{ secrets.GH_TOKEN_RO }}
I used a second secret to provide registry access to push the built image to my Gitea packages registry.
I have configured this but not working, ¿could you upload some screenshots of steps A and B and yaml file? Thanks
I did more digging. The actions/checkout@v3, uses the default github.token context variable. With Gitea v20+ it just works. Are you sure your runner is pointing at the correct GITEA instance?
See https://docs.gitea.com/next/usage/actions/act-runner#register-the-runner-with-docker.
For example GITEA_INSTANCE_URL=https://gitea.example.com
I'm also getting this exact issue with actions/checkout@3
. It fails with
2024-03-06 10:18:08 [Gitea Actions Demo/Explore-Gitea-Actions] | ::group::Fetching the repository
2024-03-06 10:18:08 [Gitea Actions Demo/Explore-Gitea-Actions] | [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +1cb8e8e887467799ae13c4cf3a5efeba9e051d8c:refs/remotes/origin/actions
2024-03-06 10:18:09 [Gitea Actions Demo/Explore-Gitea-Actions] | error: Server does not allow request for unadvertised object 1cb8e8e887467799ae13c4cf3a5efeba9e051d8c
2024-03-06 10:18:09 [Gitea Actions Demo/Explore-Gitea-Actions] | The process '/usr/bin/git' failed with exit code 128
2024-03-06 10:18:09 [Gitea Actions Demo/Explore-Gitea-Actions] | Waiting 13 seconds before trying again
@wblew - I too believed that with gitea v20+ it should just work. My Gitea instance is definitely correct. I'm using the DIND approach:
docker run \
-e GITEA_INSTANCE_URL=http://mylocalserver/ \
-e GITEA_RUNNER_REGISTRATION_TOKEN=redacted \
--name gitea_act_runner \
--privileged
vegardit/gitea-act-runner:dind-latest
And it registers correctly
2024-03-06 10:15:24 level=debug msg="Successfully pinged the Gitea instance server"
2024-03-06 10:15:24 level=info msg="Runner registered successfully."
2024-03-06 10:15:24 time="2024-03-06T10:15:24Z" level=info msg="Starting runner daemon"
2024-03-06 10:15:24 time="2024-03-06T10:15:24Z" level=info msg="runner: 0e73b895ca9d, with version: v0.2.6, with labels: [ubuntu-latest ubuntu-22.04 ubuntu-20.04], declare successfully"
Any ideas?
The gitea server is complaining about the requested object:
error: Server does not allow request for unadvertised object 1cb8e8e887467799ae13c4cf3a5efeba9e051d8c
Are you only running your workflow on branches and tags?
Here is my workflow's on
clause:
on:
push:
branches: [ 'master', 'dev' ]
tags: [ '*' ]
Also, when reviewing your docker run command, I noticed this envar. On my it lacks the trailing slash.
Yours: GITEA_INSTANCE_URL=http://mylocalserver/
Mine: GITEA_INSTANCE_URL=http://mylocalserver
Maybe this is part of the problem?
@wblew Thanks for your help. I am using the gitea demo.yaml
verbatim
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
The thing is, it was working fine a few days ago. But then when I go back and try to run this same demo workflow from previous commits that I know used to work - it now doesn't work. I tried with and without the trailing slash in the instance name and that didn't make a difference. I've always had the trailing slash and that used to work.
However, I just pushed a new commit with the exact same demo.yaml
and now all of a sudden it works again. It's as if it struggles with the older commits now for some reason? Even though the demo.yaml
is identical.
I've managed to find an open gitea issue (https://github.com/go-gitea/gitea/issues/11958) which has had recent activity and seems related. Not sure what the answer is, but I will try some more tests and see if I can reproduce the error. Maybe using with: fetch-depth: 0
as stated in the issue linked is a solution?
edit: @wblew when I wrote my first comment I had everything working locally on my host machine using ./act_runner
and also using the gitea/act_runner
docker. So I thought the issue might have been with vegardit/docker-gitea-act-runner
. But then I went and checked using ./act_runner
locally and it was giving the same Server does not allow request for unadvertised object
error. So it must be something with gitea. And reading the linked issue more it seems error might be caused by 'unreachable commits' - I'm not entirely sure.
It we put the runner in a machine different from our gitea server, when executing
We get The process '/usr/bin/git' failed with exit code 128 It seems to be a authentication problem between our runner and the git server. ¿How can we solve this?
Thanks in advance