From 774e97630f8c53108577fdb2d0d403539fde43c5 Mon Sep 17 00:00:00 2001 From: nxtcoder17 Date: Wed, 9 Oct 2024 12:53:58 +0530 Subject: [PATCH] release v1.0.8 - udpates, web,api,kl, and operator --- .github/workflows/kl.yml | 302 ++++++++++++++++++++---- .github/workflows/release-kloudlite.yml | 13 +- .github/workflows/web.yml | 5 +- api | 2 +- kl | 2 +- operator | 2 +- web | 2 +- 7 files changed, 268 insertions(+), 60 deletions(-) diff --git a/.github/workflows/kl.yml b/.github/workflows/kl.yml index 17609c4fa..2da6489bb 100644 --- a/.github/workflows/kl.yml +++ b/.github/workflows/kl.yml @@ -1,88 +1,296 @@ -name: build-kl-binary +name: kl workflows on: workflow_call: jobs: - docker-build: + # docker-build: + # runs-on: ubuntu-latest + # steps: + # - name: Setup Python + # uses: actions/setup-python@v2 + # with: + # python-version: '3.x' + # + # - name: Create and Set Image Tag + # id: tag_name + # run: | + # import re + # import os + # + # ref = os.getenv('GITHUB_REF') + # if ref.startswith('refs/heads/release-'): + # tag = ref.replace('refs/heads/release-', '') + # if not re.search('-nightly$', tag): + # tag += "-nightly" + # elif ref.startswith('refs/tags/'): + # tag = ref.replace('refs/tags/', '') + # else: + # tag = 'default-tag' # Adjust this fallback tag as necessary + # + # with open(os.getenv('GITHUB_ENV'), 'a') as env_file: + # env_file.write(f"TAG={tag}\n") + # + # with open(os.getenv('GITHUB_OUTPUT'), 'a') as env_out: + # env_out.write(f"TAG_NAME={tag}\n") + # shell: python + # + # - uses: actions/checkout@v4 + # with: + # submodules: recursive + # + # - name: Setup Build Environment + # id: setup + # uses: ./.github/actions/setup/ + # with: + # github_token: "${{ secrets.GITHUB_TOKEN }}" + # enable_go: false + # enable_task: false + # enable_upx: false + # enable_docker: true + # + # - name: Build & Push Image + # if: startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') + # env: + # IMAGE_TAG: ${{ steps.tag_name.outputs.TAG_NAME }} + # OVERRIDE_PUSHED_IMAGE: "false" + # run: | + # set +e + # image_name="ghcr.io/kloudlite/kl/box" + # + # docker manifest inspect $image_name:$IMAGE_TAG + # exit_status=$? + # if [ $exit_status -eq 0 ]; then + # [ "$OVERRIDE_PUSHED_IMAGE" = "false" ] && echo "image ($image_name:$IMAGE_TAG) already exists, and override image is disable, exiting" && exit 0 + # echo "image exists, but override pushed image is set to true. proceeding with building image" + # fi + # + # set -e + # + # docker buildx build --platform linux/amd64,linux/arm64 -t "$image_name:$IMAGE_TAG" --build-arg VERSION=$IMAGE_TAG --build-context project=kl kl/klbox-docker --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" --push + + klbox-docker-build: + strategy: + fail-fast: false + matrix: + arch: [amd64, arm64] + include: + - arch: amd64 + runs-on: warp-ubuntu-2404-x64-8x-spot + + - arch: arm64 + runs-on: blacksmith-4vcpu-ubuntu-2204-arm + + permissions: + contents: read + packages: write + + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: kloudlite/actions/generate-image-tag@v1 + - uses: kloudlite/actions/setup-docker@v1 + with: + docker_registry: ghcr.io + docker_username: ${{ github.actor }} + docker_password: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Build & Push Image + # if: startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') + working-directory: ./kl + env: + # IMAGE_TAG: ${{ steps.tag_name.outputs.TAG_NAME }} + KL_VERSION_TAG: ${{ env.IMAGE_TAG }} + OVERRIDE_PUSHED_IMAGE: "false" + run: | + set +e + image_name="ghcr.io/kloudlite/kl/box" + + # docker manifest inspect $image_name:$IMAGE_TAG + # exit_status=$? + # if [ $exit_status -eq 0 ]; then + # [ "$OVERRIDE_PUSHED_IMAGE" = "false" ] && echo "image ($image_name:$IMAGE_TAG) already exists, and override image is disable, exiting" && exit 0 + # echo "image exists, but override pushed image is set to true. proceeding with building image" + # fi + + set -e + + docker build --build-arg VERSION=$KL_VERSION_TAG -t ghcr.io/kloudlite/kl/box:$IMAGE_TAG-${{ matrix.arch }} --build-context project=. --output=type=image,compression=zstd,force-compression=true,compression-level=12,push=true ./klbox-docker + + klbox-docker-multiarch-manifest: + needs: klbox-docker-build runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + steps: - - name: Setup Python - uses: actions/setup-python@v2 + - uses: kloudlite/actions/generate-image-tag@v1 + + - uses: kloudlite/actions/setup-docker@v1 with: - python-version: '3.x' + docker_registry: ghcr.io + docker_username: ${{ github.actor }} + docker_password: ${{ secrets.GITHUB_TOKEN }} - - name: Create and Set Image Tag - id: tag_name + - name: multiarch manifest build + env: + # IMAGE_TAG: ${{ env.II}} + KL_VERSION_TAG: ${{ env.IMAGE_TAG }} + # OVERRIDE_PUSHED_IMAGE: "false" + shell: bash run: | - import re - import os + image_name="ghcr.io/kloudlite/kl/box" + docker manifest create ${image_name}:${IMAGE_TAG} ${image_name}:${IMAGE_TAG}-amd64 ${image_name}:${IMAGE_TAG}-arm64 - ref = os.getenv('GITHUB_REF') - if ref.startswith('refs/heads/release-'): - tag = ref.replace('refs/heads/release-', '') - if not re.search('-nightly$', tag): - tag += "-nightly" - elif ref.startswith('refs/tags/'): - tag = ref.replace('refs/tags/', '') - else: - tag = 'default-tag' # Adjust this fallback tag as necessary + docker manifest annotate ${image_name}:${IMAGE_TAG} ${image_name}:${IMAGE_TAG}-amd64 --os linux --arch amd64 + docker manifest annotate ${image_name}:${IMAGE_TAG} ${image_name}:${IMAGE_TAG}-arm64 --os linux --arch arm64 - with open(os.getenv('GITHUB_ENV'), 'a') as env_file: - env_file.write(f"TAG={tag}\n") + docker manifest push ${image_name}:${IMAGE_TAG} - with open(os.getenv('GITHUB_OUTPUT'), 'a') as env_out: - env_out.write(f"TAG_NAME={tag}\n") - shell: python + kl-k3s-tracker-docker-build: + permissions: + contents: read + packages: write + + runs-on: ubuntu-latest + + steps: + - uses: kloudlite/actions/generate-image-tag@v1 + + - uses: kloudlite/actions/setup-docker@v1 + with: + docker_registry: ghcr.io + docker_username: ${{ github.actor }} + docker_password: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 - - name: Setup Build Environment - id: setup - uses: ./.github/actions/setup/ + - name: Build & Push Image + working-directory: ./kl/k3s/k3s-tracker + env: + KL_VERSION_TAG: ${{ env.IMAGE_TAG }} + OVERRIDE_PUSHED_IMAGE: "false" + run: | + set +e + image_name="ghcr.io/kloudlite/kl/k3s-tacker" + set -e + docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION=$KL_VERSION_TAG -t ghcr.io/kloudlite/kl/k3s-tracker:$IMAGE_TAG . --push + + kl-k3s-base-docker-build: + strategy: + fail-fast: false + matrix: + arch: [ amd64, arm64 ] + include: + - arch: amd64 + runs-on: warp-ubuntu-2404-x64-8x-spot + + - arch: arm64 + runs-on: blacksmith-4vcpu-ubuntu-2204-arm + + permissions: + contents: read + packages: write + + runs-on: ${{ matrix.runs-on }} + + steps: + - uses: kloudlite/actions/generate-image-tag@v1 + + - uses: kloudlite/actions/setup-docker@v1 with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - enable_go: false - enable_task: false - enable_upx: false - enable_docker: true + docker_registry: ghcr.io + docker_username: ${{ github.actor }} + docker_password: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 - name: Build & Push Image - if: startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') + working-directory: ./kl/k3s/k3s-base env: - IMAGE_TAG: ${{ steps.tag_name.outputs.TAG_NAME }} + KL_VERSION_TAG: ${{ env.IMAGE_TAG }} + K3S_VERSION: "v1.31.1+k3s1" OVERRIDE_PUSHED_IMAGE: "false" run: | set +e - image_name="ghcr.io/kloudlite/kl/box" + image_name="ghcr.io/kloudlite/kl/k3s-tacker" + set -e + mkdir -p ./images + docker pull ghcr.io/kloudlite/operator/networking/cmd/dns:$IMAGE_TAG + docker image save ghcr.io/kloudlite/operator/networking/cmd/dns:$IMAGE_TAG -o ./images/dns.tar.gz + docker pull ghcr.io/kloudlite/operator/networking/cmd/ip-manager:$IMAGE_TAG + docker image save ghcr.io/kloudlite/operator/networking/cmd/ip-manager:$IMAGE_TAG -o ./images/ip-manager.tar.gz + docker pull ghcr.io/kloudlite/operator/networking/cmd/logs-proxy:$IMAGE_TAG + docker image save ghcr.io/kloudlite/operator/networking/cmd/logs-proxy:$IMAGE_TAG -o ./images/logs-proxy.tar.gz + docker pull ghcr.io/kloudlite/operator/networking/cmd/webhook:$IMAGE_TAG + docker image save ghcr.io/kloudlite/operator/networking/cmd/webhook:$IMAGE_TAG -o ./images/webhook.tar.gz + docker pull ghcr.io/kloudlite/operator/networking/cmd/ip-binding-controller:$IMAGE_TAG + docker image save ghcr.io/kloudlite/operator/networking/cmd/ip-binding-controller:$IMAGE_TAG -o ./images/ip-binding-controller.tar.gz + docker pull ghcr.io/kloudlite/api/tenant-agent:$IMAGE_TAG + docker image save ghcr.io/kloudlite/api/tenant-agent:$IMAGE_TAG -o ./images/kl-agent.tar.gz + docker pull ghcr.io/kloudlite/operator/agent:$IMAGE_TAG + docker image save ghcr.io/kloudlite/operator/agent:$IMAGE_TAG -o ./images/kl-agent-operator.tar.gz + curl -L "https://github.com/k3s-io/k3s/releases/download/$K3S_VERSION/k3s-airgap-images-${{ matrix.arch }}.tar" -o ./images/k3s-airgap-images-${{ matrix.arch }}.tar + docker build --build-arg VERSION=$KL_VERSION_TAG -t ghcr.io/kloudlite/kl/k3s:$IMAGE_TAG-${{ matrix.arch }} . --push + + kl-k3s-docker-multiarch-manifest: + needs: kl-k3s-base-docker-build + runs-on: ubuntu-latest - docker manifest inspect $image_name:$IMAGE_TAG - exit_status=$? - if [ $exit_status -eq 0 ]; then - [ "$OVERRIDE_PUSHED_IMAGE" = "false" ] && echo "image ($image_name:$IMAGE_TAG) already exists, and override image is disable, exiting" && exit 0 - echo "image exists, but override pushed image is set to true. proceeding with building image" - fi + permissions: + contents: read + packages: write - set -e + steps: + - uses: kloudlite/actions/setup-docker@v1 + with: + docker_registry: ghcr.io + docker_username: ${{ github.actor }} + docker_password: ${{ secrets.GITHUB_TOKEN }} + + - name: multiarch manifest build + env: + KL_VERSION_TAG: ${{ env.IMAGE_TAG }} + OVERRIDE_PUSHED_IMAGE: "false" + shell: bash + run: | + image_name="ghcr.io/kloudlite/kl/k3s" + docker manifest create ${image_name}:${IMAGE_TAG} ${image_name}:${IMAGE_TAG}-amd64 ${image_name}:${IMAGE_TAG}-arm64 + + docker manifest annotate ${image_name}:${IMAGE_TAG} ${image_name}:${IMAGE_TAG}-amd64 --os linux --arch amd64 + docker manifest annotate ${image_name}:${IMAGE_TAG} ${image_name}:${IMAGE_TAG}-arm64 --os linux --arch arm64 - docker buildx build --platform linux/amd64,linux/arm64 -t "$image_name:$IMAGE_TAG" --build-arg VERSION=$IMAGE_TAG --build-context project=kl kl/klbox-docker --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" --push + docker manifest push ${image_name}:${IMAGE_TAG} build: name: Build ${{ matrix.app }}-${{ matrix.platform }}-${{ matrix.arch }} strategy: fail-fast: false matrix: - app: [kl,kli] - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + # app: [kl,kli] + app: [kl] + # os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: [ubuntu-latest, macos-13, macos-14] arch: [amd64, arm64] include: - os: ubuntu-latest goos: linux platform: linux - - os: windows-latest - goos: windows - platform: windows + # - os: windows-latest + # goos: windows + # platform: windows - os: macos-13 goos: darwin platform: darwin diff --git a/.github/workflows/release-kloudlite.yml b/.github/workflows/release-kloudlite.yml index 052033c80..cb41d2cc9 100644 --- a/.github/workflows/release-kloudlite.yml +++ b/.github/workflows/release-kloudlite.yml @@ -95,12 +95,13 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + fetch-depth: 0 - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - name: k3s-runner - path: k3s-runner-artifacts + # - name: Download all artifacts + # uses: actions/download-artifact@v4 + # with: + # name: k3s-runner + # path: k3s-runner-artifacts - name: Download all artifacts uses: actions/download-artifact@v4 @@ -115,7 +116,6 @@ jobs: path: k3s - run: |+ - ls k3s-runner-artifacts/* ls kl-artifacts/* ls k3s/* @@ -153,7 +153,6 @@ jobs: release_tag: ${{ env.release_tag }} github_ref: ${GITHUB_REF} files: |+ - k3s-runner-artifacts/** kl-artifacts/** k3s/** diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index c0e31768c..0b6d17146 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -42,7 +42,8 @@ jobs: if: "!startsWith(github.ref, 'refs/heads/release-') && !startsWith(github.ref, 'refs/tags/')" run: | image_name="ghcr.io/${{ github.repository }}/web/${{matrix.app}}" - docker buildx build --platform linux/amd64,linux/arm64 --build-arg APP=${{matrix.app}} -f web/${{matrix.dockerFile}} web -t "$image_name:test" --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" + # docker buildx build --platform linux/amd64,linux/arm64 --build-arg APP=${{matrix.app}} -f web/${{matrix.dockerFile}} web -t "$image_name:test" --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" + docker buildx build --platform linux/amd64 --build-arg APP=${{matrix.app}} -f web/${{matrix.dockerFile}} web -t "$image_name:test" --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" - name: Build & Push Image if: startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') @@ -62,4 +63,4 @@ jobs: set -e - docker buildx build --build-arg APP=${{matrix.app}} -f web/${{matrix.dockerFile}} web -t "$image_name:$IMAGE_TAG" --push --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" + docker buildx build --platform linux/amd64 --build-arg APP=${{matrix.app}} -f web/${{matrix.dockerFile}} web -t "$image_name:$IMAGE_TAG" --push --cache-from="type=registry,ref=$image_name:buildcache" --cache-to="type=registry,ref=$image_name:buildcache,mode=max" diff --git a/api b/api index c4d26525e..471ec2d73 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit c4d26525e4a965226dfab1d7d3ea674e7999c2c0 +Subproject commit 471ec2d7371ebb3b95958874b39c5b9159bfb553 diff --git a/kl b/kl index 159aa647f..5a0d3aa4e 160000 --- a/kl +++ b/kl @@ -1 +1 @@ -Subproject commit 159aa647f6a5f3d9075bbdb154ee20e3bdda8f67 +Subproject commit 5a0d3aa4eb18788c49a3895915f2eba20110a45f diff --git a/operator b/operator index e4d3cd6a2..7d0fe5c32 160000 --- a/operator +++ b/operator @@ -1 +1 @@ -Subproject commit e4d3cd6a2f01ebb1e69e5662b5d3683323c3db21 +Subproject commit 7d0fe5c32e8c387489e69bad32d5f7a3913a31c1 diff --git a/web b/web index 586b7ff72..815ac815b 160000 --- a/web +++ b/web @@ -1 +1 @@ -Subproject commit 586b7ff72d7551163de5d92c258dceb66df130b8 +Subproject commit 815ac815b39887ddcc6b80991ba8d88de1cf90a0