You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2021/05/15 03:53:16 UTC

[tomee-release-tools] branch master updated (adcddd3 -> 3134db0)

This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git.


    from adcddd3  Compare 8.0.0-M3 with 8.0.0
     new 76fb753  Reformat to be consistent with main tomee repo
     new bd6b85a  Command to download from Maven and commit to dist.apache.org
     new a545526  Command to move binaries dist.apache.org dev to dist.apache.org release
     new b7dec2e  Commands to list and remove old binaries from dist.apache.org
     new 3134db0  Update docs for list-releases

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            | 469 +++++++++++----------
 .../tools/release/{cmd/Roll.java => Loader.java}   |  26 +-
 ...JiraReport.java => CommandFailedException.java} |  13 +-
 .../org/apache/openejb/tools/release/cmd/Dist.java | 389 +++++++++++++++++
 ...l.java => UnexpectedHttpResponseException.java} |  18 +-
 .../services/org.tomitribe.crest.api.Loader        |   1 +
 6 files changed, 673 insertions(+), 243 deletions(-)
 copy src/main/java/org/apache/openejb/tools/release/{cmd/Roll.java => Loader.java} (68%)
 copy src/main/java/org/apache/openejb/tools/release/cmd/{JiraReport.java => CommandFailedException.java} (78%)
 create mode 100644 src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
 copy src/main/java/org/apache/openejb/tools/release/cmd/{Roll.java => UnexpectedHttpResponseException.java} (69%)
 create mode 100644 src/main/resources/META-INF/services/org.tomitribe.crest.api.Loader

[tomee-release-tools] 05/05: Update docs for list-releases

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git

commit 3134db0a70eac9b2e8cb47921b83e7182981c04d
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 14 20:52:53 2021 -0700

    Update docs for list-releases
---
 src/main/java/org/apache/openejb/tools/release/cmd/Dist.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
index 46c6773..ba36631 100644
--- a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
@@ -216,10 +216,7 @@ public class Dist {
     }
 
     /**
-     * Removes an older release from the mirror system. To view all existing releases simply execute `dist list-releases`
-     * If there are too many releases in our release directory, infra will ask us to remove the older binaries as they
-     * are available in archive.apache.org.  After executing `dist dev-to-release` it is a good idea to clean up any
-     * previous releases that are no longer necessary.
+     * Lists releases currently on the mirror system.
      *
      * @param releases  The specific location in dist.apache.org release where this project's binaries are promoted
      */

[tomee-release-tools] 02/05: Command to download from Maven and commit to dist.apache.org

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git

commit bd6b85ad2f5c898185c9353ee85582049cce2a5c
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 14 19:54:10 2021 -0700

    Command to download from Maven and commit to dist.apache.org
---
 pom.xml                                            |  59 +++-
 .../org/apache/openejb/tools/release/Loader.java   |  34 +++
 .../tools/release/cmd/CommandFailedException.java  |  26 ++
 .../org/apache/openejb/tools/release/cmd/Dist.java | 321 +++++++++++++++++++++
 .../cmd/UnexpectedHttpResponseException.java       |  30 ++
 .../services/org.tomitribe.crest.api.Loader        |   1 +
 6 files changed, 463 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3fb0e1a..ad30165 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,14 +48,13 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.2</version>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
-        <version>1.7.1</version>
+        <version>2.1</version>
         <executions>
           <execution>
             <phase>package</phase>
@@ -64,17 +63,46 @@
             </goals>
             <configuration>
               <shadedArtifactAttached>true</shadedArtifactAttached>
-              <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
               <transformers>
-                <transformer
-                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.apache.openejb.tools.release.Main</mainClass>
+                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                  <mainClass>org.tomitribe.crest.Main</mainClass>
                 </transformer>
               </transformers>
