You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/03/08 10:23:28 UTC

[camel-k] branch release-1.10.x updated: fix(ci): get snapshot catalog

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

pcongiusti pushed a commit to branch release-1.10.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-1.10.x by this push:
     new 9b5f38dcf fix(ci): get snapshot catalog
9b5f38dcf is described below

commit 9b5f38dcf1e6a3114cee88e32550fbfb053d9337
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Wed Mar 8 11:23:23 2023 +0100

    fix(ci): get snapshot catalog
---
 script/get_catalog.sh | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/script/get_catalog.sh b/script/get_catalog.sh
index eaeec9025..4eaae38f6 100755
--- a/script/get_catalog.sh
+++ b/script/get_catalog.sh
@@ -15,6 +15,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+set -e
+
 location=$(dirname $0)
 rootdir=$location/../
 
@@ -22,23 +24,24 @@ if [ "$#" -lt 1 ]; then
   echo "usage: $0 <Camel K runtime version> [<staging repository>]"
   exit 1
 fi
+runtime_version="$1"
 
-if [ -z $2 ]; then
-  mvn -q dependency:copy -Dartifact="org.apache.camel.k:camel-k-catalog:$1:yaml:catalog" -DoutputDirectory=${rootdir}/resources/
-  mv ${rootdir}/resources/camel-k-catalog-$1-catalog.yaml ${rootdir}/resources/camel-catalog-$1.yaml
-else
-  # TODO: fix this workaround to use the above mvn statement with the staging repository as well
-  echo "INFO: extracting a catalog from staging repository $2"
-  wget -q $2/org/apache/camel/k/camel-k-catalog/$1/camel-k-catalog-$1-catalog.yaml -O ${rootdir}/resources/camel-catalog.yaml
-
-  if [ -s ${rootdir}/resources/camel-catalog.yaml ]; then
-    # the extracted catalog file is not empty
-    mv ${rootdir}/resources/camel-catalog.yaml ${rootdir}/resources/camel-catalog-$1.yaml
-  else
-    # the extracted catalog file is empty - some error in staging repository
-    echo "WARNING: could not extract catalog from staging repository $2"
-    rm ${rootdir}/resources/camel-catalog.yaml
-  fi
+if [ ! -z $2 ]; then
+  # Change the settings to include the staging repo if it's not already there
+  echo "INFO: updating the settings staging repository"
+  sed -i.bak "s;<url>https://repository\.apache\.org/content/repositories/orgapachecamel-.*</url>;<url>$2</url>;" $location/maven-settings.xml
+  rm $location/maven-settings.xml.bak
 fi
 
+# Refresh catalog sets. We can clean any leftover as well.
+rm -f ${rootdir}/resources/camel-catalog-*
+
+mvn -q dependency:copy -Dartifact="org.apache.camel.k:camel-k-catalog:$runtime_version:yaml:catalog" \
+  -Dmdep.useBaseVersion=true \
+  -DoutputDirectory=${rootdir}/resources/ \
+  -s $location/maven-settings.xml \
+  -Papache
 
+if [ -f "${rootdir}/resources/camel-k-catalog-${runtime_version}-catalog.yaml" ]; then
+    mv ${rootdir}/resources/camel-k-catalog-"${runtime_version}"-catalog.yaml ${rootdir}/resources/camel-catalog-"${runtime_version}".yaml
+fi