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/06/06 14:57:42 UTC

[camel-k] branch main updated (54fd6613b -> 374822a61)

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


    from 54fd6613b chore(deps): bump github.com/sirupsen/logrus from 1.9.2 to 1.9.3
     new 47fa320e2 chore(ci): define IMAGE_ARCH parameter
     new 374822a61 chore(doc): multi arch support update

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/actions/kamel-build-binary/build-binary.sh |  6 +--
 .github/actions/release-nightly/action.yml         | 42 +++++++++++--------
 .../ROOT/pages/contributing/local-development.adoc | 11 +++++
 .../installation/advanced/multi-architecture.adoc  | 31 ++++----------
 script/Makefile                                    | 48 ++++++++++------------
 script/cross_compile.sh                            |  1 +
 6 files changed, 69 insertions(+), 70 deletions(-)


[camel-k] 01/02: chore(ci): define IMAGE_ARCH parameter

Posted by pc...@apache.org.
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 47fa320e29f70c745b9176b32ee7cc9a5defa488
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Jun 6 09:38:46 2023 +0200

    chore(ci): define IMAGE_ARCH parameter
---
 .github/actions/release-nightly/action.yml | 42 ++++++++++++++++------------
 script/Makefile                            | 44 ++++++++++++------------------
 script/cross_compile.sh                    |  1 +
 3 files changed, 42 insertions(+), 45 deletions(-)

diff --git a/.github/actions/release-nightly/action.yml b/.github/actions/release-nightly/action.yml
index 0ad193cba..71390e5de 100644
--- a/.github/actions/release-nightly/action.yml
+++ b/.github/actions/release-nightly/action.yml
@@ -79,22 +79,22 @@ runs:
         MAVEN_REPOSITORY=$(make get-staging-repo)
         echo "Using MAVEN_REPOSITORY=$MAVEN_REPOSITORY"
         echo "MAVEN_REPOSITORY=$MAVEN_REPOSITORY" >> $GITHUB_ENV
-    - name: Install newer docker CLI supporting multi platform build
-      shell: bash
-      run: |
-        sudo apt-get update
-        sudo apt-get install ca-certificates curl gnupg
-        sudo install -m 0755 -d /etc/apt/keyrings
-        curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
-        sudo chmod a+r /etc/apt/keyrings/docker.gpg
-        echo \
-        "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
-        "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
-        sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-        sudo apt-get update
-        sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
+    # - name: Install newer docker CLI supporting multi platform build
+    #   shell: bash
+    #   run: |
+    #     sudo apt-get update
+    #     sudo apt-get install ca-certificates curl gnupg
+    #     sudo install -m 0755 -d /etc/apt/keyrings
+    #     curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+    #     sudo chmod a+r /etc/apt/keyrings/docker.gpg
+    #     echo \
+    #     "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
+    #     "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
+    #     sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
+    #     sudo apt-get update
+    #     sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
     - name: Set up QEMU (required by multi platform build)
-      uses: docker/setup-qemu-action@v2        
+      uses: docker/setup-qemu-action@v2
     - name: Login to Container Registry
       uses: docker/login-action@v1
       with:
@@ -103,7 +103,8 @@ runs:
     - name: Build and release containers
       shell: bash
       run: |
-        make VERSION=${{ env.VERSION }} IMAGE_NAME=${{ env.IMAGE_NAME }} codegen set-version build-resources release-nightly
+        make VERSION=${{ env.VERSION }} IMAGE_NAME=${{ env.IMAGE_NAME }} release-nightly
+        make IMAGE_ARCH=arm64 VERSION=${{ env.VERSION }} IMAGE_NAME=${{ env.IMAGE_NAME }} release-nightly
     - name: Create Release
       id: create_release
       uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
@@ -111,14 +112,19 @@ runs:
         artifacts: "./camel-k-client*.tar.gz"
         body: |
           Apache Camel K ${{ env.VERSION }} build for testing (unstable). This nightly release is using
-          an **unsupported** operator image published as `${{ env.IMAGE_NAME }}:${{ env.VERSION }}`
+          an **unsupported** operator image published as `${{ env.IMAGE_NAME }}:${{ env.VERSION }}` (default `amd64` architecture,
+          `-arm64` suffix for ARM64 architectures)
 
           To test it, download the client for your OS and run:
-
           ```
           kamel install --olm=false --maven-repository=${{ env.MAVEN_REPOSITORY }}
           ```
 
+          To test ARM64 architecture, download the client for your OS and run:
+          ```
+          kamel install --olm=false --operator-image=${{ env.IMAGE_NAME }}:${{ env.VERSION }}-arm64 --maven-repository=${{ env.MAVEN_REPOSITORY }}
+          ```
+
           NOTE: last updated on ${{ env.UPD_DATE }}
         token: ${{ inputs.secretGithubToken }}
         draft: false
diff --git a/script/Makefile b/script/Makefile
index 83e747163..f500f26a8 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -35,7 +35,8 @@ BASE_IMAGE := docker.io/eclipse-temurin:11
 DEFAULT_PVC := camel-k-pvc
 LOCAL_REPOSITORY := /etc/maven/m2
 IMAGE_NAME ?= docker.io/apache/camel-k
-
+# Default value, change to your architecture accordingly
+IMAGE_ARCH ?= amd64
 #
 # Situations when user wants to override
 # the image name and version
@@ -341,14 +342,10 @@ test-quarkus-native-high-memory: do-build
 	go test -timeout 180m -v ./e2e/native -tags=integration,high_memory $(TEST_QUARKUS_RUN) $(GOTESTFMT)
 
 build-kamel:
-	@echo "####### Building kamel CLI..."
-	@# Ensure the binary is statically linked when building on Linux due to ABI changes in newer glibc 2.32, otherwise
-	@# it would not run on older versions. See https://github.com/apache/camel-k/pull/2141#issuecomment-800990117
-ifeq ($(shell uname -s 2>/dev/null || echo Unknown),Linux)
-	CGO_ENABLED=0 go build $(GOFLAGS) -o kamel ./cmd/kamel/*.go
-else
-	go build $(GOFLAGS) -o kamel ./cmd/kamel/*.go
-endif
+	@echo "####### Building kamel CLI for $(IMAGE_ARCH) architecture..."
+	GOOS=linux GOARCH=$(IMAGE_ARCH) go build $(GOFLAGS) -o build/_output/bin/kamel-$(IMAGE_ARCH) ./cmd/kamel/*.go
+	# Symbolic link to a local CLI
+	ln -sf build/_output/bin/kamel-$(IMAGE_ARCH) ./kamel
 
 build-resources:
 	./script/get_catalog.sh $(RUNTIME_VERSION) $(STAGING_RUNTIME_REPO)
@@ -418,9 +415,6 @@ dir-licenses:
 check-licenses:
 	./script/check_licenses.sh
 
-check-platform:
-	./script/check_platform.sh
-
 # The below are dependencies needed for maven structured logs. We must bundle into the final container image.
 maven-overlay:
 	@echo "####### Preparing maven dependencies bundle..."
@@ -428,24 +422,20 @@ maven-overlay:
 	./script/maven_overlay.sh -s "$(STAGING_RUNTIME_REPO)" -d "$(CAMEL_K_RUNTIME_DIR)" $(RUNTIME_VERSION) build/_maven_overlay
 
 kamel-overlay:
-	@echo "####### Copying kamel CLI to output build directory..."
-	mkdir -p build/_output/bin
-ifeq ($(shell uname -s 2>/dev/null || echo Unknown),Linux)
-	cp kamel build/_output/bin
-else ifeq ($(shell uname -m), arm64)
-	GOOS=linux GOARCH=arm64 go build $(GOFLAGS) -o build/_output/bin/kamel ./cmd/kamel/*.go
-else
-	GOOS=linux go build $(GOFLAGS) -o build/_output/bin/kamel ./cmd/kamel/*.go
-endif
+	@echo "####### Copy arch $(IMAGE_ARCH) CLI into output build directory..."
+	cp build/_output/bin/kamel-$(IMAGE_ARCH) build/_output/bin/kamel
 
 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)
 endif
-	@echo "####### Building Camel K operator container image..."
+	@echo "####### Building Camel K operator arch $(IMAGE_ARCH) container image..."
 	mkdir -p build/_maven_output
-	docker build --platform=linux/amd64 -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION) -f build/Dockerfile .
-	docker build --platform=linux/arm64 -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION)-arm64 -f build/Dockerfile .
+ifeq ($(IMAGE_ARCH), amd64)
+	docker build --platform=linux/$(IMAGE_ARCH) -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION) -f build/Dockerfile .
+else
+	docker build --platform=linux/$(IMAGE_ARCH) -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION)-$(IMAGE_ARCH) -f build/Dockerfile .
+endif
 
 images-push:
 	docker push $(CUSTOM_IMAGE):$(CUSTOM_VERSION)
@@ -497,11 +487,11 @@ cross-compile:
 	# be processed as a single argument by the cross compile script
 	./script/cross_compile.sh $(CUSTOM_VERSION) $(subst ","\",$(GOFLAGS))
 
-release: clean codegen set-module-version set-version build-resources check-licenses build images images-push cross-compile git-tag
+release: clean codegen set-module-version set-version build-resources check-licenses images images-push cross-compile git-tag
 
-release-staging: clean codegen set-module-version set-version build-resources check-licenses build images images-push-staging cross-compile fabric8-crds git-tag
+release-staging: clean codegen set-module-version set-version build-resources check-licenses images images-push-staging cross-compile fabric8-crds git-tag
 
-release-nightly: clean codegen set-module-version set-version build-resources build images images-push cross-compile
+release-nightly: clean codegen set-module-version set-version build-resources images images-push cross-compile
 
 release-helm:
 	./script/release_helm.sh
diff --git a/script/cross_compile.sh b/script/cross_compile.sh
index 034647fb1..816be9178 100755
--- a/script/cross_compile.sh
+++ b/script/cross_compile.sh
@@ -58,6 +58,7 @@ cross_compile () {
 }
 
 cross_compile ${basename}-${version}-linux-64bit linux amd64
+cross_compile ${basename}-${version}-linux-64bit linux arm64
 cross_compile ${basename}-${version}-mac-64bit darwin amd64
 cross_compile ${basename}-${version}-mac-arm64bit darwin arm64
 cross_compile ${basename}-${version}-windows-64bit windows amd64


[camel-k] 02/02: chore(doc): multi arch support update

Posted by pc...@apache.org.
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 374822a618c5f74e7833fd07b23aa75e6e14e85b
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Tue Jun 6 09:55:38 2023 +0200

    chore(doc): multi arch support update
---
 .github/actions/kamel-build-binary/build-binary.sh |  6 ++---
 .../ROOT/pages/contributing/local-development.adoc | 11 ++++++++
 .../installation/advanced/multi-architecture.adoc  | 31 +++++++---------------
 script/Makefile                                    |  6 ++++-
 4 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/.github/actions/kamel-build-binary/build-binary.sh b/.github/actions/kamel-build-binary/build-binary.sh
index 435149301..a1ca0fb81 100755
--- a/.github/actions/kamel-build-binary/build-binary.sh
+++ b/.github/actions/kamel-build-binary/build-binary.sh
@@ -89,7 +89,7 @@ else
   fi
 
   if [ -n "${REGISTRY_PUSH_HOST}" ]; then
-    RULES="${RULES} images-push"
+    RULES="${RULES} image-push"
   fi
 
   make ${RULES}
@@ -98,9 +98,9 @@ fi
 echo "Moving kamel binary to be visible on PATH"
 
 if [ "$RUNNER_OS" == "macOS" ]; then
-  ${SUDO} mv ./kamel /usr/local/bin
+  ${SUDO} mv $(readlink kamel) /usr/local/bin/kamel
 else
-  ${SUDO} mv ./kamel /usr/bin
+  ${SUDO} mv $(readlink kamel) /usr/bin/kamel
 fi
 echo "Kamel version installed: $(kamel version)"
 
diff --git a/docs/modules/ROOT/pages/contributing/local-development.adoc b/docs/modules/ROOT/pages/contributing/local-development.adoc
index ff6197b55..a5729205b 100644
--- a/docs/modules/ROOT/pages/contributing/local-development.adoc
+++ b/docs/modules/ROOT/pages/contributing/local-development.adoc
@@ -31,6 +31,7 @@ This command will build and publish your actual Camel K development version to t
 
 You can provide any customization required such as `--log-level`, `--operator-id`, etcetera. Mind that you need to use `./kamel` in order to use the development binary you've just built, as tipically, `kamel` is the production CLI you have installed in your binary path.
 
+[[local-camel-k-runtime]]
 === Local Camel K runtime
 
 Camel K integrations are based on https://github.com/apache/camel-k-runtime[Camel K runtime], generally paired with the operator release. If you need to specify a different runtime, or you have a local Camel K Runtime that you want to test you need to build a Camel K version bundled with the local Camel K Runtime bits
@@ -41,3 +42,13 @@ make images CAMEL_K_RUNTIME_DIR=<path/to/local/ck-runtime/project>
 
 Once this is done you need to re-install via `./kamel install`.
 
+[[local-multi-arch]]
+=== Local Multiple Architecture
+
+Since Camel K version 2 we're introducing the support for multiple architecture. If you want to build your container image operator for a specific architecture, you can provide a parameter, `IMAGE_ARCH`. See the example:
+
+----
+IMAGE_ARCH=arm64 make images
+----
+
+With this configuration, you will build an ARM64 architecture container image that you can reference later as `apache/camel-k:<version>-arm64`.
\ No newline at end of file
diff --git a/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc b/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc
index 91b6fbb7c..931938762 100644
--- a/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc
+++ b/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc
@@ -1,37 +1,24 @@
 [[multi-architecture-props]]
 = Multi Architecture
 
-To use kamel inside other architecture like arm64 you must build it and use Buildah as builder strategy.
+NOTE: this part is evolving quickly during development of version 2 so it may be slightly inaccurate.
 
-NOTE: For now only arm64 is supported as other architectures
+To use Camel K operator with any architecture like `arm64` you must use Buildah as builder strategy.
 
-[[multi-architecture-build]]
-== Build and Publish Kamel
-
-As first step it's necessary to build kamel project `https://github.com/apache/camel-k` manually and push image to own docker repository.
-
-I suggest to create a free docker image repository with `docker-hub` or `ghcr`.
-
-[source,shell]
-.script/Makefile
-----
-make build images-arch images-push
-----
-
-NOTE: The base image of kamel operator is graalvm because multi architecture quarkus-mandrel image not published yet
+Since version 2, Camel K is publishing an ARM64 architecture beside the default AMD64 architecture. You need to reference this as `apache/camel-k:<version>-arm64`. You can build your particular architecture from source, following the guidelines in xref:contributing/local-development.adoc[Local development].
 
 [[multi-architecture-install]]
-== Install Kamel
+== Install Camel K ARM64 operator
 
-Proceed with installation of kamel inside kubernetes cluster with the below command
+Proceed with installation of kamel inside kubernetes cluster with the below command:
 
 [source,shell]
 ----
-./kamel install --build-publish-strategy=Buildah --registry YOUR_REGISTRY --registry-auth-username YOUR_USERNAME --registry-auth-password YOUR_PASSWORD
+kamel install --operator-image=apache/camel-k:<version>-arm64 --build-publish-strategy Buildah --build-publish-strategy-option BuildahPlatform=linux/arm/v8 --registry ...
 ----
 
 [[multi-architecture-use]]
-== Use kamel
+== Test an integration
 
 Build and run an integration
 
@@ -52,7 +39,7 @@ kamel run hello.groovy
 [[multi-architecture-configure-optional]]
 == Optional Buildah Configuration
 
-If you want change the default architecture of buildah build strategy, you must edit integration platform manually.
+If you want change the default architecture of Buildah build strategy once this is installed, you must edit integration platform manually.
 
 [source,shell]
 ----
@@ -78,4 +65,4 @@ status:
       BuildahPlatform: linux/arm/v8
 ----
 
-NOTE: It's important to know buidah supports only amd64 and arm64
+NOTE: It's important to know Buidah supports only amd64 and arm64
diff --git a/script/Makefile b/script/Makefile
index f500f26a8..94ba6b0e1 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -343,7 +343,7 @@ test-quarkus-native-high-memory: do-build
 
 build-kamel:
 	@echo "####### Building kamel CLI for $(IMAGE_ARCH) architecture..."
-	GOOS=linux GOARCH=$(IMAGE_ARCH) go build $(GOFLAGS) -o build/_output/bin/kamel-$(IMAGE_ARCH) ./cmd/kamel/*.go
+	CGO_ENABLED=0 GOOS=linux GOARCH=$(IMAGE_ARCH) go build $(GOFLAGS) -o build/_output/bin/kamel-$(IMAGE_ARCH) ./cmd/kamel/*.go
 	# Symbolic link to a local CLI
 	ln -sf build/_output/bin/kamel-$(IMAGE_ARCH) ./kamel
 
@@ -437,6 +437,10 @@ else
 	docker build --platform=linux/$(IMAGE_ARCH) -t $(CUSTOM_IMAGE):$(CUSTOM_VERSION)-$(IMAGE_ARCH) -f build/Dockerfile .
 endif
 
+# Mainly used for internal CI purposes
+image-push:
+	docker push $(CUSTOM_IMAGE):$(CUSTOM_VERSION)
+
 images-push:
 	docker push $(CUSTOM_IMAGE):$(CUSTOM_VERSION)
 	docker push $(CUSTOM_IMAGE):$(CUSTOM_VERSION)-arm64