+              <filters>
+                <filter>
+                  <artifact>*:*</artifact>
+                  <excludes>
+                    <exclude>META-INF/*.SF</exclude>
+                    <exclude>META-INF/*.DSA</exclude>
+                    <exclude>META-INF/*.RSA</exclude>
+                    <exclude>META-INF/LICENSE</exclude>
+                    <exclude>LICENSE</exclude>
+                    <!--if this is same as above, not required-->
+                  </excludes>
+                </filter>
+              </filters>
             </configuration>
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.skife.maven</groupId>
+        <artifactId>really-executable-jar-maven-plugin</artifactId>
+        <version>1.4.0</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>really-executable-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <flags>-Dcmd="$0" $RELEASE_OPTS -Xmx1G</flags>
+          <programFile>release</programFile>
+          <attachProgramFile>true</attachProgramFile>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -251,6 +279,21 @@
       </exclusions>
     </dependency>
 
+    <dependency>
+      <groupId>org.tomitribe</groupId>
+      <artifactId>tomitribe-crest</artifactId>
+      <version>0.15</version>
+    </dependency>
+    <dependency>
+      <groupId>org.tomitribe</groupId>
+      <artifactId>swizzle</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.tomitribe</groupId>
+      <artifactId>tomitribe-util</artifactId>
+      <version>1.3.18</version>
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/src/main/java/org/apache/openejb/tools/release/Loader.java b/src/main/java/org/apache/openejb/tools/release/Loader.java
new file mode 100644
index 0000000..cc2c107
--- /dev/null
+++ b/src/main/java/org/apache/openejb/tools/release/Loader.java
@@ -0,0 +1,34 @@
+/*
+ * 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.openejb.tools.release;
+
+
+import org.apache.openejb.tools.release.cmd.Dist;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+public class Loader implements org.tomitribe.crest.api.Loader {
+
+    @Override
+    public Iterator<Class<?>> iterator() {
+        return Arrays.asList(
+                Dist.class,
+                Object.class
+        ).iterator();
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/CommandFailedException.java b/src/main/java/org/apache/openejb/tools/release/cmd/CommandFailedException.java
new file mode 100644
index 0000000..cb1405b
--- /dev/null
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/CommandFailedException.java
@@ -0,0 +1,26 @@
+/*
+ * 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.openejb.tools.release.cmd;
+
+import org.tomitribe.crest.api.Exit;
+
+@Exit(1)
+public class CommandFailedException extends RuntimeException {
+    public CommandFailedException(final String message) {
+        super(message);
+    }
+}
diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
new file mode 100644
index 0000000..b28344c
--- /dev/null
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
@@ -0,0 +1,321 @@
+/*
+ * 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.openejb.tools.release.cmd;
+
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.tomitribe.crest.api.Command;
+import org.tomitribe.crest.api.Default;
+import org.tomitribe.crest.api.Option;
+import org.tomitribe.crest.api.Out;
+import org.tomitribe.swizzle.stream.StreamBuilder;
+import org.tomitribe.util.Files;
+import org.tomitribe.util.Hex;
+import org.tomitribe.util.IO;
+import org.tomitribe.util.dir.Dir;
+import org.tomitribe.util.dir.Filter;
+import org.tomitribe.util.dir.Walk;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.UncheckedIOException;
+import java.net.URI;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static java.lang.String.format;
+import static org.apache.openejb.tools.release.util.Exec.exec;
+
+@Command
+public class Dist {
+
+    /**
+     * Download binaries from a maven repo and commit them to dist.apache.org dev
+     *
+     * The org/apache/tomee/apache-tomee and org/apache/tomee/tomee-project sections
+     * of the maven repository will be scanned for the version specified and all zip
+     * and tar.gz files will be downloaded along with any associated asc and sha1 files.
+     * After download the sha1 files of each binary will be checked to ensure a complete
+     * download.  The sha256 and sha512 file for each binary will be computed and written
+     * to disk.
+     *
+     * If the --dry-run flag is not enabled, the resulting zip, tar.gz, asc, sha256 and
+     * sha512 files will be uploaded to a directory in dist.apache.org dev or the specified
+     * svn repo.
+     *
+     * When ready, the dist.apache.org dev directory can be moved to dist.apache.org release
+     * via the `dist dev-to-release` command.
+     *
+     * @param version The TomEE version being published.  Example: 8.0.7
+     * @param tmp The directory under which files can be temporarily downloaded
+     * @param mavenRepoUri  The root path of a Nexus staging repository or Maven Central
+     * @param svnRepo The svn directory for tomee where a subdirectory can be created and binaries uploaded
+     * @param dryRun Download the files to local disk, but do not commit them to svn
+     */
+    @Command("maven-to-dev")
+    public void mavenToDev(final String version,
+                           @Option("tmp") @Default("/tmp/") final File tmp,
+                           @Option("maven-repo") @Default("https://repo1.maven.org/maven2/") final URI mavenRepoUri,
+                           @Option("svn-repo") @Default("https://dist.apache.org/repos/dist/dev/tomee/") final URI svnRepo,
+                           @Option("dry-run") @Default("false") final boolean dryRun,
+                           final @Out PrintStream out) throws IOException {
+
+
+        final String build = buildId(mavenRepoUri);
+        final String tomeeVersionName = "tomee-" + version;
+        final String svnBinaryLocation = format("https://dist.apache.org/repos/dist/dev/tomee/staging-%s/%s", build, tomeeVersionName);
+
+        final File dir = new File(tmp, "tomee-" + version + "-work");
+
+        { // Make and checkout the binaries dir in svn
+            if (!dir.exists()) {
+                Files.mkdirs(dir);
+            }
+
+            if (!dryRun) {
+                exec("svn", "-m", format("[release-tools] staged binary dir for %s", tomeeVersionName), "mkdir", "--parents", svnBinaryLocation);
+                exec("svn", "co", svnBinaryLocation, dir.getAbsolutePath());
+            }
+        }
+
+
+        final MavenRepo repo = new MavenRepo(mavenRepoUri, out);
+
+        final List<URI> binaries = new ArrayList<>();
+        binaries.addAll(repo.binaries("org/apache/tomee/apache-tomee/", version));
+        binaries.addAll(repo.binaries("org/apache/tomee/tomee-project/", version));
+
+        binaries.forEach(repo.downloadTo(dir));
+        out.printf("Downloaded %s binaries to %s%n", binaries.size(), dir.getAbsolutePath());
+
+        final Work work = Dir.of(Work.class, dir);
+
+        final List<Binary> invalid = work.binaries()
+                .filter(((Predicate<Binary>) Binary::verifySha1).negate())
+                .collect(Collectors.toList());
+
+        if (invalid.size() != 0) {
+            invalid.forEach(binary -> out.printf("SHA1 check failed %s%n", binary.get().getAbsolutePath()));
+            throw new CommandFailedException("Remove the invalid files and try again");
+        }
+
+        work.binaries()
+                .peek(Binary::createSha256)
+                .peek(Binary::createSha512)
+                .forEach(binary -> out.println("Hashed " + binary.get().getName()));
+
+        if (!dryRun) {
+
+            Consumer<File> svnAdd = file -> exec("svn", "add", file.getAbsolutePath());
+
+            work.binaries()
+                    .peek(binary -> svnAdd.accept(binary.get()))
+                    .peek(binary -> svnAdd.accept(binary.asc()))
+                    .peek(binary -> svnAdd.accept(binary.sha256()))
+                    .peek(binary -> svnAdd.accept(binary.sha512()))
+                    .forEach(binary -> out.println("Added " + binary.get().getName()));
+
+            exec("svn", "-m", format("[release-tools] staged binaries for %s", tomeeVersionName), "ci", dir.getAbsolutePath());
+
+            out.printf("Binaries published to %s%n", svnBinaryLocation);
+        }
+    }
+
+    /**
+     * Return the last digits of a Nexus staging repo dir such as orgapachetomee-1136 or
+     * return the month and day as a default.
+     */
+    private String buildId(final URI stagingRepoUri) {
+        final String id = stagingRepoUri.getPath().replaceAll(".*-([0-9]+)/?$", "$1");
+        if (id.matches("^[0-9]+$")) {
+            return id;
+        }
+
+        final SimpleDateFormat format = new SimpleDateFormat("MMdd");
+        return format.format(new Date());
+    }
+
+    @Command("dev-to-release")
+    public void release(final String version,
+                        @Option("dev-repo") @Default("https://repo1.maven.org/maven2/") final URI mavenRepo,
+                        @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI svnRepo,
+                        final @Out PrintStream out) throws IOException {
+
+    }
+
+    public static class MavenRepo {
+        private final CloseableHttpClient client = HttpClientBuilder.create().build();
+        private final URI repo;
+        private final PrintStream out;
+
+        public MavenRepo(final URI repo, final PrintStream out) {
+            this.repo = repo;
+            this.out = out;
+        }
+
+        public List<URI> binaries(final String artifactPath, final String version) throws IOException {
+            final URI artifactDir = this.repo.resolve(artifactPath);
+
+            final URI versionDir = artifactDir.resolve(version + "/");
+            final CloseableHttpResponse response = get(versionDir);
+
+            final List<String> hrefs = new ArrayList<>();
+            StreamBuilder.create(response.getEntity().getContent())
+                    .watch("<a href=\"", "\"", hrefs::add)
+                    .run();
+
+            final Predicate<String> acceptedExtensions = Pattern.compile("\\.(zip|tar\\.gz)(\\.(asc|sha1))?$").asPredicate();
+            return hrefs.stream()
+                    .filter(acceptedExtensions)
+                    .map(versionDir::resolve)
+                    .collect(Collectors.toList());
+        }
+
+        private CloseableHttpResponse get(final URI uri) throws IOException {
+            final CloseableHttpResponse response = client.execute(new HttpGet(uri));
+            if (response.getStatusLine().getStatusCode() != 200) {
+                EntityUtils.consume(response.getEntity());
+                throw new UnexpectedHttpResponseException("GET", uri, response.getStatusLine());
+            }
+            return response;
+        }
+
+        public Consumer<URI> downloadTo(final File directory) {
+            return downloadTo(directory, false);
+        }
+
+        public Consumer<URI> downloadTo(final File directory, final boolean overwrite) {
+            return uri -> {
+                try {
+                    final String name = uri.getPath().replaceAll(".*/", "");
+                    final File file = new File(directory, name);
+
+                    if (file.exists() && !overwrite) {
+                        out.println("Downloaded " + uri);
+                    } else {
+                        out.println("Downloading " + uri);
+                        final CloseableHttpResponse response = get(uri);
+                        IO.copy(response.getEntity().getContent(), file);
+                    }
+                } catch (IOException e) {
+                    throw new UncheckedIOException(e);
+                }
+            };
+        }
+    }
+
+    public interface Work extends Dir {
+        @Walk(maxDepth = 1)
+        @Filter(Binary.Format.class)
+        Stream<Binary> binaries();
+    }
+
+    public interface Binary extends Dir {
+
+        default boolean verifySha1() {
+            final String expectedSha1 = slurp(sha1());
+            final String actualSha1 = hash("SHA-1");
+            return expectedSha1.equals(actualSha1);
+        }
+
+        default void createSha256() {
+            final String sha256 = hash("SHA-256");
+            write(sha256, sha256());
+        }
+
+        default void createSha512() {
+            final String sha256 = hash("SHA-512");
+            write(sha256, sha512());
+        }
+
+        default File asc() {
+            return get(get(), "asc");
+        }
+
+        default File sha1() {
+            return get(get(), "sha1");
+        }
+
+        default File sha256() {
+            return get(get(), "sha256");
+        }
+
+        default File sha512() {
+            return get(get(), "sha512");
+        }
+
+        static void write(String content, File file) {
+            try {
+                IO.copy(IO.read(content), file);
+            } catch (IOException e) {
+                throw new UncheckedIOException("Unable to write to file " + file.getAbsolutePath(), e);
+            }
+        }
+
+        default File get(final File file, final String ext) {
+            return new File(file.getParentFile(), file.getName() + "." + ext);
+        }
+
+        default String hash(final String type) {
+            try {
+                final MessageDigest digest = MessageDigest.getInstance(type);
+                try (final InputStream inputStream = IO.read(get())) {
+                    final DigestInputStream digestInputStream = new DigestInputStream(inputStream, digest);
+                    IO.copy(digestInputStream, IO.IGNORE_OUTPUT);
+                    return Hex.toString(digest.digest());
+                }
+            } catch (NoSuchAlgorithmException e) {
+                throw new IllegalStateException("Unknown algorithm " + type, e);
+            } catch (IOException e) {
+                throw new UncheckedIOException(e);
+            }
+        }
+
+        static String slurp(final File file) {
+            try {
+                return IO.slurp(file);
+            } catch (IOException e) {
+                throw new UncheckedIOException("Cannot read file " + file.getAbsolutePath(), e);
+            }
+        }
+
+        class Format implements FileFilter {
+            @Override
+            public boolean accept(final File file) {
+                final String name = file.getName();
+                return name.endsWith(".zip") || name.endsWith(".tar.gz");
+            }
+        }
+    }
+
+}
diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/UnexpectedHttpResponseException.java b/src/main/java/org/apache/openejb/tools/release/cmd/UnexpectedHttpResponseException.java
new file mode 100644
index 0000000..5bc1091
--- /dev/null
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/UnexpectedHttpResponseException.java
@@ -0,0 +1,30 @@
+/*
+ * 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.openejb.tools.release.cmd;
+
+import org.apache.http.StatusLine;
+import org.tomitribe.crest.api.Exit;
+
+import java.net.URI;
+
+@Exit(500)
+public class UnexpectedHttpResponseException extends RuntimeException {
+
+    public UnexpectedHttpResponseException(final String method, final URI uri, final StatusLine statusLine) {
+        super(String.format("%s %s returned unexpected response %s", method, uri, statusLine));
+    }
+}
diff --git a/src/main/resources/META-INF/services/org.tomitribe.crest.api.Loader b/src/main/resources/META-INF/services/org.tomitribe.crest.api.Loader
new file mode 100644
index 0000000..f0af220
--- /dev/null
+++ b/src/main/resources/META-INF/services/org.tomitribe.crest.api.Loader
@@ -0,0 +1 @@
+org.apache.openejb.tools.release.Loader
\ No newline at end of file

[tomee-release-tools] 03/05: Command to move binaries dist.apache.org dev to dist.apache.org release

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git

commit a545526c8e62a7d99471f028999dfd3657ed5cdd
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 14 20:40:38 2021 -0700

    Command to move binaries dist.apache.org dev to dist.apache.org release
---
 .../org/apache/openejb/tools/release/cmd/Dist.java | 52 ++++++++++++++++++----
 1 file changed, 44 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
index b28344c..760398b 100644
--- a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
@@ -55,6 +55,7 @@ import java.util.stream.Stream;
 
 import static java.lang.String.format;
 import static org.apache.openejb.tools.release.util.Exec.exec;
+import static org.apache.openejb.tools.release.util.Exec.read;
 
 @Command
 public class Dist {
@@ -152,6 +153,49 @@ public class Dist {
     }
 
     /**
+     * Move binaries dist.apache.org dev to dist.apache.org release
+     *
+     * Looks for directories under the specified stagedDir in dist.apache.org dev section and moves each into the mirror
+     * system under dist.apache.org release section.  For example, given the following staged directory in svn:
+     *
+     *     svn list https://dist.apache.org/repos/dist/dev/tomee/staging-1179/
+     *     tomee-8.0.7/
+     *     tomee-9.0.0.-M7/
+     *
+     * The command below would move the "tomee-8.0.7" and "tomee-9.0.0.-M7" into dist.apache.org/repos/dist/release/tomee/
+     * where they will become available on the Apache mirror system within 24 hours.  Please note that it does take some
+     * time for things to propagate, so any updates to the download page should not be done till about 24 hours after this
+     * command is run.
+     * 
+     * @param stagingDir  The name of the staging directory to release.  Example: staging-1179
+     * @param dev  The specific location in dist.apache.org dev where this project's binaries are staged
+     * @param release  The specific location in dist.apache.org release where this project's binaries are promoted
+     */
+    @Command("dev-to-release")
+    public void release(final String stagingDir,
+                        @Option("dev-repo") @Default("https://dist.apache.org/repos/dist/dev/tomee/") final URI dev,
+                        @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI release,
+                        final @Out PrintStream out) throws IOException {
+
+        final URI stagingUri = dev.resolve(stagingDir + "/");
+        final String contents = IO.slurp(read("svn", "list", stagingUri.toASCIIString()));
+        final String[] dirs = contents.split("[\n /]+");
+
+        for (final String dir : dirs) {
+            final URI dirUri = stagingUri.resolve(dir);
+            out.printf("Promoting %s/%s%n", stagingDir, dir);
+            exec("svn", "-m", format("[release-tools] promote staged binaries for %s", dir), "mv", dirUri.toASCIIString(), release.toASCIIString());
+        }
+
+        out.printf("Removing %s%n", stagingUri);
+        exec("svn", "-m", format("[release-tools] remove staged directory %s", stagingDir), "rm", stagingUri.toASCIIString());
+
+        out.printf("Listing %s%n", release);
+        exec("svn", "list", release.toASCIIString());
+    }
+
+
+    /**
      * Return the last digits of a Nexus staging repo dir such as orgapachetomee-1136 or
      * return the month and day as a default.
      */
