mirror of
https://github.com/harness/drone.git
synced 2025-05-12 15:10:09 +08:00
support for gitlab and github internal visibility
This commit is contained in:
parent
6af2647e43
commit
ba172461f4
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [unreleased]
|
## [unreleased]
|
||||||
### Added
|
### Added
|
||||||
- support for repository-level concurrency limits.
|
- support for repository-level concurrency limits.
|
||||||
|
- support for gitlab and github internal visibility on initial sync.
|
||||||
|
|
||||||
## [1.10.0]
|
## [1.10.0]
|
||||||
### Added
|
### Added
|
||||||
|
2
go.mod
2
go.mod
@ -20,7 +20,7 @@ require (
|
|||||||
github.com/drone/envsubst v1.0.3-0.20200709231038-aa43e1c1a629
|
github.com/drone/envsubst v1.0.3-0.20200709231038-aa43e1c1a629
|
||||||
github.com/drone/go-license v1.0.2
|
github.com/drone/go-license v1.0.2
|
||||||
github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2
|
github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2
|
||||||
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b
|
github.com/drone/go-scm v1.8.0
|
||||||
github.com/drone/signal v1.0.0
|
github.com/drone/signal v1.0.0
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/go-chi/chi v3.3.3+incompatible
|
github.com/go-chi/chi v3.3.3+incompatible
|
||||||
|
2
go.sum
2
go.sum
@ -106,6 +106,8 @@ github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c h1:3Dv6guONE4nry6fv
|
|||||||
github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
|
github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
|
||||||
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b h1:ivLeFPmHN+9sLMVAF7HvgvEglU5tzoqlzePLY5zKPo8=
|
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b h1:ivLeFPmHN+9sLMVAF7HvgvEglU5tzoqlzePLY5zKPo8=
|
||||||
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
|
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
|
||||||
|
github.com/drone/go-scm v1.8.0 h1:kDHu38a11loKf6uaBu75TmY1YPwsSaZdseET738Oy0o=
|
||||||
|
github.com/drone/go-scm v1.8.0/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
|
||||||
github.com/drone/signal v1.0.0 h1:NrnM2M/4yAuU/tXs6RP1a1ZfxnaHwYkd0kJurA1p6uI=
|
github.com/drone/signal v1.0.0 h1:NrnM2M/4yAuU/tXs6RP1a1ZfxnaHwYkd0kJurA1p6uI=
|
||||||
github.com/drone/signal v1.0.0/go.mod h1:S8t92eFT0g4WUgEc/LxG+LCuiskpMNsG0ajAMGnyZpc=
|
github.com/drone/signal v1.0.0/go.mod h1:S8t92eFT0g4WUgEc/LxG+LCuiskpMNsG0ajAMGnyZpc=
|
||||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||||
|
@ -41,6 +41,12 @@ func convertRepository(src *scm.Repository, visibility string, trusted bool) *co
|
|||||||
// convertVisibility is a helper function that returns the
|
// convertVisibility is a helper function that returns the
|
||||||
// repository visibility based on the privacy flag.
|
// repository visibility based on the privacy flag.
|
||||||
func convertVisibility(src *scm.Repository, visibility string) string {
|
func convertVisibility(src *scm.Repository, visibility string) string {
|
||||||
|
// if the visibility is set to internal (github enterprise and gitlab)
|
||||||
|
// and the global visibility is empty, automatically set to internal.
|
||||||
|
if visibility == "" && src.Visibility == scm.VisibilityInternal {
|
||||||
|
return core.VisibilityInternal
|
||||||
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case src.Private == true:
|
case src.Private == true:
|
||||||
return core.VisibilityPrivate
|
return core.VisibilityPrivate
|
||||||
|
@ -55,6 +55,10 @@ func TestConvertVisibility(t *testing.T) {
|
|||||||
r: &scm.Repository{Private: true},
|
r: &scm.Repository{Private: true},
|
||||||
v: core.VisibilityPrivate,
|
v: core.VisibilityPrivate,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
r: &scm.Repository{Private: true, Visibility: scm.VisibilityInternal},
|
||||||
|
v: core.VisibilityInternal,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user