You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2022/01/31 08:58:23 UTC

[camel-k] 12/40: Adds ability to skip build by downloading existing binary build image

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

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

commit 759f3424ed1944ca79bf35ceb898a5621f11d491
Author: phantomjinx <p....@phantomjinx.co.uk>
AuthorDate: Wed Nov 24 12:32:26 2021 +0000

    Adds ability to skip build by downloading existing binary build image
---
 .github/actions/kamel-build-binary/action.yml | 32 ++++++++++++++++++---------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
index e2216fa..1355bf2 100644
--- a/.github/actions/kamel-build-binary/action.yml
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -40,8 +40,6 @@ runs:
       name: Build Kamel Operator
       shell: bash
       run: |
-        echo "Build Kamel from source"
-
         if [ -n "${{ inputs.image-registry-push-host }}" ]; then
           #
           # Build with the PUSH host to ensure the correct image:tag
@@ -50,16 +48,30 @@ runs:
           export CUSTOM_IMAGE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k
         fi
 
-        RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
-        if [ -n "${{ inputs.make-rules }}" ]; then
-          RULES="${{ inputs.make-rules }}"
-        fi
+        if [ -n "${{ env.DEBUG_USE_EXISTING_IMAGE }}" ] && [ -n "${CUSTOM_IMAGE}" ]; then
+          echo "Fetching Kamel from existing build"
 
-        if [ -n "${{ inputs.image-registry-push-host }}" ]; then
-          RULES="${RULES} images-push"
-        fi
+          docker pull ${{ env.DEBUG_USE_EXISTING_IMAGE }}
+          id=$(docker create ${{ env.DEBUG_USE_EXISTING_IMAGE }})
+          docker cp $id:/usr/local/bin/kamel .
+
+          docker tag ${{ env.DEBUG_USE_EXISTING_IMAGE }} ${CUSTOM_IMAGE}:$(make get-version)
+          docker push ${CUSTOM_IMAGE}:$(make get-version)
+        else
 
-        make ${RULES}
+          echo "Build Kamel from source"
+
+          RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
+          if [ -n "${{ inputs.make-rules }}" ]; then
+            RULES="${{ inputs.make-rules }}"
+          fi
+
+          if [ -n "${{ inputs.image-registry-push-host }}" ]; then
+            RULES="${RULES} images-push"
+          fi
+
+          make ${RULES}
+        fi
 
         echo "Moving kamel binary to /usr/local/bin"
         sudo mv ./kamel /usr/local/bin