"Life is all about sharing. If we are good at something, pass it on." - Mary Berry

Drone build is not triggered after pushing code to Gitea?

visitor badge

2020-05-06

Categories: DevOps

I pushed code to Gitea and nothing happens in Drone. Why?

But if I go to Settings -> Webhooks, then click “Test Delivery” -> build pipeline will be executed. Why?

First, look at the “Recent Deliveries” to see if a webhook is triggerd here when you pushing code. In my case, it’s not. So, looks like the problem is on Gitea side.

By pay close attention to the git output when pushing:

 1Counting objects: 4, done.
 2Delta compression using up to 4 threads.
 3Compressing objects: 100% (4/4), done.
 4Writing objects: 100% (4/4), 2.02 KiB | 2.02 MiB/s, done.
 5Total 4 (delta 2), reused 0 (delta 0)
 6hint: The 'hooks/pre-receive' hook was ignored because it's not set as executable.
 7hint: You can disable this warning with `git config advice.ignoredHook false`.
 8hint: The 'hooks/update' hook was ignored because it's not set as executable.
 9hint: You can disable this warning with `git config advice.ignoredHook false`.
10hint: The 'hooks/post-receive' hook was ignored because it's not set as executable.
11hint: You can disable this warning with `git config advice.ignoredHook false`.
12To gitea.pi:quanta/blog.git
13 + d29f63d...47e9ed3 master -> master (forced update)

Why hooks are not set as executable?

docker inspect gitea:

1        "Mounts": [
2            {
3                "Type": "volume",
4                "Name": "data_gitea",
5                "Source": "/data/docker/volumes/data_gitea/_data",
1root@raspberrypi:~# ls -l /data/docker/volumes/data_gitea/_data/git/repositories/quanta/blog.git/hooks/
2total 68
3-rwxr-xr-x 1 pi pi  303 Oct 11  2019 post-receive
4-rwxr-xr-x 1 pi pi  303 Oct 11  2019 pre-receive
5-rwxr-xr-x 1 pi pi  283 Oct 11  2019 update

What’s going on?

So, hooks scripts are executable. Why Gitea said that it’s not? Ah, Gitea volumes are mounted on /data:

1root@raspberrypi:~# grep sda1 /proc/mounts
2/dev/sda1 /data ext4 rw,nosuid,nodev,noexec,relatime 0 0

The culprit is noexec which prevent the direct execution of binaries on the mounted filesystem. I have to remount /dev/sda1 with exec flag:

1UUID=25a735b1-76bb-467f-beb1-f7be00a83d3d	/data	ext4	defaults,auto,users,exec,rw,nofail 0 0

Tags: gitea drone fstab

Edit on GitHub

Related Posts: