rombert commented on code in PR #32: URL: https://github.com/apache/sling-org-apache-sling-committer-cli/pull/32#discussion_r3602904509
########## src/main/java/org/apache/sling/cli/impl/release/UpdateDistCommand.java: ########## @@ -0,0 +1,303 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.sling.cli.impl.release; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Stream; + +import org.apache.sling.cli.impl.Command; +import org.apache.sling.cli.impl.Credentials; +import org.apache.sling.cli.impl.CredentialsService; +import org.apache.sling.cli.impl.InputOption; +import org.apache.sling.cli.impl.UserInput; +import org.apache.sling.cli.impl.nexus.Artifact; +import org.apache.sling.cli.impl.nexus.LocalRepository; +import org.apache.sling.cli.impl.nexus.RepositoryService; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.tmatesoft.svn.core.SVNCommitInfo; +import org.tmatesoft.svn.core.SVNDirEntry; +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.auth.BasicAuthenticationManager; +import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; +import org.tmatesoft.svn.core.io.ISVNEditor; +import org.tmatesoft.svn.core.io.SVNRepository; +import org.tmatesoft.svn.core.io.SVNRepositoryFactory; +import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator; +import picocli.CommandLine; + +/** + * Publishes a release's staged artifacts to {@code dist/release/sling} on dist.apache.org and removes + * the previous release, using SVNKit's pure-Java Subversion client over https. + * + * <p>This follows the flow used for Maven-based Sling module releases (see the Sling release management + * guide): the artifacts are downloaded from the Nexus staging repository and committed to + * {@code dist/release/sling}. Unlike the Sling IDE tooling, Maven releases never stage to + * {@code dist/dev}. Requires PMC membership to commit to dist.apache.org. + */ +@Component( + service = Command.class, + property = { + Command.PROPERTY_NAME_COMMAND_GROUP + "=" + UpdateDistCommand.GROUP, + Command.PROPERTY_NAME_COMMAND_NAME + "=" + UpdateDistCommand.NAME + }) [email protected]( + name = UpdateDistCommand.NAME, + description = "Publishes a release's staged artifacts to dist/release on dist.apache.org and removes the" + + " previous release. Requires PMC membership.", + subcommands = CommandLine.HelpCommand.class) +public class UpdateDistCommand implements Command { + + static final String GROUP = "release"; + static final String NAME = "update-dist"; + + static final String DIST_RELEASE_URL = "https://dist.apache.org/repos/dist/release/sling/"; + + static { + // register the http(s):// DAV repository factory used by all SVNKit operations below + DAVRepositoryFactory.setup(); + } + + private static final Logger LOGGER = LoggerFactory.getLogger(UpdateDistCommand.class); + + @CommandLine.Option( + names = {"-r", "--repository"}, + description = "Nexus staging repository id", + required = true) + private Integer repositoryId; + + @CommandLine.Option( + names = {"--previous-version"}, + description = "Previous release version to remove from dist/release (e.g. 1.0.0)." + + " Optional: if omitted, all older versions currently in dist/release are removed.") + private String previousVersion; + + @CommandLine.Mixin + private ReusableCLIOptions reusableCLIOptions; + + @Reference + private RepositoryService repositoryService; + + @Reference + private CredentialsService credentialsService; + + @Override + public Integer call() { + try { + LocalRepository localRepository = repositoryService.download(repositoryService.find(repositoryId)); Review Comment: I think there is another problem here. I did a dry run for release 3111 and it's missing the sha512 signature for the source release, see below: ``` Would publish 20 file(s) to dist/release for org.apache.sling.feature.analyser 2.0.18: put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-javadoc.jar -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-javadoc.jar put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-javadoc.jar.asc -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-javadoc.jar.asc put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-javadoc.jar.md5 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-javadoc.jar.md5 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-javadoc.jar.sha1 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-javadoc.jar.sha1 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-source-release.zip -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-source-release.zip put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-source-release.zip.asc -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-source-release.zip.asc put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-source-release.zip.md5 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-source-release.zip.md5 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-source-release.zip.sha1 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-source-release.zip.sha1 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-sources.jar -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-sources.jar put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-sources.jar.asc -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-sources.jar.asc put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-sources.jar.md5 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-sources.jar.md5 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-sources.jar.sha1 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18-sources.jar.sha1 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.jar -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.jar put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.jar.asc -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.jar.asc put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.jar.md5 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.jar.md5 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.jar.sha1 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.jar.sha1 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.pom -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.pom put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.pom.asc -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.pom.asc put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.pom.md5 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.pom.md5 put /tmp/orgapachesling-3111_12961447736977670827/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18.pom.sha1 -> https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.18.pom.sha1 Would remove 21 old file(s) from dist/release: rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.pom.md5 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-javadoc.jar rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-sources.jar.md5 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-source-release.zip rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-source-release.zip.sha512 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-sources.jar.sha1 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.pom.sha1 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.pom rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.jar.asc rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-sources.jar rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-javadoc.jar.asc rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-source-release.zip.asc rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.jar rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.pom.asc rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-javadoc.jar.sha1 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-source-release.zip.sha1 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.jar.md5 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16.jar.sha1 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-sources.jar.asc rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-javadoc.jar.md5 rm https://dist.apache.org/repos/dist/release/sling/org.apache.sling.feature.analyser-2.0.16-source-release.zip.md5 ``` It is adding 20, removing 21, and the missing one is `...-source-release.zip.sha512`. I downloaded the staging repository using our usual scripts and the file is there ``` $ find /tmp/sling-staging/3111 -name '*.sha512' /tmp/sling-staging/3111/org/apache/sling/org.apache.sling.feature.analyser/2.0.18/org.apache.sling.feature.analyser-2.0.18-source-release.zip.sha512 ``` Adding a screenshot because I will promote the staging repo and the data will be lost. <img width="1567" height="856" alt="Image" src="https://github.com/user-attachments/assets/6289cea3-2e02-4707-8eba-21e85f262dc9" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
