You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2018/11/16 18:52:56 UTC

[archiva-redback-site] branch feature/site-git-migration created (now 91f3ec9)

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

martin_s pushed a change to branch feature/site-git-migration
in repository https://gitbox.apache.org/repos/asf/archiva-redback-site.git.


      at 91f3ec9  Adding redback site publish to git

This branch includes the following new commits:

     new 91f3ec9  Adding redback site publish to git

The 1 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.



[archiva-redback-site] 01/01: Adding redback site publish to git

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

martin_s pushed a commit to branch feature/site-git-migration
in repository https://gitbox.apache.org/repos/asf/archiva-redback-site.git

commit 91f3ec9ebede998279354d83e467e136b69d6521
Author: Martin Stockhammer <ma...@apache.org>
AuthorDate: Fri Nov 16 19:49:43 2018 +0100

    Adding redback site publish to git
---
 .gitignore                  |   1 +
 README.adoc                 |  91 +++++++++++++++++++++++++++++
 checkoutSite.sh             | 135 ++++++++++++++++++++++++++++++++++++++++++++
 deploySite.sh               |  65 +++++++++++++++++++++
 git-sparse-checkout-pattern |   2 +
 pom.xml                     |  84 ++++++++++++++-------------
 src/site/site.xml           |  16 +++---
 7 files changed, 344 insertions(+), 50 deletions(-)

diff --git a/.gitignore b/.gitignore
index b40b862..9df6607 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.iml
 target
 .DS_Store
