From 747b4f0c937c766a534dc9c0a671fe252e1c5479 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Wed, 21 May 2025 12:50:03 +0200 Subject: [PATCH 1/3] build: add action to build the container image (dev) --- .github/workflows/build.yaml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..3ea61e3 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,67 @@ +name: Build dev version + +on: + push: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build-image: + runs-on: ubuntu-24.04 + outputs: + image: ${{ steps.docker_image.outputs.image }} + image_repository: ${{ steps.docker_image.outputs.image_repository }} + image_tag: ${{ steps.docker_image.outputs.image_tag }} + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Docker image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: type=sha + - name: Extract Docker image name + id: docker_image + env: + IMAGE_TAGS: ${{ steps.meta.outputs.tags }} + run: | + IMAGE=$(echo "$IMAGE_TAGS" | cut -d" " -f1) + IMAGE_REPOSITORY=$(echo "$IMAGE" | cut -d":" -f1) + IMAGE_TAG=$(echo "$IMAGE" | cut -d":" -f2) + echo "image=$IMAGE" >> "$GITHUB_OUTPUT" + echo "image_repository=$IMAGE_REPOSITORY" >> "$GITHUB_OUTPUT" + echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT" + - name: Set up Docker buildx + uses: docker/setup-buildx-action@v3 + - name: Set up Docker + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ steps.docker_image.outputs.image_repository }}:buildcache + cache-to: type=registry,ref=${{ steps.docker_image.outputs.image_repository }}:buildcache,mode=max From 9ca19d1b53ddddcb4cc825146d7baf166b9cb993 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Thu, 22 May 2025 09:14:21 +0200 Subject: [PATCH 2/3] try build dev chart --- .github/workflows/build.yaml | 53 +++++++++++++++++++++++++++++++++++ deploy/csi-rclone/Chart.yaml | 2 +- deploy/csi-rclone/values.yaml | 14 ++++----- 3 files changed, 60 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3ea61e3..67fc4b0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,10 +2,12 @@ name: Build dev version on: push: + # manual- env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + CHART_NAME: ${{ github.repository }}/helm-chart defaults: run: @@ -65,3 +67,54 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=registry,ref=${{ steps.docker_image.outputs.image_repository }}:buildcache cache-to: type=registry,ref=${{ steps.docker_image.outputs.image_repository }}:buildcache,mode=max + + build-chart: + runs-on: ubuntu-24.04 + needs: [build-image] + outputs: + chart: ${{ steps.helm_chart.outputs.chart }} + chart_repository: ${{ steps.helm_chart.outputs.chart_repository }} + chart_tag: ${{ steps.helm_chart.outputs.chart_tag }} + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + # - name: Chart metadata + # id: meta + # uses: docker/metadata-action@v5 + # with: + # images: ${{ env.REGISTRY }}/${{ env.CHART_NAME }} + # tags: type=sha + # - name: Extract Helm chart name + # id: helm_chart + # env: + # CHART_TAGS: ${{ steps.meta.outputs.tags }} + # run: | + # CHART=$(echo "$CHART_TAGS" | cut -d" " -f1) + # CHART_REPOSITORY=$(echo "$CHART" | cut -d":" -f1) + # CHART_TAG=$(echo "$CHART" | cut -d":" -f2) + # echo "chart=$CHART" >> "$GITHUB_OUTPUT" + # echo "chart_repository=$CHART_REPOSITORY" >> "$GITHUB_OUTPUT" + # echo "chart_tag=$CHART_TAG" >> "$GITHUB_OUTPUT" + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + - name: Setup Chartpress + run: | + pip install chartpress + - name: Setup Helm + uses: azure/setup-helm@v4.3.0 + - name: Build Helm chart + run: | + IMAGE_REPOSITORY=${{ needs.build-image.outputs.image_repository }} + IMAGE_TAG=${{ needs.build-image.outputs.image_tag }} + helm dep update deploy/csi-rclone + chartpress --image-prefix "${{ env.REGISTRY }}/" --tag $IMAGE_TAG + # helm lint deploy/csi-rclone + helm package deploy/csi-rclone + - name: Helm registry login + run: | + helm registry login ${{ env.REGISTRY }} --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} diff --git a/deploy/csi-rclone/Chart.yaml b/deploy/csi-rclone/Chart.yaml index 5a4f981..dbf12db 100644 --- a/deploy/csi-rclone/Chart.yaml +++ b/deploy/csi-rclone/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: csi-rclone description: A Helm chart for the Rclone CSI type: application -version: 0.2.0 +version: hello appVersion: "0.1.7" diff --git a/deploy/csi-rclone/values.yaml b/deploy/csi-rclone/values.yaml index 5863730..21e1cf4 100644 --- a/deploy/csi-rclone/values.yaml +++ b/deploy/csi-rclone/values.yaml @@ -12,11 +12,10 @@ csiControllerRclone: imagePullPolicy: IfNotPresent rclone: image: - repository: csi-rclone - tag: "latest" + repository: gcr.io/hihi/csi-rclone + tag: "hello" imagePullPolicy: IfNotPresent - resources: - {} + resources: {} # limits: # cpu: 100m # memory: 128Mi @@ -41,11 +40,10 @@ csiNodepluginRclone: - SYS_ADMIN privileged: true image: - repository: csi-rclone - tag: "latest" + repository: gcr.io/hihi/csi-rclone + tag: "hello" imagePullPolicy: IfNotPresent - resources: - {} + resources: {} # limits: # cpu: 100m # memory: 128Mi From cad63123e32670dd6ce06f6ef50a4a32a25843c5 Mon Sep 17 00:00:00 2001 From: Flora Thiebaut Date: Thu, 22 May 2025 09:21:36 +0200 Subject: [PATCH 3/3] revert --- deploy/csi-rclone/Chart.yaml | 2 +- deploy/csi-rclone/values.yaml | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/deploy/csi-rclone/Chart.yaml b/deploy/csi-rclone/Chart.yaml index dbf12db..5a4f981 100644 --- a/deploy/csi-rclone/Chart.yaml +++ b/deploy/csi-rclone/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: csi-rclone description: A Helm chart for the Rclone CSI type: application -version: hello +version: 0.2.0 appVersion: "0.1.7" diff --git a/deploy/csi-rclone/values.yaml b/deploy/csi-rclone/values.yaml index 21e1cf4..5863730 100644 --- a/deploy/csi-rclone/values.yaml +++ b/deploy/csi-rclone/values.yaml @@ -12,10 +12,11 @@ csiControllerRclone: imagePullPolicy: IfNotPresent rclone: image: - repository: gcr.io/hihi/csi-rclone - tag: "hello" + repository: csi-rclone + tag: "latest" imagePullPolicy: IfNotPresent - resources: {} + resources: + {} # limits: # cpu: 100m # memory: 128Mi @@ -40,10 +41,11 @@ csiNodepluginRclone: - SYS_ADMIN privileged: true image: - repository: gcr.io/hihi/csi-rclone - tag: "hello" + repository: csi-rclone + tag: "latest" imagePullPolicy: IfNotPresent - resources: {} + resources: + {} # limits: # cpu: 100m # memory: 128Mi