From 8a43eeeaae16324304a6f12e28a409b22c3ddb21 Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 09:34:46 +0200 Subject: [PATCH 1/8] push image to github registry --- .github/workflows/image-build.yml | 8 ++++---- ci/Containerfile.helm | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index d4f0638..a2dca68 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/image-build.yml @@ -19,10 +19,10 @@ jobs: run: dagger functions -m ci/ - name: Build and publish module image env: - HELM_IMAGE_REGISTRY_URL: ${{ secrets.HELM_IMAGE_REGISTRY_URL }} - HELM_IMAGE_REGISTRY_REPOSITORY: ${{ secrets.HELM_IMAGE_REGISTRY_REPOSITORY }} - HELM_IMAGE_REGISTRY_USER: ${{ secrets.HELM_IMAGE_REGISTRY_USER }} - HELM_IMAGE_REGISTRY_PASSWORD: ${{ secrets.HELM_IMAGE_REGISTRY_PASSWORD }} + HELM_IMAGE_REGISTRY_URL: ghcr.io + HELM_IMAGE_REGISTRY_REPOSITORY: ${{ github.repository }}/dagger-module-helm + HELM_IMAGE_REGISTRY_USER: ${{ github.actor }} + HELM_IMAGE_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: | dagger -m ci/ \ call publish \ diff --git a/ci/Containerfile.helm b/ci/Containerfile.helm index 8b22eaf..3542898 100644 --- a/ci/Containerfile.helm +++ b/ci/Containerfile.helm @@ -1,8 +1,8 @@ -FROM registry.access.redhat.com/ubi9:9.5-1745854298 +FROM registry.access.redhat.com/ubi9:9.6-1758184894 ARG HELM_PACKAGE=https://get.helm.sh/helm-v3.18.4-linux-amd64.tar.gz -ARG HELM_UNITTEST_PACKAGE=https://github.com/helm-unittest/helm-unittest/releases/download/v0.7.0/helm-unittest-linux-amd64-0.7.0.tgz -ARG YQ_PACKAGE=https://github.com/mikefarah/yq/releases/download/v4.44.6/yq_linux_amd64.tar.gz +ARG HELM_UNITTEST_PACKAGE=https://github.com/helm-unittest/helm-unittest/releases/download/v1.0.1/helm-unittest-linux-amd64-1.0.1.tgz +ARG YQ_PACKAGE=https://github.com/mikefarah/yq/releases/download/v4.47.2/yq_linux_amd64.tar.gz # Environment variables ENV \ From 88c50d42006a94001201e91dd1ec68aa58eaee5f Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 09:43:38 +0200 Subject: [PATCH 2/8] print for debugging --- ci/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/main.go b/ci/main.go index 69cc13a..0fa4431 100644 --- a/ci/main.go +++ b/ci/main.go @@ -8,6 +8,7 @@ import ( "context" "dagger/ci/internal/dagger" "fmt" + "os" ) type Ci struct{} @@ -62,6 +63,8 @@ func (m *Ci) Publish( reference := fmt.Sprintf("%s/%s:%s", registry, repository, imageTag) + fmt.Fprintf(os.Stdout, registry) + fmt.Fprintf(os.Stdout, reference) // publish to registry ref, err := container. WithRegistryAuth(registry, username, password). From f461c51c4ea31f192a4027b7fea4bf69bbae681d Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 09:46:05 +0200 Subject: [PATCH 3/8] print for debugging --- .github/workflows/image-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index a2dca68..455d7f7 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/image-build.yml @@ -26,7 +26,7 @@ jobs: run: | dagger -m ci/ \ call publish \ - --registry env:HELM_IMAGE_REGISTRY_URL \ - --repository env:HELM_IMAGE_REGISTRY_REPOSITORY \ - --username env:HELM_IMAGE_REGISTRY_USER \ - --password env:HELM_IMAGE_REGISTRY_PASSWORD + --registry ${HELM_IMAGE_REGISTRY_URL} \ + --repository ${HELM_IMAGE_REGISTRY_REPOSITORY} \ + --username ${HELM_IMAGE_REGISTRY_USER} \ + --password ${HELM_IMAGE_REGISTRY_PASSWORD} From 0bddbecc738cb7e64f592a23b7bf5de09110e32a Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 09:47:24 +0200 Subject: [PATCH 4/8] print for debugging --- .github/workflows/image-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index 455d7f7..a398382 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/image-build.yml @@ -29,4 +29,4 @@ jobs: --registry ${HELM_IMAGE_REGISTRY_URL} \ --repository ${HELM_IMAGE_REGISTRY_REPOSITORY} \ --username ${HELM_IMAGE_REGISTRY_USER} \ - --password ${HELM_IMAGE_REGISTRY_PASSWORD} + --password env:HELM_IMAGE_REGISTRY_PASSWORD From ba598eb08867f35fe422c372669bc34107838d0b Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 09:53:58 +0200 Subject: [PATCH 5/8] switch to gihub image --- ci/main.go | 3 --- helm/main.go | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ci/main.go b/ci/main.go index 0fa4431..69cc13a 100644 --- a/ci/main.go +++ b/ci/main.go @@ -8,7 +8,6 @@ import ( "context" "dagger/ci/internal/dagger" "fmt" - "os" ) type Ci struct{} @@ -63,8 +62,6 @@ func (m *Ci) Publish( reference := fmt.Sprintf("%s/%s:%s", registry, repository, imageTag) - fmt.Fprintf(os.Stdout, registry) - fmt.Fprintf(os.Stdout, reference) // publish to registry ref, err := container. WithRegistryAuth(registry, username, password). diff --git a/helm/main.go b/helm/main.go index 8c583fc..6b26658 100644 --- a/helm/main.go +++ b/helm/main.go @@ -14,7 +14,7 @@ import ( "strings" ) -const HELM_IMAGE string = "quay.io/puzzle/dagger-module-helm:latest" +const HELM_IMAGE string = "ghcr.io/puzzle/dagger-module-helm/dagger-module-helm:latest" type Helm struct{} @@ -113,8 +113,8 @@ func (h *Helm) PackagePush( fmt.Fprintf(os.Stdout, "☸️ Helm package and Push") c := dag.Container(). - From("harbor.puzzle.ch/pitc-cicd-public/alpine-base:latest"). - WithDirectory("/helm", directory). + From(HELM_IMAGE). + WithDirectory("/helm", directory, dagger.ContainerWithDirectoryOpts{Owner: "1001"}). WithWorkdir("/helm") version, err := c.WithExec([]string{"sh", "-c", "helm show chart . | yq eval '.version' -"}).Stdout(ctx) if err != nil { @@ -256,12 +256,12 @@ func (h *Helm) doesChartExistOnRepo( } //TODO: Refactor with return - c, err = c.WithExec([]string{"sh", "-c", fmt.Sprintf("helm show chart %s --version %s; echo -n $? > /ec", opts.getChartFqdn(name), version)}).Sync(ctx) + c, err = c.WithExec([]string{"sh", "-c", fmt.Sprintf("helm show chart %s --version %s; echo -n $? > /tmp/ec", opts.getChartFqdn(name), version)}).Sync(ctx) if err != nil { return false, err } - exc, err := c.File("/ec").Contents(ctx) + exc, err := c.File("/tmp/ec").Contents(ctx) if err != nil { return false, err } From b596701bd6c60e6c95b1e11ce6f288e06591be89 Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 10:42:51 +0200 Subject: [PATCH 6/8] update image for new curl version --- ci/Containerfile.helm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Containerfile.helm b/ci/Containerfile.helm index 3542898..587483b 100644 --- a/ci/Containerfile.helm +++ b/ci/Containerfile.helm @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi9:9.6-1758184894 +FROM registry.access.redhat.com/ubi10:10.0-1758699521 ARG HELM_PACKAGE=https://get.helm.sh/helm-v3.18.4-linux-amd64.tar.gz ARG HELM_UNITTEST_PACKAGE=https://github.com/helm-unittest/helm-unittest/releases/download/v1.0.1/helm-unittest-linux-amd64-1.0.1.tgz From 043a9aefa621312a426eac9005ac6c73616e7358 Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 10:50:08 +0200 Subject: [PATCH 7/8] update helm --- ci/Containerfile.helm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/Containerfile.helm b/ci/Containerfile.helm index 587483b..cc0e80f 100644 --- a/ci/Containerfile.helm +++ b/ci/Containerfile.helm @@ -1,6 +1,6 @@ FROM registry.access.redhat.com/ubi10:10.0-1758699521 -ARG HELM_PACKAGE=https://get.helm.sh/helm-v3.18.4-linux-amd64.tar.gz +ARG HELM_PACKAGE=https://get.helm.sh/helm-v3.19.0-linux-amd64.tar.gz ARG HELM_UNITTEST_PACKAGE=https://github.com/helm-unittest/helm-unittest/releases/download/v1.0.1/helm-unittest-linux-amd64-1.0.1.tgz ARG YQ_PACKAGE=https://github.com/mikefarah/yq/releases/download/v4.47.2/yq_linux_amd64.tar.gz From d578cfbf6213c3a2d2c6fe81e484defcaaf4e36a Mon Sep 17 00:00:00 2001 From: Sylvain Gilgen Date: Wed, 24 Sep 2025 10:53:25 +0200 Subject: [PATCH 8/8] trigger image build on main --- .github/workflows/image-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index a398382..2e7b851 100644 --- a/.github/workflows/image-build.yml +++ b/.github/workflows/image-build.yml @@ -1,6 +1,9 @@ name: Image Build on: + push: + branches: + - main # configure manual trigger workflow_dispatch: