diff --git a/build/Dockerfile b/build/Dockerfile index 5f52516375..212ba30339 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -43,6 +43,8 @@ RUN ${MVNW_DIR}/mvnw --version | grep "Maven home:" | sed 's/Maven home: //' >> ENV MAVEN_OPTS="${MAVEN_OPTS} -Dlogback.configurationFile=${MAVEN_HOME}/conf/logback.xml" ADD build/_maven_output ${MVN_REPO} +# Fix https://github.com/moby/moby/issues/37965 +RUN true ADD build/_kamelets /kamelets RUN chgrp -R 0 ${MVN_REPO} \ diff --git a/pkg/controller/catalog/initialize.go b/pkg/controller/catalog/initialize.go index 5d1ec67f8b..e54d058e44 100644 --- a/pkg/controller/catalog/initialize.go +++ b/pkg/controller/catalog/initialize.go @@ -169,6 +169,7 @@ func initializeSpectrum(options spectrum.Options, ip *v1.IntegrationPlatform, ca return target, nil } +// nolint: maintidx // TODO: refactor the code func initializeS2i(ctx context.Context, c client.Client, ip *v1.IntegrationPlatform, catalog *v1.CamelCatalog) (*v1.CamelCatalog, error) { target := catalog.DeepCopy() // No registry in s2i @@ -180,14 +181,18 @@ func initializeS2i(ctx context.Context, c client.Client, ip *v1.IntegrationPlatf uidStr := getS2iUserID(ctx, c, ip, catalog) - // Dockfile - dockerfile := string([]byte(` + // Dockerfile + dockerfile := ` FROM ` + catalog.Spec.GetQuarkusToolingImage() + ` USER ` + uidStr + `:0 ADD --chown=` + uidStr + `:0 /usr/local/bin/kamel /usr/local/bin/kamel ADD --chown=` + uidStr + `:0 /usr/share/maven/mvnw/ /usr/share/maven/mvnw/ + ` + if imageSnapshot(imageName + ":" + imageTag) { + dockerfile = dockerfile + ` ADD --chown=` + uidStr + `:0 ` + defaults.LocalRepository + ` ` + defaults.LocalRepository + ` - `)) + ` + } owner := catalogReference(catalog) @@ -294,12 +299,15 @@ func initializeS2i(ctx context.Context, c client.Client, ip *v1.IntegrationPlatf return fmt.Errorf("cannot create tar archive: %w", err) } - err = tarEntries(archiveFile, + directories := []string{ "/usr/local/bin/kamel:/usr/local/bin/kamel", "/usr/share/maven/mvnw/:/usr/share/maven/mvnw/", - // Required for snapshots dependencies in the runtimes - defaults.LocalRepository+":"+defaults.LocalRepository, - ) + } + if imageSnapshot(imageName + ":" + imageTag) { + directories = append(directories, defaults.LocalRepository+":"+defaults.LocalRepository) + } + + err = tarEntries(archiveFile, directories...) if err != nil { return fmt.Errorf("cannot tar path entry: %w", err) } @@ -459,12 +467,15 @@ func buildRuntimeBuilderImageSpectrum(options spectrum.Options) error { options.Jobs = jobs } - _, err := spectrum.Build(options, + directories := []string{ "/usr/local/bin/kamel:/usr/local/bin/", "/usr/share/maven/mvnw/:/usr/share/maven/mvnw/", - // Required for snapshots dependencies in the runtimes - defaults.LocalRepository+":"+defaults.LocalRepository, - ) + } + if imageSnapshot(options.Target) { + directories = append(directories, defaults.LocalRepository+":"+defaults.LocalRepository) + } + + _, err := spectrum.Build(options, directories...) if err != nil { return err } diff --git a/pkg/util/defaults/defaults.go b/pkg/util/defaults/defaults.go index 6720f42eb6..fd80de942c 100644 --- a/pkg/util/defaults/defaults.go +++ b/pkg/util/defaults/defaults.go @@ -26,7 +26,7 @@ const ( Version = "2.0.0-SNAPSHOT" // DefaultRuntimeVersion -- - DefaultRuntimeVersion = "2.16.0-SNAPSHOT" + DefaultRuntimeVersion = "2.16.0" // BuildahVersion -- BuildahVersion = "1.30.0" diff --git a/resources/camel-catalog-2.16.0-SNAPSHOT.yaml b/resources/camel-catalog-2.16.0.yaml similarity index 99% rename from resources/camel-catalog-2.16.0-SNAPSHOT.yaml rename to resources/camel-catalog-2.16.0.yaml index f41e40502f..428b6ab41f 100644 --- a/resources/camel-catalog-2.16.0-SNAPSHOT.yaml +++ b/resources/camel-catalog-2.16.0.yaml @@ -18,15 +18,15 @@ apiVersion: camel.apache.org/v1 kind: CamelCatalog metadata: - name: camel-catalog-2.16.0-snapshot + name: camel-catalog-2.16.0 labels: app: camel-k camel.apache.org/catalog.loader.version: 3.20.1 camel.apache.org/catalog.version: 3.20.1 - camel.apache.org/runtime.version: 2.16.0-SNAPSHOT + camel.apache.org/runtime.version: 2.16.0 spec: runtime: - version: 2.16.0-SNAPSHOT + version: 2.16.0 provider: quarkus applicationClass: io.quarkus.bootstrap.runner.QuarkusEntryPoint metadata: diff --git a/script/Makefile b/script/Makefile index ef11889569..5afb2eeda4 100644 --- a/script/Makefile +++ b/script/Makefile @@ -23,7 +23,7 @@ VERSIONFILE := pkg/util/defaults/defaults.go VERSION ?= 2.0.0-SNAPSHOT LAST_RELEASED_IMAGE_NAME := camel-k-operator LAST_RELEASED_VERSION ?= 1.12.1 -RUNTIME_VERSION := 2.16.0-SNAPSHOT +DEFAULT_RUNTIME_VERSION := 2.16.0 BUILDAH_VERSION := 1.30.0 KANIKO_VERSION := 1.9.1 CONTROLLER_GEN_VERSION := v0.6.1 @@ -179,7 +179,7 @@ codegen: @echo " Version = \"$(CUSTOM_VERSION)\"" >> $(VERSIONFILE) @echo "" >> $(VERSIONFILE) @echo " // DefaultRuntimeVersion -- " >> $(VERSIONFILE) - @echo " DefaultRuntimeVersion = \"$(RUNTIME_VERSION)\"" >> $(VERSIONFILE) + @echo " DefaultRuntimeVersion = \"$(DEFAULT_RUNTIME_VERSION)\"" >> $(VERSIONFILE) @echo "" >> $(VERSIONFILE) @echo " // BuildahVersion -- " >> $(VERSIONFILE) @echo " BuildahVersion = \"$(BUILDAH_VERSION)\"" >> $(VERSIONFILE) @@ -348,7 +348,7 @@ build-kamel: ln -sf build/_output/bin/kamel-$(IMAGE_ARCH) ./kamel build-resources: - ./script/get_catalog.sh $(RUNTIME_VERSION) $(STAGING_RUNTIME_REPO) + ./script/get_catalog.sh $(DEFAULT_RUNTIME_VERSION) $(STAGING_RUNTIME_REPO) go generate ./pkg/... bundle-kamelets: @@ -419,7 +419,7 @@ check-licenses: maven-overlay: @echo "####### Preparing maven dependencies bundle..." mkdir -p build/_maven_overlay - ./script/maven_overlay.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(RUNTIME_VERSION) build/_maven_overlay + ./script/maven_overlay.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(DEFAULT_RUNTIME_VERSION) build/_maven_overlay kamel-overlay: mkdir -p build/_output/bin @@ -444,8 +444,8 @@ ifneq ($(IMAGE_ARCH), amd64) endif images: build kamel-overlay maven-overlay bundle-kamelets -ifneq (,$(findstring SNAPSHOT,$(RUNTIME_VERSION))) - ./script/package_maven_artifacts.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(RUNTIME_VERSION) +ifneq (,$(findstring SNAPSHOT,$(DEFAULT_RUNTIME_VERSION))) + ./script/package_maven_artifacts.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(DEFAULT_RUNTIME_VERSION) endif @echo "####### Building Camel K operator arch $(IMAGE_ARCH) container image..." mkdir -p build/_maven_output diff --git a/script/update_docs.sh b/script/update_docs.sh index 11281e4869..c64fcb5404 100755 --- a/script/update_docs.sh +++ b/script/update_docs.sh @@ -18,7 +18,7 @@ location=$(dirname $0) echo "Scraping information from Makefile" -RUNTIME_VERSION=$(grep '^RUNTIME_VERSION := ' Makefile | sed 's/^.* \?= //') +RUNTIME_VERSION=$(grep '^DEFAULT_RUNTIME_VERSION := ' Makefile | sed 's/^.* \?= //') CATALOG="$location/../resources/camel-catalog-$RUNTIME_VERSION.yaml" # This script requires the catalog to be available (via make build-resources for instance)