Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5ac62e

Browse files
pditommasoclaude
andcommitted
Promote 'latest' stable channel by version comparison instead of branch name
The release task updated the releases/latest channel pointer only when the release ran from 'master'. Now that stable patches are cut from STABLE-*.x maintenance branches, such a release was fully published but never promoted as the latest stable, so users kept being served the previous version. Decide by version instead: read the currently published version from the same endpoint the launcher polls (https://www.nextflow.io/releases/latest/version) and compare it with the released version using the launcher's own cmp_ver(), promoting only when strictly newer. This promotes a stable patch from any STABLE-*.x branch while preventing an older maintenance line from clobbering a newer latest; promotion is skipped (not failed) if the comparator or published version can't be read. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]>
1 parent ea3f2aa commit b5ac62e

1 file changed

Lines changed: 38 additions & 7 deletions

File tree

packing.gradle

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,47 @@ task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions])
273273
aws s3 cp $versionFile s3://www2.nextflow.io/releases/edge/version $s3CmdOpts
274274
""".stripIndent()
275275

276-
else if( isLatest && branch == 'master' )
276+
else if( isLatest )
277277
cmd += """
278-
# publish the script as the latest
278+
# Publish this build as the 'latest' stable channel pointer (the one resolved by
279+
# `nextflow self-update` and by fresh `curl get.nextflow.io` installs).
280+
#
281+
# This promotion used to be gated on the release running from the 'master' branch.
282+
# That assumption broke once stable patches started being cut from STABLE-*.x
283+
# maintenance branches: such a release was fully published (artifacts, tag, GitHub
284+
# release, Maven, plugins) but the 'latest' pointer was never updated, so users kept
285+
# being served the previous version.
286+
#
287+
# Instead, decide by version. Read the version currently advertised as latest from
288+
# the exact same endpoint the launcher polls in check_latest()
289+
# (https://www.nextflow.io/releases/latest/version), and compare it with the version
290+
# being released using the launcher's OWN cmp_ver() function -- extracted from the
291+
# released `nextflow` script so the comparison is identical to Nextflow's and there is
292+
# no second copy of the semver logic to keep in sync. Promote only when this release
293+
# is strictly newer. Effects:
294+
# - a stable patch from any STABLE-*.x branch is promoted (it is newer than latest);
295+
# - an older maintenance line (e.g. a later 25.10.x patch published while latest is
296+
# already 26.04.x) cannot clobber the newer pointer;
297+
# - if the comparator or the published version can't be obtained, promotion is
298+
# skipped rather than failed, so a transient error never demotes the channel.
279299
export AWS_ACCESS_KEY_ID=${System.env.NXF_AWS_ACCESS}
280300
export AWS_SECRET_ACCESS_KEY=${System.env.NXF_AWS_SECRET}
281-
aws s3 cp $launcherFile s3://www2.nextflow.io/releases/latest/nextflow $s3CmdOpts
282-
aws s3 cp $launcherSha1 s3://www2.nextflow.io/releases/latest/nextflow.sha1 $s3CmdOpts
283-
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/latest/nextflow.sha256 $s3CmdOpts
284-
aws s3 cp $launcherMd5 s3://www2.nextflow.io/releases/latest/nextflow.md5 $s3CmdOpts
285-
aws s3 cp $versionFile s3://www2.nextflow.io/releases/latest/version $s3CmdOpts
301+
eval "\$(sed -n '/^function cmp_ver()/,/^}/p' $launcherFile)" || true
302+
published=\$(curl -fsSL https://www.nextflow.io/releases/latest/version 2>/dev/null | tr -d '[:space:]') || true
303+
if ! declare -F cmp_ver >/dev/null; then
304+
echo "Skipping 'latest' promotion: version comparator could not be loaded"
305+
elif [ -z "\$published" ]; then
306+
echo "Skipping 'latest' promotion: could not read the currently published version"
307+
elif [ "\$(cmp_ver "$version" "\$published")" -le 0 ]; then
308+
echo "Skipping 'latest' promotion: $version is not newer than published \$published"
309+
else
310+
echo "Promoting $version to the 'latest' stable channel (previously \$published)"
311+
aws s3 cp $launcherFile s3://www2.nextflow.io/releases/latest/nextflow $s3CmdOpts
312+
aws s3 cp $launcherSha1 s3://www2.nextflow.io/releases/latest/nextflow.sha1 $s3CmdOpts
313+
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/latest/nextflow.sha256 $s3CmdOpts
314+
aws s3 cp $launcherMd5 s3://www2.nextflow.io/releases/latest/nextflow.md5 $s3CmdOpts
315+
aws s3 cp $versionFile s3://www2.nextflow.io/releases/latest/version $s3CmdOpts
316+
fi
286317
""".stripIndent()
287318

288319
def temp = File.createTempFile('upload',null)

0 commit comments

Comments
 (0)