Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/scripts/__tests__/release-branch-plan.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
Expand All @@ -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([{
Expand Down
7 changes: 7 additions & 0 deletions .github/scripts/release-branch-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
// create-commercial-release-branch reads <train>, creates release/<x.y.z>
// create-hotfix-release-branch reads <train>, creates release/<x.y.z.h>
//
// 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.

Expand Down Expand Up @@ -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}'` };
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/README-create-release-branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The plan logic is [`release-branch-plan.js`](../scripts/release-branch-plan.js).

| Mode | Properties file | Branch (and `v<version>` tag) checked | Projects included |
|------|-----------------|----------------|-------------------|
| `create-oss-release-branch` | `<train>-INTERNAL-SNAPSHOT` (the `-M<n>`/`-RC<n>` phase is stripped for the lookup) | `release/<x.y.z>[-M1\|-RC2]` | every project |
| `create-oss-release-branch` | `<train>-INTERNAL-SNAPSHOT` (the `-M<n>`/`-RC<n>` phase is stripped for the lookup) | `release/<x.y.z>[-M1\|-RC2]` | only projects whose version is `-INTERNAL-SNAPSHOT`; plain `-SNAPSHOT` entries aren't being released in the train |
| `create-commercial-release-branch` | `<train>` | `release/<x.y.z>` | every project; the source branch is resolved per project with `resolve-release-branch` |
| `create-hotfix-release-branch` | `<train>` | `release/<x.y.z.h>` | only projects with a 4-segment version (e.g. `5.0.4.1-SNAPSHOT`) |

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/create-release-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <train>-INTERNAL-SNAPSHOT
# create-oss-release-branch OSS release; reads <train>-INTERNAL-SNAPSHOT, the -INTERNAL-SNAPSHOT
# projects only (plain -SNAPSHOT ones aren't being released)
# create-commercial-release-branch commercial-only release; reads <train>
# create-hotfix-release-branch hotfix; reads <train>, the 4-segment (x.y.z.h) projects only
#
Expand Down
Loading