1+ #! /bin/bash
2+
3+ # Licensed to the Apache Software Foundation (ASF) under one or more
4+ # contributor license agreements. See the NOTICE file distributed with
5+ # this work for additional information regarding copyright ownership.
6+ # The ASF licenses this file to You under the Apache License, Version 2.0
7+ # (the "License"); you may not use this file except in compliance with
8+ # the License. You may obtain a copy of the License at
9+ #
10+ # http://www.apache.org/licenses/LICENSE-2.0
11+ #
12+ # Unless required by applicable law or agreed to in writing, software
13+ # distributed under the License is distributed on an "AS IS" BASIS,
14+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ # See the License for the specific language governing permissions and
16+ # limitations under the License.
17+
18+ location=$( dirname $0 )
19+
20+ echo " Scraping information from Makefile"
21+ RUNTIME_VERSION=$( grep ' ^RUNTIME_VERSION := ' Makefile | sed ' s/^.* \?= //' )
22+
23+ CATALOG=" $location /../resources/camel-catalog-$RUNTIME_VERSION .yaml"
24+ # This script requires the catalog to be available (via make build-resources for instance)
25+ if [ ! -f $CATALOG ]; then
26+ echo " ❗ catalog not available. Make sure to download it before calling this script."
27+ exit 1
28+ fi
29+
30+ KAMELETS_VERSION=$( grep ' ^KAMELET_CATALOG_REPO_BRANCH := ' Makefile | sed ' s/^.* \?= //' | sed ' s/^.//' )
31+ re=" ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
32+ if ! [[ $KAMELETS_VERSION =~ $re ]]; then
33+ echo " ❗ argument must match semantic version: $KAMELETS_VERSION "
34+ exit 1
35+ fi
36+ KAMELETS_DOCS_VERSION=" ${BASH_REMATCH[1]} .${BASH_REMATCH[2]} .x"
37+ BUILDAH_VERSION=$( grep ' ^BUILDAH_VERSION := ' Makefile | sed ' s/^.* \?= //' )
38+ KANIKO_VERSION=$( grep ' ^KANIKO_VERSION := ' Makefile | sed ' s/^.* \?= //' )
39+ KUSTOMIZE_VERSION=$( grep ' ^KUSTOMIZE_VERSION := ' Makefile | sed ' s/^.* \?= //' | sed ' s/^.//' )
40+
41+ echo " Camel K Runtime version: $RUNTIME_VERSION "
42+ echo " Kamelets version: $KAMELETS_VERSION "
43+ echo " Buildah version: $BUILDAH_VERSION "
44+ echo " Kaniko version: $KANIKO_VERSION "
45+ echo " Kustomize version: $KUSTOMIZE_VERSION "
46+
47+ yq -i " .asciidoc.attributes.buildah-version = \" $BUILDAH_VERSION \" " $location /../docs/antora.yml
48+ yq -i " .asciidoc.attributes.kaniko-version = \" $KANIKO_VERSION \" " $location /../docs/antora.yml
49+ yq -i " .asciidoc.attributes.kustomize-version = \" $KUSTOMIZE_VERSION \" " $location /../docs/antora.yml
50+
51+ echo " Scraping information from catalog available at: $CATALOG "
52+ RUNTIME_VERSION=$( yq ' .spec.runtime.version' $CATALOG )
53+ CAMEL_VERSION=$( yq ' .spec.runtime.metadata."camel.version"' $CATALOG )
54+ re=" ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
55+ if ! [[ $CAMEL_VERSION =~ $re ]]; then
56+ echo " ❗ argument must match semantic version: $CAMEL_VERSION "
57+ exit 1
58+ fi
59+ CAMEL_DOCS_VERSION=" ${BASH_REMATCH[1]} .${BASH_REMATCH[2]} .x"
60+ CAMEL_QUARKUS_VERSION=$( yq ' .spec.runtime.metadata."camel-quarkus.version"' $CATALOG )
61+ re=" ^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)$"
62+ if ! [[ $CAMEL_QUARKUS_VERSION =~ $re ]]; then
63+ echo " ❗ argument must match semantic version: $CAMEL_QUARKUS_VERSION "
64+ exit 1
65+ fi
66+ CAMEL_QUARKUS_DOCS_VERSION=" ${BASH_REMATCH[1]} .${BASH_REMATCH[2]} .x"
67+ QUARKUS_VERSION=$( yq ' .spec.runtime.metadata."quarkus.version"' $CATALOG )
68+
69+ echo " Camel K Runtime version: $RUNTIME_VERSION "
70+ echo " Camel version: $CAMEL_VERSION "
71+ echo " Camel Quarkus version: $CAMEL_QUARKUS_VERSION "
72+ echo " Quarkus version: $QUARKUS_VERSION "
73+
74+ yq -i " .asciidoc.attributes.camel-k-runtime-version = \" $RUNTIME_VERSION \" " $location /../docs/antora.yml
75+ yq -i " .asciidoc.attributes.camel-version = \" $CAMEL_VERSION \" " $location /../docs/antora.yml
76+ yq -i " .asciidoc.attributes.camel-docs-version = \" $CAMEL_DOCS_VERSION \" " $location /../docs/antora.yml
77+ yq -i " .asciidoc.attributes.camel-quarkus-version = \" $CAMEL_QUARKUS_VERSION \" " $location /../docs/antora.yml
78+ yq -i " .asciidoc.attributes.camel-quarkus-docs-version = \" $CAMEL_QUARKUS_DOCS_VERSION \" " $location /../docs/antora.yml
79+ yq -i " .asciidoc.attributes.quarkus-version = \" $QUARKUS_VERSION \" " $location /../docs/antora.yml
80+ yq -i " .asciidoc.attributes.camel-kamelets-version = \" $KAMELETS_VERSION \" " $location /../docs/antora.yml
81+ yq -i " .asciidoc.attributes.camel-kamelets-docs-version = \" $KAMELETS_DOCS_VERSION \" " $location /../docs/antora.yml
82+
83+ echo " Scraping information from go.mod"
84+ KNATIVE_API_VERSION=$( grep ' ^.*knative.dev/eventing ' $location /../go.mod | sed ' s/^.* //' | sed ' s/^.//' )
85+ KUBE_API_VERSION=$( grep ' ^.*k8s.io/api ' $location /../go.mod | sed ' s/^.* //' | sed ' s/^.//' )
86+ OPERATOR_FWK_API_VERSION=$( grep ' ^.*github.com/operator-framework/api ' $location /../go.mod | sed ' s/^.* //' | sed ' s/^.//' )
87+ SERVICE_BINDING_OP_VERSION=$( grep ' ^.*github.com/redhat-developer/service-binding-operator ' $location /../go.mod | sed ' s/^.* //' | sed ' s/^.//' )
88+ PROMETHEUS_OP_VERSION=$( grep ' ^.*github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring ' $location /../go.mod | sed ' s/^.* //' | sed ' s/^.//' )
89+
90+ echo " Kubernetes API version: $KUBE_API_VERSION "
91+ echo " Operator Framework API version: $OPERATOR_FWK_API_VERSION "
92+ echo " KNative API version: $KNATIVE_API_VERSION "
93+ echo " Service Binding Operator version: $SERVICE_BINDING_OP_VERSION "
94+ echo " Prometheus Operator version: $PROMETHEUS_OP_VERSION "
95+
96+ yq -i " .asciidoc.attributes.kubernetes-api-version = \" $KUBE_API_VERSION \" " $location /../docs/antora.yml
97+ yq -i " .asciidoc.attributes.operator-fwk-api-version = \" $OPERATOR_FWK_API_VERSION \" " $location /../docs/antora.yml
98+ yq -i " .asciidoc.attributes.knative-api-version = \" $KNATIVE_API_VERSION \" " $location /../docs/antora.yml
99+ yq -i " .asciidoc.attributes.service-binding-op-version = \" $SERVICE_BINDING_OP_VERSION \" " $location /../docs/antora.yml
100+ yq -i " .asciidoc.attributes.prometheus-op-version = \" $PROMETHEUS_OP_VERSION \" " $location /../docs/antora.yml
0 commit comments