Skip to content

Commit

Permalink
chore: updates api, operator, and kubelet-metrics-reexporter
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder17 committed Aug 7, 2024
1 parent 35c5736 commit a429608
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 31 deletions.
76 changes: 48 additions & 28 deletions .github/workflows/kubelet-metrics-reexporter.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,74 @@
name: build kubelet metrics reexporter

on:
workflow_call:

permissions:
contents: read
packages: write

jobs:
kubelet-metrics-reexporter:
release:
runs-on: ubuntu-latest
name: kubelet-metrics-reexporter
env:
SUBMODULE: kubelet-metrics-reexporter

permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: docker setup
uses: nxtcoder17/actions/.github/actions/setup-docker@main
with:
submodules: recursive
docker_username: ${{ github.actor }}
docker_password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Build Environment
id: setup
uses: ./.github/actions/setup/
- name: use nix flakes
uses: nxtcoder17/actions/.github/actions/setup-nix-cachix@main
working-directory: ./kubelet-metrics-reexporter
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
flake_lock: ./flake.lock
nix_develop_arguments: ".#default"

enable_go: true
go_mod_file: ${{ env.SUBMODULE }}/go.mod
go_sum_file: ${{ env.SUBMODULE }}/go.sum
go_build_cache_key: ${{env.SUBMODULE}}
cachix_cache_name: "kloudlite"
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}

enable_task: true
enable_upx: true
- name: go cache
uses: nxtcoder17/actions/.github/actions/setup-cache-go@gh-actions/tricks
working-directory: ./kubelet-metrics-reexporter
with:
cache_key: "kubelet-metrics-reexporter"

enable_docker: true
- name: generate image tag
uses: nxtcoder17/actions/.github/actions/generate-image-tag@gh-actions/tricks

- name: Build & Push Kubelet Metrics ReExporter
- name: Building Binary
working-directory: ./kubelet-metrics-reexporter
env:
IMAGE_TAG: ${{ steps.setup.outputs.image_tag }}
OVERRIDE_PUSHED_IMAGE: ${{ steps.setup.outputs.override_pushed_image }}
CGO_ENABLED: 0
run: |
pushd $SUBMODULE
task build out=kubelet-metrics-reexporter GOARCH=$(go env GOARCH)
- name: Build And Push Image
working-directory: ./kubelet-metrics-reexporter
if: ${{ env.IMAGE_TAG != '' }}
# if: startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/tags/')
run: |+
set +e
image=ghcr.io/${{ github.repository }}/$SUBMODULE:$IMAGE_TAG
echo "building image: $image"
image_name="ghcr.io/${{ github.repository }}"
docker manifest inspect $image
docker manifest inspect $image_name:$IMAGE_TAG
exit_status=$?
if [ $exit_status -eq 0 ]; then
[ "$OVERRIDE_PUSHED_IMAGE" = "false" ] && echo "image ($image) already exists, and override image is disable, exiting" && exit 0
[ "$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
task docker:build-n-push Image="$image"
popd
task container:build-and-push image="$image_name:$IMAGE_TAG"

0 comments on commit a429608

Please sign in to comment.