+site-content
diff --git a/README.adoc b/README.adoc
new file mode 100644
index 0000000..d375a4d
--- /dev/null
+++ b/README.adoc
@@ -0,0 +1,91 @@
+Archiva Redback Site Source Repository
+======================================
+:toc:
+
+This project contains the sources for the redback archiva site at https://archiva.apache.org/redback/
+
+You can build the web content and publish it to the content repository archiva-web-content.git.
+
+
+== How to build and publish the pages for the archiva web content
+
+
+The web content parts of this module are published to the path 
+
+  /redback/
+
+=== Use the script
+
+There is a shell script +deploySite.sh+ which you can run to generate the site check and publish to 
+the remote repository. It works only on Linux, on other platforms you have to go the next section.
+
+The script is interactive, it asks you to confirm the publish after generation of the staging part.
+
+.Execute
+
+  ./deploySite.sh 
+
+All arguments are appended to the mvn calls.
+
+=== Run the steps manually
+
+==== Checkout the site-content directory
+
+ git clone <PATH TO archiva-web-content.git> site-content --no-checkout
+ git -C site-content config core.sparsecheckout true
+ git -C site-content config user.name <YOUR NAME>
+ git -C site-content config user.email <YOUR MAILADDRESS>
+
+Copy the +git-sparse-checkout-pattern+ file to +site-content/.git/info/sparse-checkout+
+
+ git -C site-content checkout --
+
+==== Building the pages
+
+You need enough free disk space to publish the web content. The archiva web site repository is big, 
+but the maven build will only checkout the necessary directories for this build (sparse checkout).
+
+For all the commands you have to change to this repository directory:
+
+  cd redback-site
+
+.The following creates the site and copies the files to the staging folder
+
+  mvn clean site site:stage
+
+The result can be checked in 
+
+  redback-site/target/staging/
+
+with your browser.
+
+If you would like the use a local checkout of the archiva-web-content.git repository and not push directly
+to the remote repository, you may add this parameter:
+
+  -DsiteRepositoryUrl=scm:git:file:///${path-to-your-local-archiva}/archiva-web-content.git
+
+where +${path-to-your-local-archiva}+ is the path where a bare clone of the archiva-web-content.git is stored.
+
+==== Publish the pages
+
+.This command publishes to the git repository
+
+  mvn scm-publish:publish-scm
+
+After publishing to the git repository the gitpubsub mechanism is transferring it to the HTTP server.
+
+If you would like the use a local checkout of the archiva-web-content.git repository and not push directly
+to the remote repository, you may add this parameter:
+
+  -DsiteRepositoryUrl=scm:git:file:///${path-to-your-local-archiva}/archiva-web-content.git
+
+
+=== Some notes about the build process
+
+A sparse checkout of the git repository will be created in 
+
+ site-content
+
+but only, if the directory +site-content/.git+ does not exist. 
+
+
diff --git a/checkoutSite.sh b/checkoutSite.sh
new file mode 100755
index 0000000..5e582bd
--- /dev/null
+++ b/checkoutSite.sh
@@ -0,0 +1,135 @@
+#!/bin/bash
+#
+#  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.
+#
+#  Author: Martin Stockhammer <ma...@apache.org>
+#  Date:   2018-11-03
+#
+# This script runs a sparse git clone of a remote repository and
+# initializes the git configuration.
+#
+# It is mainly used for site content creation, because the main archiva-web-content repository
+# is rather large and we don't want to checkout the complete data.
+#
+
+SITE_DIR=".site-content"
+GIT_REMOTE=""
+
+GIT_USER=$(git config user.name)
+GIT_EMAIL=$(git config user.email)
+
+GIT_PATTERN_FILE="git-sparse-checkout-pattern"
+GIT_PATTERN_DEST=".git/info/sparse-checkout"
+
+MY_PWD=$(pwd)
+
+CLONE=1
+FORCE=1
+MODULE_DIR="${MY_PWD}"
+PATTERN=""
+while [ ! -z "$1" ]; do
+  case "$1" in
+    -f) 
+      FORCE=0
+      shift
+      ;;
+    -d)
+      shift
+      SITE_DIR="$1"
+      shift
+      ;;
+    -p)
+      shift
+      if [ -z "${PATTERN}" ]; then
+        PATTERN="${1}"
+      else
+        PATTERN="${PATTERN}\n${1}"
+      fi
+      shift
+      ;;
+    -m)
+      shift
+      MODULE_DIR="$1"
+      shift
+      ;;
+    *)
+      GIT_REMOTE="$1"
+      shift
+      ;; 
+  esac
+done
+
+print_usage() {
+  echo "checkoutRepo [-m MODULE_DIR] [-d SITE_DIR]  [-f] GIT_URL"
+  echo " -m: The module directory where the pattern file can be found and the site dir will be created."
+  echo " -d SITE_DIR: Use the given directory for checkout"
+  echo " -f: Force clone, even if directory exists"
+}
+
+if [ ! -f "${MODULE_DIR}/pom.xml" ]; then
+  echo "Looks like the working directory is not a valid dir. No pom.xml found."
+  exit 1
+fi
+
+cd "${MODULE_DIR}" || { echo "Could not change to module directory ${MODULE_DIR}"; exit 1; }
+
+if [ -z "$GIT_REMOTE" ]; then
+  print_usage
+  exit 1
+fi
+
+if [ "${GIT_REMOTE:0:8}" == "scm:git:" ]; then
+  GIT_REMOTE="${GIT_REMOTE:8}"
+fi
+
+
+if [ -d "${SITE_DIR}" ]; then
+  if [ ! -d "${SITE_DIR}/.git" ]; then
+    echo "Directory ${SITE_DIR} exist already, but is not a git clone. Aborting."
+    exit 1
+  elif [ "$FORCE" -eq 0 ]; then
+    CLONE=0
+  fi
+else
+  CLONE=0
+fi
+
+if [ $CLONE -eq 0 ]; then
+  git clone "${GIT_REMOTE}" "${SITE_DIR}" --no-checkout
+  if [ $? -ne 0 ]; then
+    echo "Git clone failed"
+    exit 1
+  fi
+fi
+
+cd "${SITE_DIR}" || { echo "Could not change to site dir ${SITE_DIR}"; exit 1; }
+
+git config core.sparsecheckout true
+git config user.name "${GIT_USER}"
+git config user.email "${GIT_EMAIL}"
+
+if [ ! -z "${PATTERN}" ]; then
+    echo -e "${PATTERN}" >"${GIT_PATTERN_DEST}"
+elif [ -f "../${GIT_PATTERN_FILE}" ]; then
+  cp "../${GIT_PATTERN_FILE}" "${GIT_PATTERN_DEST}"
+fi
+
+git checkout --
+
+cd "${MY_PWD}"
+
diff --git a/deploySite.sh b/deploySite.sh
new file mode 100755
index 0000000..b8307c6
--- /dev/null
+++ b/deploySite.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+#
+#  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.
+#
+#  Author: Martin Stockhammer <ma...@apache.org>
+#  Date:   2018-11-15
+#
+#  Publishes the site content and generated reports to the web content repository.
+#  It stops after the staging and let you check the content before pushing to the repository
+#
+
+THIS_DIR=$(dirname $0)
+THIS_DIR=$(readlink -f ${THIS_DIR})
+CONTENT_DIR="site-content"
+
+SUB_DIR="redback"
+
+if [ -d "${CONTENT_DIR}/.git" ]; then
+  git -C "${CONTENT_DIR}" fetch origin
+  git -C "${CONTENT_DIR}" reset --hard origin/master
+fi
+
+echo ">>>> Creating site and reports <<<<" 
+mvn clean site site:stage "$@"
+
+if [ $? -ne 0 ]; then
+  echo ">>>> Error occurred. Stopping now. <<<<"
+  exit 1
+fi
+
+echo "*****************************************"
+echo ">>>> Finished the site stage process <<<<"
+echo "> You can check the content in the folder target/staging or by opening the following url"
+echo "> file://${THIS_DIR}/target/staging/${SUB_DIR}/index.html"
+echo "> "
+echo "> If everything is fine enter yes. After that the publish process will be started."
+echo -n "Do you want to publish (yes/no)? "
+read ANSWER
+
+if [ "${ANSWER}" == "yes" -o "${ANSWER}" == "YES" ]; then
+  echo "> Starting publish process"
+  mvn scm-publish:publish-scm "$@"
+else
+  echo "> Aborting now"
+  echo "> Running git reset in ${CONTENT_DIR} directory"
+  git -C "${CONTENT_DIR}" fetch origin
+  git -C "${CONTENT_DIR}" reset --hard origin/master
+  echo ">>>> Finished <<<<"
+fi
+
diff --git a/git-sparse-checkout-pattern b/git-sparse-checkout-pattern
new file mode 100644
index 0000000..22f20b8
--- /dev/null
+++ b/git-sparse-checkout-pattern
@@ -0,0 +1,2 @@
+/redback
+!/redback/components
diff --git a/pom.xml b/pom.xml
index 8ff1de4..5bf14dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,8 +22,7 @@
   <parent>
     <groupId>org.apache.archiva</groupId>
     <artifactId>archiva-parent</artifactId>
