aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Add Alpine package registry (#23714)KN4CK3R2023-05-124-18/+375
| | | | | | | | | | | | | | | | | | This PR adds an Alpine package registry. You can follow [this tutorial](https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package) to build a *.apk package for testing. This functionality is similar to the Debian registry (#22854) and therefore shares some methods. I marked this PR as blocked because it should be merged after #22854. ![grafik](https://user-images.githubusercontent.com/1666336/227779595-b76163aa-eea1-4a79-9583-775c24ad74e8.png) --------- Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Make repo migration cancelable and fix various bugs (#24605)wxiaoguang2023-05-113-22/+34
| | | | | | | | | | | | | | | | | | | | | | | | Replace #12917 Close #24601 Close #12845 ![image](https://github.com/go-gitea/gitea/assets/2114189/39378118-064d-40fb-8396-4579ebf33917) ![image](https://github.com/go-gitea/gitea/assets/2114189/faf37418-191c-46a6-90a8-353141e00e2d) ![image](https://github.com/go-gitea/gitea/assets/2114189/fdc8ee4d-125f-4737-9990-89bcdf9eb388) ![image](https://github.com/go-gitea/gitea/assets/2114189/9a3bd2c2-fe20-4011-81f0-990ed869d139) --------- Co-authored-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Do not send "registration success email" for external auth sources (#24632)wxiaoguang2023-05-105-15/+0
| | | | | | | | | | | | Co-author: @pboguslawski "registration success email" is only used for notifying a user that "you have a new account now" when the account is created by admin manually. When a user uses external auth source, they already knows that they has the account, so do not send such email. Co-authored-by: Giteabot <teabot@gitea.io>
* Filter get single commit (#24613)Matthew Walowski2023-05-101-0/+9
| | | | Pretty much the same thing as #24568 but for getting a single commit instead of getting a list of commits
* Filters for GetAllCommits (#24568)Matthew Walowski2023-05-091-4/+19
| | | | | | | | | | | | | | | | | | | The `GetAllCommits` endpoint can be pretty slow, especially in repos with a lot of commits. The issue is that it spends a lot of time calculating information that may not be useful/needed by the user. The `stat` param was previously added in #21337 to address this, by allowing the user to disable the calculating stats for each commit. But this has two issues: 1. The name `stat` is rather misleading, because disabling `stat` disables the Stat **and** Files. This should be separated out into two different params, because getting a list of affected files is much less expensive than calculating the stats 2. There's still other costly information provided that the user may not need, such as `Verification` This PR, adds two parameters to the endpoint, `files` and `verification` to allow the user to explicitly disable this information when listing commits. The default behavior is true.
* Improve Gitea's web context, decouple "issue template" code into service ↵wxiaoguang2023-05-091-0/+189
| | | | | | | | | | | | | package (#24590) 1. Remove unused fields/methods in web context. 2. Make callers call target function directly instead of the light wrapper like "IsUserRepoReaderSpecific" 3. The "issue template" code shouldn't be put in the "modules/context" package, so move them to the service package. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Rewrite queue (#24505)wxiaoguang2023-05-0814-94/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # ⚠️ Breaking Many deprecated queue config options are removed (actually, they should have been removed in 1.18/1.19). If you see the fatal message when starting Gitea: "Please update your app.ini to remove deprecated config options", please follow the error messages to remove these options from your app.ini. Example: ``` 2023/05/06 19:39:22 [E] Removed queue option: `[indexer].ISSUE_INDEXER_QUEUE_TYPE`. Use new options in `[queue.issue_indexer]` 2023/05/06 19:39:22 [E] Removed queue option: `[indexer].UPDATE_BUFFER_LEN`. Use new options in `[queue.issue_indexer]` 2023/05/06 19:39:22 [F] Please update your app.ini to remove deprecated config options ``` Many options in `[queue]` are are dropped, including: `WRAP_IF_NECESSARY`, `MAX_ATTEMPTS`, `TIMEOUT`, `WORKERS`, `BLOCK_TIMEOUT`, `BOOST_TIMEOUT`, `BOOST_WORKERS`, they can be removed from app.ini. # The problem The old queue package has some legacy problems: * complexity: I doubt few people could tell how it works. * maintainability: Too many channels and mutex/cond are mixed together, too many different structs/interfaces depends each other. * stability: due to the complexity & maintainability, sometimes there are strange bugs and difficult to debug, and some code doesn't have test (indeed some code is difficult to test because a lot of things are mixed together). * general applicability: although it is called "queue", its behavior is not a well-known queue. * scalability: it doesn't seem easy to make it work with a cluster without breaking its behaviors. It came from some very old code to "avoid breaking", however, its technical debt is too heavy now. It's a good time to introduce a better "queue" package. # The new queue package It keeps using old config and concept as much as possible. * It only contains two major kinds of concepts: * The "base queue": channel, levelqueue, redis * They have the same abstraction, the same interface, and they are tested by the same testing code. * The "WokerPoolQueue", it uses the "base queue" to provide "worker pool" function, calls the "handler" to process the data in the base queue. * The new code doesn't do "PushBack" * Think about a queue with many workers, the "PushBack" can't guarantee the order for re-queued unhandled items, so in new code it just does "normal push" * The new code doesn't do "pause/resume" * The "pause/resume" was designed to handle some handler's failure: eg: document indexer (elasticsearch) is down * If a queue is paused for long time, either the producers blocks or the new items are dropped. * The new code doesn't do such "pause/resume" trick, it's not a common queue's behavior and it doesn't help much. * If there are unhandled items, the "push" function just blocks for a few seconds and then re-queue them and retry. * The new code doesn't do "worker booster" * Gitea's queue's handlers are light functions, the cost is only the go-routine, so it doesn't make sense to "boost" them. * The new code only use "max worker number" to limit the concurrent workers. * The new "Push" never blocks forever * Instead of creating more and more blocking goroutines, return an error is more friendly to the server and to the end user. There are more details in code comments: eg: the "Flush" problem, the strange "code.index" hanging problem, the "immediate" queue problem. Almost ready for review. TODO: * [x] add some necessary comments during review * [x] add some more tests if necessary * [x] update documents and config options * [x] test max worker / active worker * [x] re-run the CI tasks to see whether any test is flaky * [x] improve the `handleOldLengthConfiguration` to provide more friendly messages * [x] fine tune default config values (eg: length?) ## Code coverage: ![image](https://user-images.githubusercontent.com/2114189/236620635-55576955-f95d-4810-b12f-879026a3afdf.png)
* Refresh the refernce of the closed PR when reopening (#24231)sillyguodong2023-05-081-11/+5
| | | | | | | | | | | | | | | | | | | | | | Close #24213 Replace #23830 #### Cause - Before, in order to making PR can get latest commit after reopening, the `ref`(${REPO_PATH}/refs/pull/${PR_INDEX}/head) of evrey closed PR will be updated when pushing commits to the `head branch` of the closed PR. #### Changes - For closed PR , won't perform these behavior: insert`comment`, push `notification` (UI and email), exectue [pushToBaseRepo](https://github.com/go-gitea/gitea/blob/74225033413dc0f2b308bbe069f6d185b551e364/services/pull/pull.go#L409) function and trigger `action` any more when pushing to the `head branch` of the closed PR. - Refresh the reference of the PR when reopening the closed PR (**even if the head branch has been deleted before**). Make the reference of PR consistent with the `head branch`.
* Simplify template helper functions (#24570)wxiaoguang2023-05-071-0/+13
| | | | | | | | | | | | | | | | | | | | To avoid bloating the template helper functions, some functions could be provided by type methods. And the new code `data-line-type="{{.GetHTMLDiffLineType}}"` reads better than `data-line-type="{{DiffLineTypeToStr .GetType}}"` After the fix, screenshots (the same as before): <details> ![image](https://user-images.githubusercontent.com/2114189/236657918-20ce01e0-1192-443e-aeb4-6b3fe1aa2102.png) ![image](https://user-images.githubusercontent.com/2114189/236657950-ee19727f-a1fc-4133-afc7-e5d1a8c1783f.png) </details>
* Improve wiki user title test (#24559)wxiaoguang2023-05-061-1/+4
| | | | | | The `..` should be covered by TestUserTitleToWebPath. Otherwise, if the random string is "..", it causes unnecessary failure in TestUserWebGitPathConsistency
* Add RPM registry (#23380)KN4CK3R2023-05-054-40/+645
| | | | | | | | | | | | | | | Fixes #20751 This PR adds a RPM package registry. You can follow [this tutorial](https://opensource.com/article/18/9/how-build-rpm-packages) to build a *.rpm package for testing. This functionality is similar to the Debian registry (#22854) and therefore shares some methods. I marked this PR as blocked because it should be merged after #22854. ![grafik](https://user-images.githubusercontent.com/1666336/223806549-d8784fd9-9d79-46a2-9ae2-f038594f636a.png)
* Update LDAP filters to include both username and email address (#24547)Gary Moon2023-05-051-5/+5
| | | | | | | Since the login form label for user_name unconditionally displays `Username or Email Address` for the `user_name` field, bring matching LDAP filters to more prominence in the documentation/placeholders. Signed-off-by: Gary Moon <gary@garymoon.net>
* Improve template system and panic recovery (#24461)wxiaoguang2023-05-042-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Partially for #24457 Major changes: 1. The old `signedUserNameStringPointerKey` is quite hacky, use `ctx.Data[SignedUser]` instead 2. Move duplicate code from `Contexter` to `CommonTemplateContextData` 3. Remove incorrect copying&pasting code `ctx.Data["Err_Password"] = true` in API handlers 4. Use one unique `RenderPanicErrorPage` for panic error page rendering 5. Move `stripSlashesMiddleware` to be the first middleware 6. Install global panic recovery handler, it works for both `install` and `web` 7. Make `500.tmpl` only depend minimal template functions/variables, avoid triggering new panics Screenshot: <details> ![image](https://user-images.githubusercontent.com/2114189/235444895-cecbabb8-e7dc-4360-a31c-b982d11946a7.png) </details>
* Merge setting.InitXXX into one function with options (#24389)Lunny Xiao2023-05-041-4/+4
| | | | This PR will merge 3 Init functions on setting packages as 1 and introduce an options struct.
* Fix incorrect webhook time and use relative-time to display it (#24477)yp053272023-05-031-1/+2
| | | | | | | | | | | Fixes #24414 After click replay this webhook, it will display `now` ![image](https://user-images.githubusercontent.com/18380374/235559399-05a23927-13f5-442d-8f10-2c7cd24022a0.png) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Implement Cargo HTTP index (#24452)KN4CK3R2023-05-031-10/+26
| | | | | | | | | | | | | | | | This implements the HTTP index [RFC](https://rust-lang.github.io/rfcs/2789-sparse-index.html) for Cargo registries. Currently this is a preview feature and you need to use the nightly of `cargo`: `cargo +nightly -Z sparse-registry update` See https://github.com/rust-lang/cargo/issues/9069 for more information. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Add ntlm authentication support for mail (#23811)木木田2023-05-021-0/+32
| | | | | | | | | Add ntlm authentication support for mail use "github.com/Azure/go-ntlmssp" --------- Co-authored-by: yangtan_win <YangTan@Fitsco.com.cn> Co-authored-by: silverwind <me@silverwind.io>
* Add Debian package registry (#24426)KN4CK3R2023-05-024-14/+488
| | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: @awkwardbunny This PR adds a Debian package registry. You can follow [this tutorial](https://www.baeldung.com/linux/create-debian-package) to build a *.deb package for testing. Source packages are not supported at the moment and I did not find documentation of the architecture "all" and how these packages should be treated. ![grafik](https://user-images.githubusercontent.com/1666336/218126879-eb80a866-775c-4c8e-8529-5797203a64e6.png) Part of #20751. Revised copy of #22854. --------- Co-authored-by: Brian Hong <brian@hongs.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Revert "Add Debian package registry" (#24412)Yarden Shoham2023-04-284-488/+14
| | | Reverts go-gitea/gitea#22854
* Add Debian package registry (#22854)KN4CK3R2023-04-284-14/+488
| | | | | | | | | | | | | | Co-authored-by: @awkwardbunny This PR adds a Debian package registry. You can follow [this tutorial](https://www.baeldung.com/linux/create-debian-package) to build a *.deb package for testing. Source packages are not supported at the moment and I did not find documentation of the architecture "all" and how these packages should be treated. --------- Co-authored-by: Brian Hong <brian@hongs.me> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix unclear `IsRepositoryExist` logic (#24374)wxiaoguang2023-04-281-1/+1
| | | | | | | | | | | | | | | There was only one `IsRepositoryExist` function, it did: `has && isDir` However it's not right, and it would cause 500 error when creating a new repository if the dir exists. Then, it was changed to `has || isDir`, it is still incorrect, it affects the "adopt repo" logic. To make the logic clear: * IsRepositoryModelOrDirExist * IsRepositoryModelExist
* Move secrets and runners settings to actions settings (#24200)Hester Gong2023-04-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR moves the secrets and runners settings to actions settings on all settings(repo,org,user,admin) levels. After this PR, if [ENABLED](https://github.com/go-gitea/gitea/blob/5e7543fcf441afb30aba6188edac754ef32b9ac3/custom/conf/app.example.ini#L2604) inside `app.ini` under `[actions]` is set to `false`, the "Actions" tab (including runners management and secrets management) will not be shown. After, the settings under actions settings for each level: 1. Admin Level "Runners Management" <img width="1437" alt="Screen Shot 2023-04-26 at 14 34 20" src="https://user-images.githubusercontent.com/17645053/234489731-15822d21-38e1-4560-8bbe-69f122376abc.png"> 2. User Level "Secrets Management" <img width="1427" alt="Screen Shot 2023-04-26 at 14 34 30" src="https://user-images.githubusercontent.com/17645053/234489795-68c9c0cb-24f8-4f09-95c6-458ab914c313.png"> 3. Repo and Organization Levels "Runners Management" and "Secrets Management" Org: <img width="1437" alt="Screen Shot 2023-04-26 at 14 35 07" src="https://user-images.githubusercontent.com/17645053/234489996-f3af5ebb-d354-46ca-9087-a0b586845281.png"> <img width="1433" alt="Screen Shot 2023-04-26 at 14 35 14" src="https://user-images.githubusercontent.com/17645053/234490004-3abf8fed-81fd-4ce2-837a-935dade1793d.png"> Repo: <img width="1419" alt="Screen Shot 2023-04-26 at 14 34 50" src="https://user-images.githubusercontent.com/17645053/234489904-80c11038-4b58-462c-9d0b-8b7cf70bc2b3.png"> <img width="1430" alt="Screen Shot 2023-04-26 at 14 34 57" src="https://user-images.githubusercontent.com/17645053/234489918-4e8d1fe2-9bcd-4d8a-96c1-238a8088d92e.png"> It also finished these tasks : - [x] rename routers function "runners" to "actions", and refactor related file names - [x] check and modify part of the runners related functions to match their name - [x] Fix backend check caused by fmt check --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix auth check bug (#24382)Lunny Xiao2023-04-271-10/+0
| | | | | | | Fix https://github.com/go-gitea/gitea/pull/24362/files#r1179095324 `getAuthenticatedMeta` has checked them, these code are duplicated one. And the first invokation has a wrong permission check. `DownloadHandle` should require read permission but not write.
* Support uploading file to empty repo by API (#24357)wxiaoguang2023-04-261-0/+5
| | | | | | The uploading API already works (the only nit is the the IsEmpty flag is out-of-sync, this PR also fixes it) Close #14633
* Require repo scope for PATs for private repos and basic authentication (#24362)John Olheiser2023-04-263-0/+36
| | | | | | | | | | > The scoped token PR just checked all API routes but in fact, some web routes like `LFS`, git `HTTP`, container, and attachments supports basic auth. This PR added scoped token check for them. --------- Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Display when a repo was archived (#22664)JakobDev2023-04-261-0/+1
| | | | | | | | | | | | | | | | This adds the date a repo is archived to Gitea and shows it in the UI and API. A feature, that GitHub has been [introduced recently](https://github.blog/changelog/2022-11-23-repository-archive-date-now-shown-in-ui/). I currently don't know how to correctly deal with the Date in the template, as different languages have different ways of writing a date. ![grafik](https://user-images.githubusercontent.com/15185051/234315187-7db5763e-d96e-4080-b894-9be178bfb6e1.png) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Refactor config provider (#24245)Lunny Xiao2023-04-251-19/+9
| | | | | | | This PR introduces more abstract about `ConfigProvider` and hides more `ini` references. --------- Co-authored-by: delvh <dev.lh@web.de>
* Fix bug when deleting wiki with no code write permission (#24274)Lunny Xiao2023-04-231-1/+7
| | | | | | Fix #24125 Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: silverwind <me@silverwind.io>
* Move code from module to service (#24287)KN4CK3R2023-04-231-0/+182
| | | | | | The code should not be in `modules/` but `services/`. Reference: https://github.com/go-gitea/gitea/pull/24257#discussion_r1174578230
* Handle canceled workflow as a warning instead of a fail (#24282)Jason Song2023-04-231-1/+3
| | | | | | Follow what Drone CI does: ![image](https://user-images.githubusercontent.com/9418365/233829853-d1c30a30-10cc-4b97-a134-793a79d46d85.png)
* Fix inconsistent wiki path converting. (#24277)wxiaoguang2023-04-232-1/+2
| | | | | | | | | The Infinite Monkey Random Typing catches a bug, inconsistent wiki path converting. Close #24276 Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Use more specific test methods (#24265)KN4CK3R2023-04-223-9/+9
| | | | Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Update go tool dependencies, restructure lint targets (#24239)silverwind2023-04-221-7/+4
| | | | | | | | - Update all tool dependencies to latest tag - Remove unused errcheck, it is part of golangci-lint - Include main.go in air - Enable wastedassign again now that it's [generics-compatible](https://github.com/golangci/golangci-lint/pull/3689) - Restructured lint targets to new `lint-*` namespace
* Improve test logger (#24235)wxiaoguang2023-04-211-39/+28
| | | | | | | | | | | | | Before, there was a `log/buffer.go`, but that design is not general, and it introduces a lot of irrelevant `Content() (string, error) ` and `return "", fmt.Errorf("not supported")` . And the old `log/buffer.go` is difficult to use, developers have to write a lot of `Contains` and `Sleep` code. The new `LogChecker` is designed to be a general approach to help to assert some messages appearing or not appearing in logs.
* Fix issue attachment handling (#24202)wxiaoguang2023-04-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | Close #24195 Some of the changes are taken from my another fix https://github.com/go-gitea/gitea/pull/20147/commits/f07b0de997125c9b79cc5af27966a7cdd1803a4d in #20147 (although that PR was discarded ....) The bug is: 1. The old code doesn't handle `removedfile` event correctly 2. The old code doesn't provide attachments for type=CommentTypeReview This PR doesn't intend to refactor the "upload" code to a perfect state (to avoid making the review difficult), so some legacy styles are kept. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
* Make wiki title supports dashes and improve wiki name related features (#24143)wxiaoguang2023-04-194-140/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close #7570 1. Clearly define the wiki path behaviors, see `services/wiki/wiki_path.go` and tests 2. Keep compatibility with old contents 3. Allow to use dashes in titles, eg: "2000-01-02 Meeting record" 4. Add a "Pages" link in the dropdown, otherwise users can't go to the Pages page easily. 5. Add a "View original git file" link in the Pages list, even if some file names are broken, users still have a chance to edit or remove it, without cloning the wiki repo to local. 6. Fix 500 error when the name contains prefix spaces. This PR also introduces the ability to support sub-directories, but it can't be done at the moment due to there are a lot of legacy wiki data, which use "%2F" in file names. ![image](https://user-images.githubusercontent.com/2114189/232239004-3359d7b9-7bf3-4ff3-8446-bfb0e79645dd.png) ![image](https://user-images.githubusercontent.com/2114189/232239020-74b92c72-bf73-4377-a319-1c85609f82b1.png) Co-authored-by: Giteabot <teabot@gitea.io>
* Allow adding new files to an empty repo (#24164)wxiaoguang2023-04-192-5/+16
| | | ![image](https://user-images.githubusercontent.com/2114189/232561612-2bfcfd0a-fc04-47ba-965f-5d0bcea46c54.png)
* Support triggering workflows by wiki related events (#24119)Zettat1232023-04-171-0/+35
| | | | | | This PR is to support triggering workflows by wiki related events like creating, editing or deleting wiki pages. In GitHub, this event is called [gollum](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#gollum)
* Add new user types `reserved`, `bot`, and `remote` (#24026)techknowlogick2023-04-171-0/+8
| | | | | | | | | | | | | | | | | | | | This allows for usernames, and emails connected to them to be reserved and not reused. Use case, I manage an instance with open registration, and sometimes when users are deleted for spam (or other purposes), their usernames are freed up and they sign up again with the same information. This could also be used to reserve usernames, and block them from being registered (in case an instance would like to block certain things without hardcoding the list in code and compiling from scratch). This is an MVP, that will allow for future work where you can set something as reserved via the interface. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Make more functions use ctx instead of db.DefaultContext (#24068)wxiaoguang2023-04-148-55/+55
| | | | | | Continue the "ctx refactoring" work. There are still a lot db.DefaultContext, incorrect context could cause database deadlock errors.
* Refactor cookie (#24107)wxiaoguang2023-04-132-12/+9
| | | | | | | | | | | | Close #24062 At the beginning, I just wanted to fix the warning mentioned by #24062 But, the cookie code really doesn't look good to me, so clean up them. Complete the TODO on `SetCookie`: > TODO: Copied from gitea.com/macaron/macaron and should be improved after macaron removed.
* Improve LFS error logs (#24072)wxiaoguang2023-04-121-2/+3
| | | | | The error logs were not clear. Help (but not fix) #24053
* Fix accidental overwriting of LDAP team memberships (#24050)sillyguodong2023-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the `for` loop, the value of `membershipsToAdd[org]` and `membershipsToRemove[org]` is a slice that should be appended instead of overwritten. Due to the current overwrite, the LDAP group sync only matches the last group at the moment. ## Example reproduction - an LDAP user is both a member of `cn=admin_staff,ou=people,dc=planetexpress,dc=com` and `cn=ship_crew,ou=people,dc=planetexpress,dc=com`. - configuration of `Map LDAP groups to Organization teams ` in `Authentication Sources`: ```json { "cn=admin_staff,ou=people,dc=planetexpress,dc=com":{ "test_organization":[ "admin_staff", "test_add" ] }, "cn=ship_crew,ou=people,dc=planetexpress,dc=com":{ "test_organization":[ "ship_crew" ] } ``` - start `Synchronize external user data` task in the `Dashboard`. - the user was only added for the team `test_organization.ship_crew`
* Use actions job link as commit status URL instead of run link (#24023)Jason Song2023-04-101-1/+20
| | | | | | | A commit status is bound to a job, not a run. --------- Co-authored-by: silverwind <me@silverwind.io>
* Make label templates have consistent behavior and priority (#23749)wxiaoguang2023-04-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix https://github.com/go-gitea/gitea/issues/23715 Other related PRs: * #23717 * #23716 * #23719 This PR is different from others, it tries to resolve the problem fundamentally (and brings more benefits) Although it looks like some more lines are added, actually many new lines are for tests. ---- Before, the code was just "guessing" the file type and try to parse them. <details> ![image](https://user-images.githubusercontent.com/2114189/228002245-57d58e27-1078-4da9-bf42-5bc0b264c6ce.png) </details> This PR: * Always remember the original option file names, and always use correct parser for them. * Another benefit is that we can sort the Label Templates now (before there was a map, its key order is undefined) ![image](https://user-images.githubusercontent.com/2114189/228002432-931b9f18-3908-484b-a36b-04760c9ad132.png)
* Update github.com/google/go-github to v51 (#23946)harryzcy2023-04-082-20/+27
| | | | `github.com/google/go-github` has new major version releases frequently. It is required to update all import path, in additional to `go.mod`
* Drop "unrolled/render" package (#23965)wxiaoguang2023-04-081-2/+1
| | | | | | | | | | | | None of the features of `unrolled/render` package is used. The Golang builtin "html/template" just works well. Then we can improve our HTML render to resolve the "$.root.locale.Tr" problem as much as possible. Next step: we can have a template render pool (by Clone), then we can inject global functions with dynamic context to every `Execute` calls. Then we can use `{{Locale.Tr ....}}` directly in all templates , no need to pass the `$.root.locale` again and again.
* Set `ref` to fully-formed of the tag when trigger event is `release` (#23944)sillyguodong2023-04-072-5/+5
| | | | | Fix #23943 When trigger event is `release`, ref should be like `refs/tags/<tag_name>` instead of `CommitID`
* Title can be empty when creating tag only (#23917)Zettat1232023-04-061-1/+1
| | | | | | | | Fixes #23809 Make the title not required. If the title is empty when creating release (not tag), an error message will be displayed. ![image](https://user-images.githubusercontent.com/15528715/229761056-c52e338b-5f25-4d7d-bb44-2cb0304abcee.png)
* Actions: Use default branch as ref when a branch/tag delete occurs (#23910)Brad Nabholz2023-04-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently using the tip of main (2c585d62a4ebbb52175b8fd8697458ae1c3b2937) and when deleting a branch (and presumably tag, but not tested), no workflows with `on: [delete]` are being triggered. The runner isn't being notified about them. I see this in the gitea log: `2023/04/04 04:29:36 ...s/notifier_helper.go:102:Notify() [E] an error occurred while executing the NotifyDeleteRef actions method: gitRepo.GetCommit: object does not exist [id: test, rel_path: ]` Understandably the ref has already been deleted and so `GetCommit` fails. Currently at https://github.com/go-gitea/gitea/blob/main/services/actions/notifier_helper.go#L130, if the ref is an empty string it falls back to the default branch name. This PR also checks if it is a `HookEventDelete` and does the same. Currently `${{ github.ref }}` would be equivalent to the deleted branch (if `notify()` succeded), but this PR allows `notify()` to proceed and also aligns it with the GitHub Actions behavior at https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#delete: `$GITHUB_REF` / `${{ github.ref }}` => Default branch (main/master) `$GITHUB_SHA` / `${{ github.sha }}` => Last commit on default branch If the user needs the name of the deleted branch (or tag), it is available as `${{ github.event.ref }}`. There appears to be no way for the user to get the tip commit SHA of the deleted branch (GitHub does not do this either). N.B. there may be other conditions other than `HookEventDelete` where the default branch ref needs swapped in, but this was sufficient for my use case.