Revert "docs: clarify release deployment process and enable manual deploy trigger"
This reverts commit c40374c280.
This commit is contained in:
parent
c40374c280
commit
a0bc09dbe1
4 changed files with 112 additions and 134 deletions
|
|
@ -36,4 +36,4 @@ type RepositorySource string
|
|||
const (
|
||||
SourceGitHub RepositorySource = "github"
|
||||
SourceGitLab RepositorySource = "gitlab"
|
||||
)
|
||||
)
|
||||
|
|
@ -35,7 +35,7 @@ func HasNoSpaces(s string) bool {
|
|||
func extractTemplateVariables(url string) []string {
|
||||
re := regexp.MustCompile(`\{([^}]+)\}`)
|
||||
matches := re.FindAllStringSubmatch(url, -1)
|
||||
|
||||
|
||||
var variables []string
|
||||
for _, match := range matches {
|
||||
if len(match) > 1 {
|
||||
|
|
@ -55,16 +55,16 @@ func replaceTemplateVariables(rawURL string) string {
|
|||
"{protocol}": "http",
|
||||
"{scheme}": "http",
|
||||
}
|
||||
|
||||
|
||||
result := rawURL
|
||||
for placeholder, replacement := range templateReplacements {
|
||||
result = strings.ReplaceAll(result, placeholder, replacement)
|
||||
}
|
||||
|
||||
|
||||
// Handle any remaining {variable} patterns with generic placeholder
|
||||
re := regexp.MustCompile(`\{[^}]+\}`)
|
||||
result = re.ReplaceAllString(result, "placeholder")
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ func replaceTemplateVariables(rawURL string) string {
|
|||
func IsValidURL(rawURL string) bool {
|
||||
// Replace template variables with placeholders for parsing
|
||||
testURL := replaceTemplateVariables(rawURL)
|
||||
|
||||
|
||||
// Parse the URL
|
||||
u, err := url.Parse(testURL)
|
||||
if err != nil {
|
||||
|
|
@ -131,19 +131,19 @@ func IsValidRemoteURL(rawURL string) bool {
|
|||
if !IsValidURL(rawURL) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// Parse the URL to check for localhost restriction
|
||||
u, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// Reject localhost URLs for remotes (security/production concerns)
|
||||
hostname := u.Hostname()
|
||||
if hostname == "localhost" || hostname == "127.0.0.1" || strings.HasSuffix(hostname, ".localhost") {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -155,31 +155,31 @@ func IsValidTemplatedURL(rawURL string, availableVariables []string, allowTempla
|
|||
if !IsValidURL(rawURL) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// Extract template variables from URL
|
||||
templateVars := extractTemplateVariables(rawURL)
|
||||
|
||||
|
||||
// If no templates are found, it's a valid static URL
|
||||
if len(templateVars) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
// If templates are not allowed (e.g., for remotes), reject URLs with templates
|
||||
if !allowTemplates {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// Validate that all template variables are available
|
||||
availableSet := make(map[string]bool)
|
||||
for _, v := range availableVariables {
|
||||
availableSet[v] = true
|
||||
}
|
||||
|
||||
|
||||
for _, templateVar := range templateVars {
|
||||
if !availableSet[templateVar] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -505,4 +505,4 @@ func isValidHostForDomain(hostname, publisherDomain string) bool {
|
|||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
@ -893,10 +893,10 @@ func TestValidate_ServerNameFormat(t *testing.T) {
|
|||
|
||||
func TestValidate_MultipleSlashesInServerName(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serverName string
|
||||
expectError bool
|
||||
errorMsg string
|
||||
name string
|
||||
serverName string
|
||||
expectError bool
|
||||
errorMsg string
|
||||
}{
|
||||
{
|
||||
name: "single slash - valid",
|
||||
|
|
@ -1592,4 +1592,4 @@ func createValidServerWithArgument(arg model.Argument) apiv0.ServerJSON {
|
|||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue