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/04/27 08:33:42 UTC
[camel-k-runtime] 01/02: feat: align to camel quarkus
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch release-1.15.x
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit 7d80ace2b2fceaf4d4ec925dacda73206391ea1d
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Thu Apr 27 10:18:09 2023 +0200
feat: align to camel quarkus
---
.github/actions/automatic-updates/action.yml | 45 +++++++++++++
scripts/bump.sh | 68 ++------------------
scripts/sync_cq.sh | 95 ++++++++++++++++++++++++++++
3 files changed, 147 insertions(+), 61 deletions(-)
diff --git a/.github/actions/automatic-updates/action.yml b/.github/actions/automatic-updates/action.yml
new file mode 100644
index 00000000..b73edda0
--- /dev/null
+++ b/.github/actions/automatic-updates/action.yml
@@ -0,0 +1,45 @@
+# ---------------------------------------------------------------------------
+# 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.
+name: automatic-updates
+description: 'action used to run automation required by the project'
+
+inputs:
+ branch-ref:
+ required: true
+ type: string
+ secretGithubToken:
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - name: Sync Camel Quarkus and commit
+ shell: bash
+ env:
+ CI_USER: "github-actions[bot]"
+ CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
+ run: |
+ ./scripts/sync_cq.sh
+ git add -A && git commit -m 'feat: new Camel Quarkus version' && echo "refresh=1" >> $GITHUB_ENV || echo "No changes in the release"
+ - name: Push changes
+ shell: bash
+ if: env.refresh == 1
+ env:
+ CI_USER: "github-actions[bot]"
+ CI_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
+ CI_TOKEN: ${{ inputs.secretGithubToken }}
+ run: |
+ git push "https://$CI_USER:$CI_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ inputs.branch-ref }}
diff --git a/scripts/bump.sh b/scripts/bump.sh
index 6ad8e822..0eda67e5 100755
--- a/scripts/bump.sh
+++ b/scripts/bump.sh
@@ -5,63 +5,29 @@ set -e
display_usage() {
cat <<EOF
-Bump Camel K Runtime project Camel and Quarkus related dependencies
+Bump Camel K Runtime project synchronizing the dependency from Camel Quarkus
+
+Usage: ./script/bump.sh --camel-quarkus <camel-quarkus-version>
-Usage: ./script/bump.sh [options]
---version Bump Camel K runtime version
---camel Bump Camel version
--camel-quarkus Bump Camel-Quarkus version
---quarkus Bump Quarkus version
---quarkus-platform Bump Quarkus platform version (could differ from quarkus core)
---quarkus-camel-bom Bump Quarkus Camel BOM version (could differ from quarkus platform)
--help This help message
-Example: ./script/bump.sh --version 1.14.0-SNAPSHOT --camel 3.16.0
+Example: ./script/bump.sh --camel-quarkus 2.16.0
EOF
}
-VERSION=""
-CAMEL=""
CAMELQUARKUS=""
-QUARKUS=""
-QUARKUSPLATFORM=""
-QUARKUSCAMELBOM=""
main() {
parse_args $@
- if [[ ! -z "$VERSION" ]]; then
- mvn versions:set -DnewVersion="$VERSION" -DgenerateBackupPoms=false
- mvn versions:set -DnewVersion="$VERSION" -f support/camel-k-runtime-bom/pom.xml -DgenerateBackupPoms=false
- echo "Camel K runtime project set to $VERSION"
- fi
-
- if [[ ! -z "$CAMEL" ]]; then
- mvn versions:update-parent "-DparentVersion=[$CAMEL]" -DgenerateBackupPoms=false
- mvn versions:set-property -Dproperty="camel-version" -DnewVersion="$CAMEL" -DgenerateBackupPoms=false
- echo "Camel version set to $CAMEL"
- fi
-
if [[ ! -z "$CAMELQUARKUS" ]]; then
- mvn versions:set-property -Dproperty="camel-quarkus-version" -DnewVersion="$CAMELQUARKUS" -DgenerateBackupPoms=false
- echo "Camel Quarkus version set to $CAMELQUARKUS"
+ mvn versions:set -DnewVersion="$CAMELQUARKUS-SNAPSHOT" -DgenerateBackupPoms=false
+ mvn versions:set -DnewVersion="$CAMELQUARKUS-SNAPSHOT" -f support/camel-k-runtime-bom/pom.xml -DgenerateBackupPoms=false
+ echo "Camel K runtime project set to $CAMELQUARKUS-SNAPSHOT"
fi
- if [[ ! -z "$QUARKUS" ]]; then
- mvn versions:set-property -Dproperty="quarkus-version" -DnewVersion="$QUARKUS" -DgenerateBackupPoms=false
- echo "Quarkus version set to $QUARKUS"
- fi
-
- if [[ ! -z "$QUARKUSPLATFORM" ]]; then
- mvn versions:set-property -Dproperty="quarkus-platform-version" -DnewVersion="$QUARKUSPLATFORM" -DgenerateBackupPoms=false
- echo "Quarkus platform version set to $QUARKUSPLATFORM"
- fi
-
- if [[ ! -z "$QUARKUSCAMELBOM" ]]; then
- mvn versions:set-property -Dproperty="quarkus-camel-bom-version" -DnewVersion="$QUARKUSCAMELBOM" -DgenerateBackupPoms=false
- echo "Quarkus Camel BOM version set to $QUARKUSCAMELBOM"
- fi
}
parse_args(){
@@ -73,30 +39,10 @@ parse_args(){
display_usage
exit 0
;;
- --version)
- shift
- VERSION="$1"
- ;;
- --camel)
- shift
- CAMEL="$1"
- ;;
--camel-quarkus)
shift
CAMELQUARKUS="$1"
;;
- --quarkus)
- shift
- QUARKUS="$1"
- ;;
- --quarkus-platform)
- shift
- QUARKUSPLATFORM="$1"
- ;;
- --quarkus-camel-bom)
- shift
- QUARKUSCAMELBOM="$1"
- ;;
*)
echo "❗ unknown argument: $1"
display_usage
diff --git a/scripts/sync_cq.sh b/scripts/sync_cq.sh
new file mode 100755
index 00000000..5953c851
--- /dev/null
+++ b/scripts/sync_cq.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+set -e
+
+SEMVER="^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)(-SNAPSHOT)$"
+DRY_RUN="false"
+
+display_usage() {
+
+cat <<EOF
+Synch with the latest released version of Camel Quarkus
+
+Usage: ./script/sync_cq.sh
+
+--dry-run Show the changes without applying them to the project
+--help This help message
+
+Example: ./script/sync_cq.sh --dry-run
+EOF
+
+}
+
+main() {
+ parse_args $@
+
+ VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+ if ! [[ $VERSION =~ $SEMVER ]]; then
+ echo "❗ Version must match major.minor.patch(-SNAPSHOT) semantic version: $1"
+ exit 1
+ fi
+ VERSION_FULL="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
+ VERSION_MM="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
+ pushd /tmp
+ rm -rf camel-quarkus
+ git clone https://github.com/apache/camel-quarkus.git
+ pushd camel-quarkus
+ CQ_VERSION=$(git tag | grep $VERSION_MM | sort -n | tail -n 1)
+ if [ "$CQ_VERSION" == "$VERSION_FULL" ]; then
+ echo "INFO: there is no new version released, bye!"
+ exit 0
+ fi
+ git checkout $CQ_VERSION
+ # Get all variables in the new Camel Quarkus release
+ CAMEL_MM=$(grep -oPm1 "(?<=<camel.major.minor>)[^<]+" pom.xml)
+ CAMEL_P=$(grep -oPm1 "(?<=<camel.version>)[^<]+" pom.xml)
+ CAMEL_VERSION="$CAMEL_MM${CAMEL_P#"\${camel.major.minor}"}"
+ QUARKUS_VERSION=$(grep -oPm1 "(?<=<quarkus.version>)[^<]+" pom.xml)
+
+ echo "Next Camel Quarkus version is $CQ_VERSION"
+ echo "Next Camel version is $CAMEL_VERSION"
+ echo "Next Quarkus version is $QUARKUS_VERSION"
+
+ popd
+ popd
+
+ if [ "$DRY_RUN" == "true" ]; then
+ exit 0
+ fi
+
+ mvn versions:set -DnewVersion="$CQ_VERSION-SNAPSHOT" -DgenerateBackupPoms=false
+ mvn versions:set -DnewVersion="$CQ_VERSION-SNAPSHOT" -f support/camel-k-runtime-bom/pom.xml -DgenerateBackupPoms=false
+ # We also need to align the following properties
+ # camel-version
+ mvn versions:update-parent "-DparentVersion=[$CAMEL_VERSION]" -DgenerateBackupPoms=false
+ # camel-quarkus-version
+ mvn versions:set-property -Dproperty="camel-quarkus-version" -DnewVersion="$CQ_VERSION" -DgenerateBackupPoms=false
+ # quarkus-version
+ mvn versions:set-property -Dproperty="quarkus-version" -DnewVersion="$QUARKUS_VERSION" -DgenerateBackupPoms=false
+ # quarkus-platform-version
+ mvn versions:set-property -Dproperty="quarkus-platform-version" -DnewVersion="$QUARKUS_VERSION" -DgenerateBackupPoms=false
+}
+
+parse_args(){
+ while [ $# -gt 0 ]
+ do
+ arg="$1"
+ case $arg in
+ -h|--help)
+ display_usage
+ exit 0
+ ;;
+ --dry-run)
+ DRY_RUN="true"
+ ;;
+ *)
+ echo "❗ unknown argument: $1"
+ display_usage
+ exit 1
+ ;;
+ esac
+ shift
+ done
+}
+
+main $*