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:43 UTC
[camel-k] 01/02: chore(ci): define IMAGE_ARCH parameter
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