-    <version>18</version>
-    <relativePath>../parent/pom.xml</relativePath>
+    <version>19-SNAPSHOT</version>
   </parent>
   <artifactId>redback-site</artifactId>
   <name>Redback :: Site</name>
@@ -33,15 +32,22 @@
     <redbackVersion>${project.version}</redbackVersion>
 
     <scmPubCheckoutDirectory>site-content</scmPubCheckoutDirectory>
-    <svnUrl>https://svn.apache.org/repos/asf/archiva/site-content/redback</svnUrl>
+
+    <siteRepositoryUrl>scm:git:https://gitbox.apache.org/repos/asf/archiva-web-content-INVALID.git</siteRepositoryUrl>
+    <site.staging.base>${project.basedir}</site.staging.base>
 
   </properties>
+  <scm>
+    <connection>scm:git:https://gitbox.apache.org/repos/asf/archiva-redback-site.git</connection>
+    <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/archiva-redback-site.git</developerConnection>
+    <url>https://github.com/apache/archiva-redback-site</url>
+  </scm>
 
   <distributionManagement>
    <site>
      <id>apache.website.svnpub</id>
      <name>Redback Website</name>
-     <url>scm:svn:${svnUrl}</url>
+     <url>${siteRepositoryUrl}</url>
    </site>
   </distributionManagement>
 
@@ -53,10 +59,9 @@
         <artifactId>maven-scm-publish-plugin</artifactId>
         <configuration>
           <checkinComment>Apache Redback Main site deployment</checkinComment>
-          <ignorePathsToDelete>
-            <ignorePathToDelete>core**</ignorePathToDelete>
-            <ignorePathToDelete>components**</ignorePathToDelete>
-          </ignorePathsToDelete>
+          <skipDeletedFiles>true</skipDeletedFiles>
+          <content>${project.build.directory}/staging</content>
+          <tryUpdate>true</tryUpdate>
         </configuration>
         <executions>
           <execution>
@@ -73,6 +78,7 @@
         <artifactId>maven-site-plugin</artifactId>
         <configuration>
           <skipDeploy>true</skipDeploy>
+          <stagingDirectory>${site.staging.base}/target/staging/redback/</stagingDirectory>
         </configuration>
         <executions>
           <execution>
@@ -99,68 +105,60 @@
         <reportSets>
           <reportSet>
             <reports>
-              <report>cim</report>
-              <report>issue-tracking</report>
-              <report>mailing-list</report>
-              <report>license</report>
-              <report>project-team</report>
+              <report>ci-management</report>
+              <report>mailing-lists</report>
+              <report>issue-management</report>
+              <report>licenses</report>
+              <report>team</report>
               <report>scm</report>
             </reports>
           </reportSet>
         </reportSets>
         <configuration>
