This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit f0acabade82b2fc040bc419b8859f4497823c2a0 Author: Pasquale Congiusti <[email protected]> AuthorDate: Thu Mar 31 16:29:38 2022 +0200 chore(ci): remove development runtime builder project We don't need to maintain a further project and related dependencies as we can rely directly on the camel-k-runtime project. If needed, a developer can include camel-k-runtime development dependencies via `make images-dev CAMEL_K_RUNTIME_DIR=/path/to/camel-k-runtime-project` --- build/maven/pom-runtime.xml | 235 -------------------------- docs/modules/ROOT/pages/contributing/e2e.adoc | 4 +- script/Makefile | 9 +- script/get_catalog.sh | 15 +- script/package_maven_artifacts.sh | 69 ++++---- 5 files changed, 48 insertions(+), 284 deletions(-) diff --git a/build/maven/pom-runtime.xml b/build/maven/pom-runtime.xml deleted file mode 100644 index a900a89..0000000 --- a/build/maven/pom-runtime.xml +++ /dev/null @@ -1,235 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<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/xsd/maven-4.0.0.xsd"> - - - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-runtime-builder</artifactId> - <version>1.0.0</version> - - <dependencies> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-maven-plugin</artifactId> - <version>${runtime.version}</version> - <type>maven-plugin</type> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-runtime-bom</artifactId> - <version>${runtime.version}</version> - <type>pom</type> - </dependency> - - <!-- camel-k --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-runtime</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-runtime-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-knative-api</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-knative</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-knative-consumer</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-knative-consumer-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-knative-producer</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-knative-producer-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-knative-http</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-core</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-core-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-knative</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-knative-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-master</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-master-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-cron</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-cron-deployment</artifactId> - <version>${runtime.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-core-support</artifactId> - <version>${runtime.version}</version> - </dependency> - - </dependencies> - - <repositories> - <repository> - <id>apache.snapshots</id> - <name>Apache Development Snapshot Repository</name> - <url>https://repository.apache.org/content/repositories/snapshots/</url> - <releases> - <enabled>false</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - <repository> - <id>oss.snapshots</id> - <url>https://oss.sonatype.org/content/repositories/snapshots</url> - <releases> - <enabled>false</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - - <pluginRepositories> - <pluginRepository> - <id>apache.snapshots</id> - <name>Apache Development Snapshot Repository</name> - <url>https://repository.apache.org/content/repositories/snapshots/</url> - <releases> - <enabled>false</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </pluginRepository> - <pluginRepository> - <id>oss.snapshots</id> - <url>https://oss.sonatype.org/content/repositories/snapshots</url> - <releases> - <enabled>false</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - - <profiles> - <profile> - <id>staging</id> - <activation> - <property> - <name>staging.repo</name> - </property> - </activation> - - <repositories> - <repository> - <id>staging</id> - <url>${staging.repo}</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - - <pluginRepositories> - <pluginRepository> - <id>staging</id> - <url>${staging.repo}</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - - </profile> - </profiles> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.1</version> - <configuration> - <useRepositoryLayout>true</useRepositoryLayout> - <addParentPoms>true</addParentPoms> - <copyPom>true</copyPom> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/docs/modules/ROOT/pages/contributing/e2e.adoc b/docs/modules/ROOT/pages/contributing/e2e.adoc index 49ac4e7..6b25a65 100644 --- a/docs/modules/ROOT/pages/contributing/e2e.adoc +++ b/docs/modules/ROOT/pages/contributing/e2e.adoc @@ -44,11 +44,11 @@ make images The script will take care to build the operator docker image and push to the underlying docker daemon registry. At this stage, the cluster will be able to pickup this latest image when it executes the tests. -You can also execute the following script, if by any chance you have some change applied to the `camel-k-runtime`: +You can also execute the following script, if by any chance you have some change applied to the `camel-k-runtime`. You can optionally point to your local Camel K runtime project directory if you need to install any SNAPSHOT dependency: [source] ---- -make images-dev +make images-dev [CAMEL_K_RUNTIME_DIR=/path/to/camel-k-runtime-project] ---- [[using-nexus]] diff --git a/script/Makefile b/script/Makefile index 32882bf..9cd3ee7 100644 --- a/script/Makefile +++ b/script/Makefile @@ -68,10 +68,6 @@ KAMELET_CATALOG_REPO := https://github.com/apache/camel-kamelets.git # Optional branch for the default Kamelet catalog (change this to a tag before release) KAMELET_CATALOG_REPO_BRANCH := v0.7.1 -# When packaging artifacts into the docker image, you can "copy" them from local maven -# or "download" them from Apache Snapshots and Maven Central -PACKAGE_ARTIFACTS_STRATEGY := copy - # OLM (Operator Lifecycle Manager and Operator Hub): uncomment to override operator settings at build time #GOLDFLAGS += -X github.com/apache/camel-k/pkg/util/olm.DefaultOperatorName=camel-k-operator #GOLDFLAGS += -X github.com/apache/camel-k/pkg/util/olm.DefaultPackage=camel-k @@ -239,7 +235,7 @@ else endif build-resources: - ./script/get_catalog.sh $(RUNTIME_VERSION) -Dstaging.repo="$(STAGING_RUNTIME_REPO)" + ./script/get_catalog.sh $(RUNTIME_VERSION) go generate ./pkg/... bundle-kamelets: @@ -353,7 +349,8 @@ package-examples: ./script/package_examples.sh $(CUSTOM_VERSION) package-artifacts: - ./script/package_maven_artifacts.sh $(RUNTIME_VERSION) $(PACKAGE_ARTIFACTS_STRATEGY) $(STAGING_RUNTIME_REPO) + # useful for development purpose only in order to include any local development runtime dependency + ./script/package_maven_artifacts.sh $(RUNTIME_VERSION) $(CAMEL_K_RUNTIME_DIR) release: clean codegen set-module-version set-version build-resources check-licenses build images images-push cross-compile package-examples git-tag diff --git a/script/get_catalog.sh b/script/get_catalog.sh index 9080fd1..6f03800 100755 --- a/script/get_catalog.sh +++ b/script/get_catalog.sh @@ -18,15 +18,10 @@ location=$(dirname $0) rootdir=$location/../ -if [ "$#" -ge 1 ]; then - runtimeVersion="$1" - shift 1 - # the catalog was already provided by Camel K runtime. No need to depends on maven to rebuild it - wget -q https://repo1.maven.org/maven2/org/apache/camel/k/camel-k-catalog/$runtimeVersion/camel-k-catalog-$runtimeVersion-catalog.yaml -O ${rootdir}/resources/camel-catalog-$runtimeVersion.yaml - # TODO if we need to use also staging, then we must parse the maven-metadata from the staging repository - # (ie https://repository.apache.org/content/repositories/snapshots/org/apache/camel/k/camel-k-catalog/1.13.0-SNAPSHOT/maven-metadata.xml) - # and get the latest snapshot produced as done in the stable version above -else - echo "usage: $0 <runtime.version> [staging.repo]" +if [ "$#" -lt 1 ]; then + echo "usage: $0 <Camel K runtime version>" exit 1 fi + +mvn dependency:copy -Dartifact="org.apache.camel.k:camel-k-catalog:$1:yaml:catalog" -DoutputDirectory=${rootdir}/resources/ + diff --git a/script/package_maven_artifacts.sh b/script/package_maven_artifacts.sh index 8277023..70449a5 100755 --- a/script/package_maven_artifacts.sh +++ b/script/package_maven_artifacts.sh @@ -17,39 +17,46 @@ location=$(dirname $0) -if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then - echo "usage: $0 version strategy [staging.repo]" +if [ "$#" -lt 1 ]; then + echo "usage: $0 <Camel K runtime version> [<local Camel K runtime project directory>]" exit 1 fi -version=$1 -strategy=$2 -staging_repo=$3 - -cd ${location}/.. - -if [ "$strategy" = "copy" ]; then - mvn \ - -V \ - --no-transfer-progress \ - -f build/maven/pom-runtime.xml \ - -DoutputDirectory=$PWD/build/_maven_output \ - -Druntime.version=$version \ - -Dstaging.repo=$staging_repo \ - -Dalpn.jdk8.version="8.1.13.v20181017" \ - dependency:copy-dependencies -elif [ "$strategy" = "download" ]; then - mvn \ - -V \ - --no-transfer-progress \ - -f build/maven/pom-runtime.xml \ - -Dmaven.repo.local=$PWD/build/_maven_output \ - -Druntime.version=$version \ - -Dstaging.repo=$staging_repo \ - -Dalpn.jdk8.version="8.1.13.v20181017" \ - install +camel_k_destination="$PWD/build/_maven_output" +camel_k_runtime_version=$1 + +if [ -z "$2" ]; then + is_snapshot=$(echo "$1" | grep "SNAPSHOT") + if [ "$is_snapshot" = "$1" ]; then + echo "You're trying to package SNAPSHOT artifacts. You probably wants them from your local environment, try calling:" + echo "$0 <Camel K runtime version> <local Camel K runtime project directory>" + exit 3 + fi + + # Take the dependencies officially released + wget https://repo1.maven.org/maven2/org/apache/camel/k/apache-camel-k-runtime/$1/apache-camel-k-runtime-$1-source-release.zip -O $PWD/build/apache-camel-k-runtime-$1-source-release.zip + unzip -o $PWD/build/apache-camel-k-runtime-$1-source-release.zip -d $PWD/build + mvn -f $PWD/build/apache-camel-k-runtime-$1/pom.xml \ + dependency:copy-dependencies \ + -DincludeScope=runtime \ + -Dmdep.copyPom=true \ + -DoutputDirectory=$camel_k_destination \ + -Dmdep.useRepositoryLayout=true + rm -rf $PWD/build/apache-camel-k-runtime* else - echo "unknown strategy: $strategy" - exit 1 -fi + # Take the dependencies from a local development environment + camel_k_runtime_source=$2 + camel_k_runtime_source_version=$(mvn -f $camel_k_runtime_source/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout) + + if [ "$camel_k_runtime_version" != "$camel_k_runtime_source_version" ]; then + echo "Misaligned version. You're building Camel K project using $camel_k_runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version" + exit 2 + fi + mvn -f $camel_k_runtime_source/pom.xml \ + dependency:copy-dependencies \ + -DincludeScope=runtime \ + -Dmdep.copyPom=true \ + -DoutputDirectory=$camel_k_destination \ + -Dmdep.useRepositoryLayout=true +fi
