From 7c92c681fcd861a842ad1c551edd2924db399537 Mon Sep 17 00:00:00 2001 From: Walt Della Date: Thu, 3 Mar 2022 11:42:51 -0800 Subject: [PATCH] Do not block apt publishing if there is a more current pre-release We do not publish pre-releases to apt repos, but we do publish them to github. That means we need to filter them out when considering if an apt release should be published. We don't want v8.3.3 to be blocked by v9.0.0-dev.1, only by v9.0.0. Honestly, this is a bit of a mess, but it only needs to hold out a bit longer until https://github.com/gravitational/teleport/pull/10746 lands. Contributes to https://github.com/gravitational/teleport/issues/10800 (cherry picked from commit 08bc483f6869e5d70b8c38ffe24a9db493332530) --- build.assets/tooling/cmd/check/main.go | 6 ++++++ build.assets/tooling/cmd/check/main_test.go | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/build.assets/tooling/cmd/check/main.go b/build.assets/tooling/cmd/check/main.go index 16fb6dca2f6af..ac1b8fe3172b6 100644 --- a/build.assets/tooling/cmd/check/main.go +++ b/build.assets/tooling/cmd/check/main.go @@ -90,6 +90,12 @@ func checkLatest(ctx context.Context, tag string, gh github.GitHub) error { if r.GetDraft() { continue } + // Because pre-releases are not published to apt, we do not want to + // consider them when making apt publishing decisions. + // see: https://github.com/gravitational/teleport/issues/10800 + if semver.Prerelease(r.GetTagName()) != "" { + continue + } tags = append(tags, r.GetTagName()) } diff --git a/build.assets/tooling/cmd/check/main_test.go b/build.assets/tooling/cmd/check/main_test.go index 4c2ab57368c7f..3ca92aab1b9b2 100644 --- a/build.assets/tooling/cmd/check/main_test.go +++ b/build.assets/tooling/cmd/check/main_test.go @@ -105,6 +105,15 @@ func TestCheckLatest(t *testing.T) { }, wantErr: require.NoError, }, + { // see https://github.com/gravitational/teleport/issues/10800 + desc: "pass-pre-release", + tag: "v8.3.3", + releases: []string{ + "v9.0.0-beta.1", + "v8.3.2", + }, + wantErr: require.NoError, + }, } for _, test := range tests { t.Run(test.desc, func(t *testing.T) {