@@ -165,14 +209,6 @@ public class Dist {
         return format.format(new Date());
     }
 
-    @Command("dev-to-release")
-    public void release(final String version,
-                        @Option("dev-repo") @Default("https://repo1.maven.org/maven2/") final URI mavenRepo,
-                        @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI svnRepo,
-                        final @Out PrintStream out) throws IOException {
-
-    }
-
     public static class MavenRepo {
         private final CloseableHttpClient client = HttpClientBuilder.create().build();
         private final URI repo;

[tomee-release-tools] 04/05: Commands to list and remove old binaries from dist.apache.org

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git

commit b7dec2ecf27664603f5345659dae24342f41d44a
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 14 20:51:54 2021 -0700

    Commands to list and remove old binaries from dist.apache.org
---
 .../org/apache/openejb/tools/release/cmd/Dist.java | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
index 760398b..46c6773 100644
--- a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
@@ -166,6 +166,9 @@ public class Dist {
      * where they will become available on the Apache mirror system within 24 hours.  Please note that it does take some
      * time for things to propagate, so any updates to the download page should not be done till about 24 hours after this
      * command is run.
+     *
+     * Once this command is run it is a good idea to use `dist remove-release` to remove any older releases from the mirror
+     * system that we no longer need.
      * 
      * @param stagingDir  The name of the staging directory to release.  Example: staging-1179
      * @param dev  The specific location in dist.apache.org dev where this project's binaries are staged
@@ -194,6 +197,38 @@ public class Dist {
         exec("svn", "list", release.toASCIIString());
     }
 
+    /**
+     * Removes an older release from the mirror system. To view all existing releases simply execute `dist list-releases`
+     * If there are too many releases in our release directory, infra will ask us to remove the older binaries as they
+     * are available in archive.apache.org.  After executing `dist dev-to-release` it is a good idea to clean up any
+     * previous releases that are no longer necessary.
+     * 
+     * @param releaseDirectory The release directory to remove from the mirror system.  Example: tomee-9.0.0-M3
+     * @param releases  The specific location in dist.apache.org release where this project's binaries are promoted
+     */
+    @Command("remove-release")
+    public void removeRelease(final String releaseDirectory,
+                        @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI releases,
+                        final @Out PrintStream out) throws IOException {
+
+        final URI releaseUri = releases.resolve(releaseDirectory);
+        exec("svn", "-m", format("[release-tools] remove release %s", releaseDirectory), "rm", releaseUri.toASCIIString());
+    }
+
+    /**
+     * Removes an older release from the mirror system. To view all existing releases simply execute `dist list-releases`
+     * If there are too many releases in our release directory, infra will ask us to remove the older binaries as they
+     * are available in archive.apache.org.  After executing `dist dev-to-release` it is a good idea to clean up any
+     * previous releases that are no longer necessary.
+     *
+     * @param releases  The specific location in dist.apache.org release where this project's binaries are promoted
+     */
+    @Command("list-releases")
+    public void listReleases(@Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI releases,
+                             final @Out PrintStream out) throws IOException {
+
+        exec("svn", "list", releases.toASCIIString());
+    }
 
     /**
      * Return the last digits of a Nexus staging repo dir such as orgapachetomee-1136 or

[tomee-release-tools] 01/05: Reformat to be consistent with main tomee repo

Posted by db...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git

commit 76fb7534141c52223c818f07fb798bbfd44be560
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 14 12:02:28 2021 -0700

    Reformat to be consistent with main tomee repo
---
 pom.xml | 426 ++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 213 insertions(+), 213 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5f56705..3fb0e1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,237 +21,237 @@
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+  <modelVersion>4.0.0</modelVersion>
 
-    <parent>
-        <groupId>org.apache</groupId>
-        <artifactId>apache</artifactId>
-        <version>17</version>
-    </parent>
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>17</version>
+  </parent>
 
-    <groupId>org.apache.openejb.tools</groupId>
-    <artifactId>release-tools</artifactId>
-    <packaging>jar</packaging>
-    <version>1.0-SNAPSHOT</version>
-    <name>Release Tools</name>
+  <groupId>org.apache.openejb.tools</groupId>
+  <artifactId>release-tools</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>Release Tools</name>
 
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <slf4j-version>1.7.7</slf4j-version>
-    </properties>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <slf4j-version>1.7.7</slf4j-version>
+  </properties>
 
-    <build>
-        <defaultGoal>install</defaultGoal>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.2</version>
-                <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-shade-plugin</artifactId>
-                <version>1.7.1</version>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                        <configuration>
-                            <shadedArtifactAttached>true</shadedArtifactAttached>
-                            <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
-                            <transformers>
-                                <transformer
-                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                                    <mainClass>org.apache.openejb.tools.release.Main</mainClass>
-                                </transformer>
-                            </transformers>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.2</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>1.7.1</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+            <configuration>
+              <shadedArtifactAttached>true</shadedArtifactAttached>
+              <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
+              <transformers>
+                <transformer
+                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                  <mainClass>org.apache.openejb.tools.release.Main</mainClass>
+                </transformer>
+              </transformers>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-simple</artifactId>
-            <version>${slf4j-version}</version>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>${slf4j-version}</version>
-            <scope>compile</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <version>${slf4j-version}</version>
-            <scope>compile</scope>
-        </dependency>
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <version>${slf4j-version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j-version}</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <version>${slf4j-version}</version>
+      <scope>compile</scope>
+    </dependency>
 
-        <dependency>
-            <groupId>org.codehaus.swizzle</groupId>
-            <artifactId>swizzle-stream</artifactId>
-            <version>1.6.2</version>
-        </dependency>
+    <dependency>
+      <groupId>org.codehaus.swizzle</groupId>
+      <artifactId>swizzle-stream</artifactId>
+      <version>1.6.2</version>
+    </dependency>
 
-        <dependency>
-            <groupId>org.codehaus.swizzle</groupId>
-            <artifactId>swizzle-jirareport</artifactId>
-            <version>1.6.2</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>velocity</groupId>
-                    <artifactId>velocity</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>commons-collections</groupId>
-                    <artifactId>commons-collections</artifactId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>xml-apis</artifactId>
-                    <groupId>xml-apis</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>log4j</artifactId>
-                    <groupId>log4j</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+    <dependency>
+      <groupId>org.codehaus.swizzle</groupId>
+      <artifactId>swizzle-jirareport</artifactId>
+      <version>1.6.2</version>
+      <exclusions>
+        <exclusion>
+          <groupId>velocity</groupId>
+          <artifactId>velocity</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-collections</groupId>
+          <artifactId>commons-collections</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>xml-apis</artifactId>
+          <groupId>xml-apis</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>log4j</artifactId>
+          <groupId>log4j</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.creadur.tentacles</groupId>
-            <artifactId>apache-tentacles</artifactId>
-            <version>0.1-SNAPSHOT</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>plexus-utils</artifactId>
-                    <groupId>org.codehaus.plexus</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>httpclient</artifactId>
-                    <groupId>org.apache.httpcomponents</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>commons-io</artifactId>
-                    <groupId>commons-io</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>commons-lang</artifactId>
-                    <groupId>commons-lang</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>velocity</artifactId>
-                    <groupId>org.apache.velocity</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>apache-rat-plugin</artifactId>
-                    <groupId>org.apache.rat</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>swizzle-stream</artifactId>
-                    <groupId>org.codehaus.swizzle</groupId>
-                </exclusion>
-                <exclusion>
-                    <artifactId>log4j</artifactId>
-                    <groupId>log4j</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.creadur.tentacles</groupId>
+      <artifactId>apache-tentacles</artifactId>
+      <version>0.1-SNAPSHOT</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>plexus-utils</artifactId>
+          <groupId>org.codehaus.plexus</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>httpclient</artifactId>
+          <groupId>org.apache.httpcomponents</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>commons-io</artifactId>
+          <groupId>commons-io</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>commons-lang</artifactId>
+          <groupId>commons-lang</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>velocity</artifactId>
+          <groupId>org.apache.velocity</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>apache-rat-plugin</artifactId>
+          <groupId>org.apache.rat</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>swizzle-stream</artifactId>
+          <groupId>org.codehaus.swizzle</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>log4j</artifactId>
+          <groupId>log4j</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.17</version>
-        </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.17</version>
+    </dependency>
 
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.6</version>
-        </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.6</version>
+    </dependency>
 
-        <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-utils</artifactId>
-            <version>2.0.7</version>
-        </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>2.0.7</version>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.xbean</groupId>
-            <artifactId>xbean-finder</artifactId>
-            <version>3.11</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>slf4j-api</artifactId>
-                    <groupId>org.slf4j</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.xbean</groupId>
+      <artifactId>xbean-finder</artifactId>
+      <version>3.11</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>slf4j-api</artifactId>
+          <groupId>org.slf4j</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>2.0.1</version>
-        </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.0.1</version>
+    </dependency>
 
-        <dependency>
-            <groupId>asm</groupId>
-            <artifactId>asm</artifactId>
-            <version>3.2</version>
-        </dependency>
-        <dependency>
-            <groupId>asm</groupId>
-            <artifactId>asm-commons</artifactId>
-            <version>3.2</version>
-        </dependency>
+    <dependency>
+      <groupId>asm</groupId>
+      <artifactId>asm</artifactId>
+      <version>3.2</version>
+    </dependency>
+    <dependency>
+      <groupId>asm</groupId>
+      <artifactId>asm-commons</artifactId>
+      <version>3.2</version>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>4.3.5</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>commons-logging</artifactId>
-                    <groupId>commons-logging</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>4.3.5</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>commons-logging</artifactId>
+          <groupId>commons-logging</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.velocity</groupId>
-            <artifactId>velocity</artifactId>
-            <version>1.7</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>commons-lang</artifactId>
-                    <groupId>commons-lang</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.7</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>commons-lang</artifactId>
+          <groupId>commons-lang</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-settings</artifactId>
-            <version>3.0.5</version>
-            <exclusions>
-                <exclusion>
-                    <artifactId>plexus-utils</artifactId>
-                    <groupId>org.codehaus.plexus</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-settings</artifactId>
+      <version>3.0.5</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>plexus-utils</artifactId>
+          <groupId>org.codehaus.plexus</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
 
-    </dependencies>
+  </dependencies>
 
 </project>