Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions - Cron schedule not working for all repos #28533

Closed
Thulium-Drake opened this issue Dec 19, 2023 · 14 comments · Fixed by #28874
Closed

Actions - Cron schedule not working for all repos #28533

Thulium-Drake opened this issue Dec 19, 2023 · 14 comments · Fixed by #28874
Assignees
Labels
Milestone

Comments

@Thulium-Drake
Copy link

Description

I have configured a lot of repos in my private instance to run in 2 cases:

  • At push on specified branches, this works as a charm
  • '@Weekly'

I had these changes in place before it was supported in Gitea (it was in the spec and I found out later that it was not yet supported). However, now it is supported, but the Actions are not triggered for all repos I have it configured for.

My config, which is the same for all repos:

---
name: Test & publish
run-name: Checking role and publish on Ansible Galaxy
on:  # yamllint disable-line rule:truthy
  schedule:
    - cron: '@weekly'
  push:
    branches:
      - 'master'
      - 'main'

Gitea Version

1.21.0 built with GNU Make 4.3, go1.21.4 : bindata, sqlite, sqlite_unlock_notify

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

It is working for some:

image

But not for others:

image

Git Version

2.39.2-1.1

Operating System

Debian 12

How are you running Gitea?

I have installed it using the Ansible Role made by @DO1JLR https://github.com/roles-ansible/ansible_role_gitea

It's running via systemd using the binary that came from Github.

Database

MySQL/MariaDB

@lunny
Copy link
Member

lunny commented Dec 19, 2023

Whether all the workflow are in the default branch of the repository?

@Thulium-Drake
Copy link
Author

Hi lunny,

Thanks for the reply! Yes, all repos have the same setup. I have added some screenshots to show you how it's set up.

The working repo:

image

The non-working repo:

image

Does this answer your question?

@lunny
Copy link
Member

lunny commented Jan 16, 2024

It's wired. I cannot reproduce it.

@IsaacWG
Copy link

IsaacWG commented Jan 19, 2024

I seem to also be having this issue. The action runs just fine on push, but won't run on the cron schedule. It seems the action_schedule and action_schedule_spec MySQL database tables remain empty and no records are being added. Of course I only just started trying out Gitea actions, so I only have one repo configured with an action.

My action YAML file begins with the following:

name: Docker Build
run-name: Build and publish Docker container images

on:
  schedule:
    - cron: '0 * * * *'
  push:
    branches:
      - 'master'

My Gitea version is 1.21.4 running under Docker, using the latest gitea/gitea:1 image.

Gitea version 1.21.4 built with GNU Make 4.4.1, go1.21.6 : bindata, timetzdata, sqlite, sqlite_unlock_notify

@maltsev-gorskij
Copy link

Got the same issue. After updating to 1.21.4 my renovate bot scheduled task stopped working. Tried to disable and enable schedule again, but got no luck.

Task config

name: renovate

on:
  schedule:
    - cron: "0 1 * * *"

  push:
    branches:
      - main

jobs:
  renovate:
    runs-on: ubuntu-latest
    container: ghcr.io/renovatebot/renovate:37.140.10
    steps:
      - uses: actions/checkout@v4
      - run: renovate
        env:
          RENOVATE_CONFIG_FILE: "${{ gitea.workspace }}/config.js"
          LOG_LEVEL: "debug"
          RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
          GITHUB_COM_TOKEN: ${{ secrets.GH_TOKEN }}

@IsaacWG
Copy link

IsaacWG commented Jan 20, 2024

Got the same issue. After updating to 1.21.4 my renovate bot scheduled task stopped working. Tried to disable and enable schedule again, but got no luck.

@maltsev-gorskij Do you know what version were you on previously where it worked? I believe the cron schedule support was added on release 1.21.0 with pull #26655

I just tested with Gitea versions 1.21.0, 1.21.1, 1.21.2, 1.21.3, and ended on 1.21.4, each time pushing a new commit. I had a cron schedule configured to run every 5 minutes. In every version I ran into the same issue with the schedule not running and no records being added to the action_schedule and action_schedule_spec database tables.

@IsaacWG
Copy link

IsaacWG commented Jan 20, 2024

A possibly useful trace log:

...actions/workflows.go:125:DetectWorkflows() [T] detect workflow "docker-build.yaml" for event &jobparser.Event{Name:"schedule", acts:map[string][]string(nil), schedules:[]map[string]string{map[string]string{"cron":"*/5 * * * *"}}} matching "push"
...actions/workflows.go:125:DetectWorkflows() [T] detect workflow "docker-build.yaml" for event &jobparser.Event{Name:"push", acts:map[string][]string{"branches":[]string{"master"}}, schedules:[]map[string]string(nil)} matching "push"
...dules/git/command.go:290:Run() [D] git.Command.RunDir(/data/git/repositories/isaac/gitea-action-testing.git): /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= name-rev --exclude refs/tags/* --name-only --no-undefined 27254cd39d2fa54c7ecfdcdfd59a22d24da45c55
...s/process/manager.go:188:Add() [T] Start 65ab1628-13: git(dir:/data/git/repositories/isaac/gitea-action-testing.git): /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= name-rev --exclude refs/tags/* --name-only --no-undefined 27254cd39d2fa54c7ecfdcdfd59a22d24da45c55 (normal)
...s/process/manager.go:231:remove() [T] Done 65ab1628-13: git(dir:/data/git/repositories/isaac/gitea-action-testing.git): /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= name-rev --exclude refs/tags/* --name-only --no-undefined 27254cd39d2fa54c7ecfdcdfd59a22d24da45c55
...s/notifier_helper.go:405:handleSchedules() [T] repo /data/git/repositories/isaac/gitea-action-testing.git with commit 27254cd39d2fa54c7ecfdcdfd59a22d24da45c55 couldn't find schedules

@lippoliv
Copy link

I'm a newbie to gitea, using GitLab for 10+ years now. Evaluating if it's time to switch. Ran into this issue as well (yes I enabled actions in config ;) ).

Runnin with docker compose on a Synology NAS (DS918+, DSM 7.1.1-42962 Update 6).
Gitea-Version: 1.21.4 built with GNU Make 4.4.1, go1.21.6 : bindata, timetzdata, sqlite, sqlite_unlock_notify

  1. New repo
  2. simple workflow
on:
  schedule:
    - cron: '* * * * *'

jobs:
  echo:
    runs-on: ubuntu-latest
    steps:
      - name: say hi
        shell: bash
        run: echo hi

Expected
Every minute it says hi

Actual
No actions are scheduled / executed at all.

@lunny lunny self-assigned this Jan 20, 2024
@jameshurst
Copy link

I just tested with Gitea versions 1.21.0, 1.21.1, 1.21.2, 1.21.3, and ended on 1.21.4, each time pushing a new commit. I had a cron schedule configured to run every 5 minutes. In every version I ran into the same issue with the schedule not running and no records being added to the action_schedule and action_schedule_spec database tables.

I was able to get scheduled actions running again after downgrading to 1.21.3, but only after pushing a commit that modified the schedule. I have not tested whether the scheduled actions run in 1.21.4 after pushing a commit that modifies the schedule.

@maltsev-gorskij
Copy link

Got the same issue. After updating to 1.21.4 my renovate bot scheduled task stopped working. Tried to disable and enable schedule again, but got no luck.

@maltsev-gorskij Do you know what version were you on previously where it worked? I believe the cron schedule support was added on release 1.21.0 with pull #26655

I just tested with Gitea versions 1.21.0, 1.21.1, 1.21.2, 1.21.3, and ended on 1.21.4, each time pushing a new commit. I had a cron schedule configured to run every 5 minutes. In every version I ran into the same issue with the schedule not running and no records being added to the action_schedule and action_schedule_spec database tables.

Previously it was working on 1.21.3 version. And it worked just fine. After update, scheduling stopped working.

@IsaacWG
Copy link

IsaacWG commented Jan 21, 2024

@maltsev-gorskij and @jameshurst:
I can confirm that by reverting back to 1.21.3 and changing the cron schedule I do get it working again on my Gitea instance and repo.

Looks like @lunny has found the cause of the problem. Thanks Lunny!

lunny added a commit that referenced this issue Jan 22, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jan 22, 2024
lunny added a commit that referenced this issue Jan 22, 2024
…t ref name (#28874) (#28888)

Backport #28874 by @lunny

Fix #28533

Caused by #28691

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@Thulium-Drake
Copy link
Author

Hi @lunny thanks for your hard work to fix this! I was not able to respond for a few days, but I'm happy to see the community was able to provide enough information.

Last question, do I need to change anything in the affected repositories after I've updated Gitea, or will it fix itself?

@lunny
Copy link
Member

lunny commented Jan 22, 2024

Hi @lunny thanks for your hard work to fix this! I was not able to respond for a few days, but I'm happy to see the community was able to provide enough information.

Last question, do I need to change anything in the affected repositories after I've updated Gitea, or will it fix itself?

Yes, all old repositories needs a push to the default branch to trigger the cron jobs.

henrygoodman pushed a commit to henrygoodman/gitea that referenced this issue Jan 31, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants