From 1530267b501776c1a26c2305103793490eac7245 Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Fri, 22 Nov 2019 13:02:06 +1100 Subject: [PATCH] Prevent publishing alpha/beta releases as latest on DockerHub --- cmd/authelia-scripts/cmd_docker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/authelia-scripts/cmd_docker.go b/cmd/authelia-scripts/cmd_docker.go index 8e392963d..d72714c37 100644 --- a/cmd/authelia-scripts/cmd_docker.go +++ b/cmd/authelia-scripts/cmd_docker.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "os" + "regexp" "strings" "github.com/clems4ever/authelia/internal/utils" @@ -198,6 +199,7 @@ func publishDockerManifest() { travisBranch := os.Getenv("TRAVIS_BRANCH") travisPullRequest := os.Getenv("TRAVIS_PULL_REQUEST") travisTag := os.Getenv("TRAVIS_TAG") + ignoredSuffixes := regexp.MustCompile("alpha|beta") if travisBranch == "master" && travisPullRequest == "false" { login(docker) @@ -205,7 +207,9 @@ func publishDockerManifest() { } else if travisTag != "" { login(docker) deployManifest(docker, travisTag, travisTag+"-amd64", travisTag+"-arm32v7", travisTag+"-arm64v8") - deployManifest(docker, "latest", "latest-amd64", "latest-arm32v7", "latest-arm64v8") + if !ignoredSuffixes.MatchString(travisTag) { + deployManifest(docker, "latest", "latest-amd64", "latest-arm32v7", "latest-arm64v8") + } } else { fmt.Println("Docker manifest will not be published") }