Allow to define default branches#125

Merged
6543 merged 26 commits from deblan/pages-server:issue115 into main 2023-02-14 04:03:02 +01:00
Contributor

This is a POC for #115 (comment: #115 (comment))

This is a POC for #115 (comment: https://codeberg.org/Codeberg/pages-server/issues/115#issuecomment-602405)
fix tests
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
3c225c4648
fix tests
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
865cc9f1f6
add first default branch on DNS query
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
320564ec18
deblan changed title from WIP: (POC) Allow to define default branches to (POC) Allow to define default branches 2022-08-18 11:46:07 +02:00
cmd/main.go Outdated
@ -48,6 +48,7 @@ func Serve(ctx *cli.Context) error {
giteaAPIToken := ctx.String("gitea-api-token")
rawDomain := ctx.String("raw-domain")
mainDomainSuffix := []byte(ctx.String("pages-domain"))
defaultBranches := strings.Split(strings.ReplaceAll(ctx.String("pages-branches"), " ", ""), ",")
Contributor

just use ctx.StringSlice() & and cli.StringSliceFlag

just use ctx.StringSlice() & and cli.StringSliceFlag
deblan marked this conversation as resolved
Merge branch 'main' into issue115
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
06bde50161
usage of ctx.StringSlice and cli.StringSliceFlag
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
5db46e99fe
rename param pages-branches with pages-branch
deblan changed title from (POC) Allow to define default branches to Allow to define default branches 2022-11-11 17:13:48 +01:00
Contributor

I'll resolve conflicts and merge it once #106 got merged

I'll resolve conflicts and merge it once #106 got merged
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
088db6832a
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
516cb6677c
6543 added this to the v5.0 milestone 2022-11-12 21:02:39 +01:00
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
1d5801e18b
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
9a48680948
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
0b53a18533
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
bbf85590c4
Contributor

@deblan ok I fixed all conflicts, can you look if I missed something or if now it does not work as you thought ...

... I'll review it later once v4.0 release is done and is out in the wild for a short time to make sure there are no regressions :)

@deblan ok I fixed all conflicts, can you look if I missed something or if now it does not work as you thought ... ... I'll review it later once v4.0 release is done and is out in the wild for a short time to make sure there are no regressions :)
Merge branch 'main' into issue115
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
27f4da6637
Author
Contributor

@deblan ok I fixed all conflicts, can you look if I missed something or if now it does not work as you thought ...

... I'll review it later once v4.0 release is done and is out in the wild for a short time to make sure there are no regressions :)

Something does not work as expected. I'm debbuging it!

> @deblan ok I fixed all conflicts, can you look if I missed something or if now it does not work as you thought ... > > ... I'll review it later once v4.0 release is done and is out in the wild for a short time to make sure there are no regressions :) Something does not work as expected. I'm debbuging it!
add missing targeted branch
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
a04ca09d8c
@ -93,2 +110,2 @@
TargetBranch: defaultPagesBranch,
TargetPath: path.Join(pathElements[1:]...),
TargetRepo: defaultPagesRepo,
TargetBranch: branch,
Contributor

that's a breaking change witch would make a lot of pages unusable:

just to name some

tldr: defaultPagesRepo dont need "defaultPagesBranch" it just uses the default branch of the repo aka. branch=""

that's a breaking change witch would make a lot of pages unusable: - https://mootex.codeberg.page/ - https://shitpostalotl.codeberg.page/ - https://radiofenouil.codeberg.page/ - https://johns-casa.de/ ... just to name some tldr: defaultPagesRepo dont need "defaultPagesBranch" it just uses the default branch of the repo aka. branch=""
Contributor

well it's not as its covered below the loop

well it's not as its covered below the loop
6543 marked this conversation as resolved
Author
Contributor

Add "main" in PAGES_BRANCHES (or as value of pages-branch) in and it will work painless:

export PAGES_BRANCHES="pages,main" 

This exaclty the goal of this PR ;)

Add "main" in `PAGES_BRANCHES` (or as value of `pages-branch`) in and it will work painless: ``` export PAGES_BRANCHES="pages,main" ``` This exaclty the goal of this PR ;)
fix tests
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
c54328d6d3
fix tests
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
dfea70b5cc
Contributor

Well but that would break non pages repo with main branch ... as these would also be served then

Well but that would break non pages repo with main branch ... as these would also be served then
Author
Contributor

We can imagine à specific behavior for repos named pages by automatically allow main and master.

We can imagine à specific behavior for repos named `pages` by automatically allow `main` and `master`.
defined branches are requested before the default branch on the default repo
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
51954417cd
rm unrelated remove
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
161739e35d
untouch unrelated
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
d7d853e3e6
6543 approved these changes 2023-02-14 04:00:18 +01:00
6543 referenced this pull request from a commit 2023-02-14 04:03:02 +01:00
6543 merged commit 42d5802b9b into main 2023-02-14 04:03:02 +01:00
Sign in to join this conversation.
No description provided.