Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Image Build

on:
push:
branches:
- main
# configure manual trigger
workflow_dispatch:

Expand All @@ -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
8 changes: 4 additions & 4 deletions ci/Containerfile.helm
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions helm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down