diff --git a/.github/workflows/image-build.yml b/.github/workflows/image-build.yml index d4f0638..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: @@ -19,14 +22,14 @@ 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 \ - --registry env:HELM_IMAGE_REGISTRY_URL \ - --repository env:HELM_IMAGE_REGISTRY_REPOSITORY \ - --username env:HELM_IMAGE_REGISTRY_USER \ + --registry ${HELM_IMAGE_REGISTRY_URL} \ + --repository ${HELM_IMAGE_REGISTRY_REPOSITORY} \ + --username ${HELM_IMAGE_REGISTRY_USER} \ --password env:HELM_IMAGE_REGISTRY_PASSWORD diff --git a/ci/Containerfile.helm b/ci/Containerfile.helm index 8b22eaf..cc0e80f 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/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/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_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 # Environment variables ENV \ 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 }