Skip to content

Commit

Permalink
feat: download all runtime dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Mar 10, 2023
1 parent 003317a commit ea2974d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions script/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ ifneq (,$(findstring SNAPSHOT,$(RUNTIME_VERSION)))
./script/package_maven_artifacts.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(RUNTIME_VERSION)
endif
@echo "####### Building Camel K operator container image..."
./script/get_all_dependencies.sh $(RUNTIME_VERSION) "$(STAGING_RUNTIME_REPO)"
mkdir -p build/_maven_output
docker build -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION) -f build/Dockerfile .

Expand Down
58 changes: 58 additions & 0 deletions script/get_all_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/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.

set -e

location=$(dirname $0)
rootdir=$location/../

if [ "$#" -lt 1 ]; then
echo "usage: $0 <Camel K runtime version> [<staging repository>]"
exit 1
fi
runtime_version="$1"

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

catalog="$rootdir/resources/camel-catalog-$runtime_version.yaml"
ckr_version=$(yq .spec.runtime.version $catalog)
cq_version=$(yq '.spec.runtime.metadata."camel-quarkus.version"' $catalog)

sed 's/- //g' $catalog | grep "groupId\|artifactId" | paste -d " " - - | awk '{print $2,":",$4}' | tr -d " " | sort | uniq > /tmp/ck.dependencies

dependencies=$(cat /tmp/ck.dependencies)
for d in $dependencies
do
mvn_dep=""
if [[ $d == org.apache.camel.quarkus* ]]; then
mvn_dep="$d:$cq_version"
elif [[ $d == org.apache.camel.k* ]]; then
mvn_dep="$d:$ckr_version"
# TODO merge with package_maven_artifacts.sh script
continue
else
echo "ERROR: cannot parse $d kind of dependency"
exit 1
fi
echo "INFO: downloading $mvn_dep and its transitive dependencies..."
mvn -q dependency:get -Dartifact=$mvn_dep -Dmaven.repo.local=${rootdir}build/_maven_output -s $location/maven-settings.xml
done

0 comments on commit ea2974d

Please sign in to comment.