From 7685aa9cb141f3651119837eaa76dbd4ee287a46 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Thu, 8 Oct 2026 14:31:13 -0400 Subject: [PATCH] Use -SNAPSHOT as the key to not release oss projects in properties file --- .../__tests__/release-branch-plan.test.js | 21 +++++++++++++++++-- .github/scripts/release-branch-plan.js | 7 +++++++ .../README-create-release-branches.md | 2 +- .github/workflows/create-release-branches.yml | 3 ++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/scripts/__tests__/release-branch-plan.test.js b/.github/scripts/__tests__/release-branch-plan.test.js index 5a3b533..428b5fb 100644 --- a/.github/scripts/__tests__/release-branch-plan.test.js +++ b/.github/scripts/__tests__/release-branch-plan.test.js @@ -38,6 +38,12 @@ describe('branchFor', () => { .toEqual({ version: '5.1.0-M1', branch: 'release/5.1.0-M1' }); }); + it('OSS skips versions that are not -INTERNAL-SNAPSHOT', () => { + expect(branchFor(OSS, '5.0.4-SNAPSHOT', '').skip).toMatch(/not being released/); + expect(branchFor(OSS, '5.0.3', '').skip).toMatch(/not being released/); + expect(branchFor(OSS, '5.1.0-internal-snapshot', '').branch).toBe('release/5.1.0'); + }); + it('commercial strips only -SNAPSHOT', () => { expect(branchFor(COMMERCIAL, '5.0.3-SNAPSHOT', '').branch).toBe('release/5.0.3'); expect(branchFor(COMMERCIAL, '5.0.3', '').branch).toBe('release/5.0.3'); @@ -81,6 +87,17 @@ describe('buildPlan', () => { { project: 'spring-cloud-config', branch: 'release/5.1.0', reason: 'branch already exists' }]); }); + it('only plans the -INTERNAL-SNAPSHOT projects of an OSS train', () => { + const { todo, skipped } = buildPlan({ + mode: OSS, train: '2026.1.0', ...noTags, + entries: entries([['spring-cloud-config', '5.1.0-INTERNAL-SNAPSHOT'], + ['spring-cloud-commons', '5.1.0-SNAPSHOT'], ['spring-cloud-release', '2026.1.0-INTERNAL-SNAPSHOT']]), + }); + expect(todo.map(t => t.project)).toEqual(['spring-cloud-config', 'spring-cloud-release']); + expect(skipped).toEqual([{ + project: 'spring-cloud-commons', reason: 'not being released in this train (not -INTERNAL-SNAPSHOT)' }]); + }); + it('only plans the hotfix projects of a hotfix train', () => { const { todo, skipped } = buildPlan({ mode: HOTFIX, train: '2025.1.2', ...noTags, @@ -96,9 +113,9 @@ describe('buildPlan', () => { ])('skips a version already tagged in the %s, even with no branch', (_, taggedRepo) => { const tagExists = (repo, tag) => repo === taggedRepo && tag === 'v5.0.3'; const { todo, skipped } = buildPlan({ - mode: OSS, train: '2026.1.0', branchExists: none, tagExists, + mode: COMMERCIAL, train: '2025.1.2', branchExists: none, tagExists, // Not being released in this train: the entry still names the previous release. - entries: entries([['spring-cloud-config', '5.0.3'], ['spring-cloud-commons', '5.1.0-INTERNAL-SNAPSHOT']]), + entries: entries([['spring-cloud-config', '5.0.3'], ['spring-cloud-commons', '5.0.4']]), }); expect(todo.map(t => t.project)).toEqual(['spring-cloud-commons']); expect(skipped).toEqual([{ diff --git a/.github/scripts/release-branch-plan.js b/.github/scripts/release-branch-plan.js index 4124aca..706efc8 100644 --- a/.github/scripts/release-branch-plan.js +++ b/.github/scripts/release-branch-plan.js @@ -18,6 +18,10 @@ // create-commercial-release-branch reads , creates release/ // create-hotfix-release-branch reads , creates release/ // +// The -INTERNAL-SNAPSHOT file lists every project, but only the ones being released in the +// train are at -INTERNAL-SNAPSHOT. The rest are at plain -SNAPSHOT and have neither a tag nor a +// release branch yet, so the tag and branch checks cannot tell them apart - the suffix does. +// // Hotfix versions are the 4-segment ones. The releaser config lists them as -SNAPSHOT, since // the train is not finalized when the branches are cut. @@ -66,6 +70,9 @@ const branchFor = (mode, rawVersion, qualifier) => { } if (mode === 'create-oss-release-branch') { + if (!/-INTERNAL-SNAPSHOT$/i.test(rawVersion)) { + return { skip: 'not being released in this train (not -INTERNAL-SNAPSHOT)' }; + } // 5.1.0-INTERNAL-SNAPSHOT -> 5.1.0: everything after the first `-` goes. const version = rawVersion.split('-')[0]; if (!/^\d+\.\d+(\..+)?$/.test(version)) return { skip: `unusable version '${rawVersion}'` }; diff --git a/.github/workflows/README-create-release-branches.md b/.github/workflows/README-create-release-branches.md index 4dad7f9..742e03e 100644 --- a/.github/workflows/README-create-release-branches.md +++ b/.github/workflows/README-create-release-branches.md @@ -15,7 +15,7 @@ The plan logic is [`release-branch-plan.js`](../scripts/release-branch-plan.js). | Mode | Properties file | Branch (and `v` tag) checked | Projects included | |------|-----------------|----------------|-------------------| -| `create-oss-release-branch` | `-INTERNAL-SNAPSHOT` (the `-M`/`-RC` phase is stripped for the lookup) | `release/[-M1\|-RC2]` | every project | +| `create-oss-release-branch` | `-INTERNAL-SNAPSHOT` (the `-M`/`-RC` phase is stripped for the lookup) | `release/[-M1\|-RC2]` | only projects whose version is `-INTERNAL-SNAPSHOT`; plain `-SNAPSHOT` entries aren't being released in the train | | `create-commercial-release-branch` | `` | `release/` | every project; the source branch is resolved per project with `resolve-release-branch` | | `create-hotfix-release-branch` | `` | `release/` | only projects with a 4-segment version (e.g. `5.0.4.1-SNAPSHOT`) | diff --git a/.github/workflows/create-release-branches.yml b/.github/workflows/create-release-branches.yml index 311b706..f3001f5 100644 --- a/.github/workflows/create-release-branches.yml +++ b/.github/workflows/create-release-branches.yml @@ -5,7 +5,8 @@ run-name: "Create Release Branches - ${{ inputs.mode }} - ${{ inputs.spring_clou # Runs one of the single-project branch-creation workflows for every project in a release # train that does not have its release branch yet. # -# create-oss-release-branch OSS release; reads -INTERNAL-SNAPSHOT +# create-oss-release-branch OSS release; reads -INTERNAL-SNAPSHOT, the -INTERNAL-SNAPSHOT +# projects only (plain -SNAPSHOT ones aren't being released) # create-commercial-release-branch commercial-only release; reads # create-hotfix-release-branch hotfix; reads , the 4-segment (x.y.z.h) projects only #