-          <anonymousConnection>scm:git:https://git-wip-us.apache.org/repos/asf/archiva-redback-core.git</anonymousConnection>
-          <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/archiva-redback-core.git</developerConnection>
-          <webAccessUrl>http://github.org/apache/archiva-redback-core</webAccessUrl>
+          <anonymousConnection>scm:git:https://github.com/apache/archiva-redback-core.git</anonymousConnection>
+          <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/archiva-redback-core.git</developerConnection>
+          <webAccessUrl>https://github.com/apache/archiva-redback-core</webAccessUrl>
           <checkoutDirectoryName>redback-core</checkoutDirectoryName>
         </configuration>
       </plugin>
     </plugins>
   </reporting>
-  <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/archiva/redback/redback-site/trunk</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/archiva/redback/redback-site/trunk</developerConnection>
-    <url>http://svn.apache.org/viewvc/archiva/redback/redback-site/trunk/</url>
-  </scm>
 
   <profiles>
+    <!--
+    This runs a sparse git checkout for the web site content repository that contains only the doc directory.
+    The profile is activated only, if the checkout directory does not exist.
+    The executor runs a shell script.
+    -->
     <profile>
-      <id>setup-checkout</id>
+      <id>site-checkout</id>
       <activation>
         <file>
-          <missing>site-content</missing>
+          <missing>${scmPubCheckoutDirectory}</missing>
         </file>
       </activation>
       <build>
         <plugins>
           <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-antrun-plugin</artifactId>
-            <version>1.7</version>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>exec-maven-plugin</artifactId>
+            <version>1.6.0</version>
+            <inherited>false</inherited>
             <executions>
               <execution>
                 <id>prepare-checkout</id>
                 <phase>pre-site</phase>
                 <goals>
-                  <goal>run</goal>
+                  <goal>exec</goal>
                 </goals>
                 <configuration>
-                  <tasks>
-                    <exec executable="svn">
-                      <arg line="checkout --depth immediates ${svnUrl} ${scmPubCheckoutDirectory}" />
-                    </exec>
-
-                    <exec executable="svn">
-                      <arg line="update --set-depth exclude ${scmPubCheckoutDirectory}/core ${scmPubCheckoutDirectory}/components" />
-                    </exec>
-
-                    <pathconvert pathsep=" " property="dirs">
-                      <dirset dir="${scmPubCheckoutDirectory}" includes="*" />
-                    </pathconvert>
-                    <exec executable="svn">
-                      <arg line="update --set-depth infinity ${dirs}" />
-                    </exec>
-                  </tasks>
+                  <executable>checkoutSite.sh</executable>
+                  <workingDirectory>${project.basedir}</workingDirectory>
+                  <arguments>
+                    <argument>-d</argument>
+                    <argument>${scmPubCheckoutDirectory}</argument>
+                    <argument>${siteRepositoryUrl}</argument>
+                  </arguments>
                 </configuration>
               </execution>
             </executions>
diff --git a/src/site/site.xml b/src/site/site.xml
index 8bc40e4..7761327 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -33,20 +33,20 @@
       <googleSearch>
         <sitesearch>http://archiva.apache.org/redback</sitesearch>
       </googleSearch>
-      <twitter>
-        <user>archiva</user>
-        <showUser>true</showUser>
-        <showFollowers>false</showFollowers>
-      </twitter>
+      <gitHub>
+        <projectId>apache/archiva-redback-core</projectId>
+        <ribbonOrientation>right</ribbonOrientation>
+        <ribbonColor>gray</ribbonColor>
+      </gitHub>
       <ohloh>
         <projectId>8659</projectId>
-        <widget>stats</widget>
+        <widget>thin-badge</widget>
       </ohloh>
     </fluidoSkin>
 
   </custom>
 
-  <publishDate format="yyyy-MM-dd" position="left" />
+  <publishDate format="yyyy-MM-dd" position="right" />
  
   <body>
 
@@ -80,10 +80,12 @@
     </menu>
 
     <footer>
+      <![CDATA[
       <div class="row span12">Apache Redback, Redback, Apache, the Apache feather logo, and the Apache Archiva project logos are trademarks of The Apache Software Foundation.</div>
       <div class="row span12">
         <a href="${project.url}privacy-policy.html">Privacy Policy</a>
       </div>
+      ]]>
     </footer>
 
   </body>