Skip to content

Commit 7685aa9

Browse files
committed
Use -SNAPSHOT as the key to not release oss projects in properties file
1 parent 4844bd6 commit 7685aa9

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

‎.github/scripts/__tests__/release-branch-plan.test.js‎

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ describe('branchFor', () => {
3838
.toEqual({ version: '5.1.0-M1', branch: 'release/5.1.0-M1' });
3939
});
4040

41+
it('OSS skips versions that are not -INTERNAL-SNAPSHOT', () => {
42+
expect(branchFor(OSS, '5.0.4-SNAPSHOT', '').skip).toMatch(/not being released/);
43+
expect(branchFor(OSS, '5.0.3', '').skip).toMatch(/not being released/);
44+
expect(branchFor(OSS, '5.1.0-internal-snapshot', '').branch).toBe('release/5.1.0');
45+
});
46+
4147
it('commercial strips only -SNAPSHOT', () => {
4248
expect(branchFor(COMMERCIAL, '5.0.3-SNAPSHOT', '').branch).toBe('release/5.0.3');
4349
expect(branchFor(COMMERCIAL, '5.0.3', '').branch).toBe('release/5.0.3');
@@ -81,6 +87,17 @@ describe('buildPlan', () => {
8187
{ project: 'spring-cloud-config', branch: 'release/5.1.0', reason: 'branch already exists' }]);
8288
});
8389

90+
it('only plans the -INTERNAL-SNAPSHOT projects of an OSS train', () => {
91+
const { todo, skipped } = buildPlan({
92+
mode: OSS, train: '2026.1.0', ...noTags,
93+
entries: entries([['spring-cloud-config', '5.1.0-INTERNAL-SNAPSHOT'],
94+
['spring-cloud-commons', '5.1.0-SNAPSHOT'], ['spring-cloud-release', '2026.1.0-INTERNAL-SNAPSHOT']]),
95+
});
96+
expect(todo.map(t => t.project)).toEqual(['spring-cloud-config', 'spring-cloud-release']);
97+
expect(skipped).toEqual([{
98+
project: 'spring-cloud-commons', reason: 'not being released in this train (not -INTERNAL-SNAPSHOT)' }]);
99+
});
100+
84101
it('only plans the hotfix projects of a hotfix train', () => {
85102
const { todo, skipped } = buildPlan({
86103
mode: HOTFIX, train: '2025.1.2', ...noTags,
@@ -96,9 +113,9 @@ describe('buildPlan', () => {
96113
])('skips a version already tagged in the %s, even with no branch', (_, taggedRepo) => {
97114
const tagExists = (repo, tag) => repo === taggedRepo && tag === 'v5.0.3';
98115
const { todo, skipped } = buildPlan({
99-
mode: OSS, train: '2026.1.0', branchExists: none, tagExists,
116+
mode: COMMERCIAL, train: '2025.1.2', branchExists: none, tagExists,
100117
// Not being released in this train: the entry still names the previous release.
101-
entries: entries([['spring-cloud-config', '5.0.3'], ['spring-cloud-commons', '5.1.0-INTERNAL-SNAPSHOT']]),
118+
entries: entries([['spring-cloud-config', '5.0.3'], ['spring-cloud-commons', '5.0.4']]),
102119
});
103120
expect(todo.map(t => t.project)).toEqual(['spring-cloud-commons']);
104121
expect(skipped).toEqual([{

‎.github/scripts/release-branch-plan.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
// create-commercial-release-branch reads <train>, creates release/<x.y.z>
1919
// create-hotfix-release-branch reads <train>, creates release/<x.y.z.h>
2020
//
21+
// The -INTERNAL-SNAPSHOT file lists every project, but only the ones being released in the
22+
// train are at -INTERNAL-SNAPSHOT. The rest are at plain -SNAPSHOT and have neither a tag nor a
23+
// release branch yet, so the tag and branch checks cannot tell them apart - the suffix does.
24+
//
2125
// Hotfix versions are the 4-segment ones. The releaser config lists them as -SNAPSHOT, since
2226
// the train is not finalized when the branches are cut.
2327

@@ -66,6 +70,9 @@ const branchFor = (mode, rawVersion, qualifier) => {
6670
}
6771

6872
if (mode === 'create-oss-release-branch') {
73+
if (!/-INTERNAL-SNAPSHOT$/i.test(rawVersion)) {
74+
return { skip: 'not being released in this train (not -INTERNAL-SNAPSHOT)' };
75+
}
6976
// 5.1.0-INTERNAL-SNAPSHOT -> 5.1.0: everything after the first `-` goes.
7077
const version = rawVersion.split('-')[0];
7178
if (!/^\d+\.\d+(\..+)?$/.test(version)) return { skip: `unusable version '${rawVersion}'` };

‎.github/workflows/README-create-release-branches.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The plan logic is [`release-branch-plan.js`](../scripts/release-branch-plan.js).
1515

1616
| Mode | Properties file | Branch (and `v<version>` tag) checked | Projects included |
1717
|------|-----------------|----------------|-------------------|
18-
| `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 |
18+
| `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 |
1919
| `create-commercial-release-branch` | `<train>` | `release/<x.y.z>` | every project; the source branch is resolved per project with `resolve-release-branch` |
2020
| `create-hotfix-release-branch` | `<train>` | `release/<x.y.z.h>` | only projects with a 4-segment version (e.g. `5.0.4.1-SNAPSHOT`) |
2121

‎.github/workflows/create-release-branches.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ run-name: "Create Release Branches - ${{ inputs.mode }} - ${{ inputs.spring_clou
55
# Runs one of the single-project branch-creation workflows for every project in a release
66
# train that does not have its release branch yet.
77
#
8-
# create-oss-release-branch OSS release; reads <train>-INTERNAL-SNAPSHOT
8+
# create-oss-release-branch OSS release; reads <train>-INTERNAL-SNAPSHOT, the -INTERNAL-SNAPSHOT
9+
# projects only (plain -SNAPSHOT ones aren't being released)
910
# create-commercial-release-branch commercial-only release; reads <train>
1011
# create-hotfix-release-branch hotfix; reads <train>, the 4-segment (x.y.z.h) projects only
1112
#

0 commit comments

Comments
 (0)