Skip to content

Commit 0847583

Browse files
Warn when metadata.url is not a https URL and don't fallback to internal actions
1 parent f61e874 commit 0847583

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

internal/makefile/makefile.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ func newMakefile(cfg core.Configuration, sr golang.ScanResult) *makefile {
3535
runControllerGen := cfg.ControllerGen.Enabled.UnwrapOr(sr.KubernetesController)
3636
// TODO: checking on GoVersion is only an aid until we can properly detect rust applications
3737
isGolang := sr.GoVersion != ""
38+
39+
if !strings.HasPrefix(cfg.Metadata.URL, "https://") {
40+
logg.Error("The option metadata.url should always start with https://, eg: https://github.com/sapcc/go-makefile-maker")
41+
logg.Error("Some defaults or usages of the metadata might not work correctly")
42+
}
43+
3844
isSAPCC := cfg.Metadata.IsSAPProject()
3945

4046
///////////////////////////////////////////////////////////////////////////

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ func main() {
5151
must.Succeed(file.Close())
5252
cfg.Validate()
5353

54-
if cfg.GitHubWorkflow != nil && !strings.HasPrefix(cfg.Metadata.URL, "https://github.com/") {
54+
// The github.com/ prefix is just a safeguard to avoid false positives when the metadata.url is not complete.
55+
if cfg.GitHubWorkflow != nil && !strings.Contains(cfg.Metadata.URL, "github.com/") {
5556
cfg.GitHubWorkflow.IsSelfHostedRunner = true
5657
if strings.Contains(cfg.Metadata.URL, "/sap-cloud-infrastructure/") {
5758
cfg.GitHubWorkflow.IsSugarRunner = true

0 commit comments

Comments
 (0)