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

Activate and deactivate repo creates repo even when it fails #4730

Open
3 tasks done
mzampetakis opened this issue Jan 17, 2025 · 1 comment
Open
3 tasks done

Activate and deactivate repo creates repo even when it fails #4730

mzampetakis opened this issue Jan 17, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@mzampetakis
Copy link
Contributor

Component

server

Describe the bug

When the forge (whichever one) fails to activate a repository (the Activate() func of the forge returns an error), woodpecker has already created the repo in the database. As a result the repository is considered as active from the woodpecker side even the webhook has not been created at the forge. This also does not allow the user to activate the repo again (producing the Repository is already active error).

Deactivate follows the same pattern, as it deletes the repo from the local DB and then it invokes the forge's API to delete the webhook.

Steps to reproduce

  1. Change a forge's Activate() function to return an error always (that way we emulate an issue with the forge's API).
  2. Run woodpecker service using the changed forge.
  3. Try to activate any repo
  4. It will fail but the repo entry will be persisted in the repo
  5. If you don't refresh the page you can try to enable that again (it fails with error Repository is already active.
  6. If you refresh the page the repo seems to be enabled while it isn't

Expected behavior

I would expect a repo to be enabled only if the webhook is created successfully at the forge side.
I would expect a repo to be removed only if the webhook is removed successfully from the forge side.

System Info

Tested with woodpecker 2.8.2 and the next.
Run locally using ` go run ./cmd/server`.

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
@mzampetakis mzampetakis added the bug Something isn't working label Jan 17, 2025
@mzampetakis
Copy link
Contributor Author

Also, I had to logout and login agin to see the enabled repos in the /repos page which has already mentioned at #2761.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant