Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

[1.0.gamma] Build-time variables to set url and version of chart #121

Open
wants to merge 2 commits into
base: release-1.0.gamma
Choose a base branch
from
Open
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
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

CHART_VERSION ?= ""
CHART_URL ?= "./charts/trusted-artifact-signer"

LDFLAGS=-X securesign/sigstore-ocp/tas-installer/cmd.helmChartVersion=$(CHART_VERSION) \
-X securesign/sigstore-ocp/tas-installer/cmd.helmChartUrl=$(CHART_URL)

PLATFORMS=darwin linux windows
ARCHITECTURES=amd64 arm64

.PHONY: build
build: build-tas-installer

.PHONY: test
test: test-tas-installer

.PHONY: cross
cross: cross-tas-installer

.PHONY: build-tas-installer
build-tas-installer:
CGO_ENABLED=0 go build -C ./tas-installer -trimpath -ldflags "$(LDFLAGS)" -o ../tas-install

.PHONY: test-tas-installer
test-tas-installer:
cd ./tas-installer && go test ./...

.PHONY: cross-tas-installer
cross-tas-installer:
$(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES), $(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); \
go build -C ./tas-installer -trimpath -ldflags "$(LDFLAGS)" -o ../tas-install-$(GOOS)-$(GOARCH))))

.PHONY: clean
clean:
rm -f tas-install
rm -f tas-install-*
6 changes: 4 additions & 2 deletions tas-installer/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
helmChartVersion string
helmValuesFile string
oidcConfig oidc.OIDCConfig
helmChartUrl = "./charts/trusted-artifact-signer"
)

var installCmd = &cobra.Command{
Expand Down Expand Up @@ -70,7 +71,7 @@ func installTas(tasNamespace string) error {
},
func() error {
log.Print("installing helm chart")
if err := install.HandleHelmChartInstall(kc, oidcConfig, tasNamespace, tasReleaseName, helmValuesFile, helmChartVersion); err != nil {
if err := install.HandleHelmChartInstall(kc, oidcConfig, tasNamespace, tasReleaseName, helmValuesFile, helmChartUrl, helmChartVersion); err != nil {
return err
}
return nil
Expand All @@ -85,11 +86,12 @@ func installTas(tasNamespace string) error {
}

func init() {
installCmd.PersistentFlags().StringVar(&helmChartVersion, "chartVersion", "0.1.26", "Version of the Helm chart")
installCmd.PersistentFlags().StringVar(&helmChartVersion, "chartVersion", helmChartVersion, "Version of the Helm chart")
installCmd.PersistentFlags().StringVar(&helmValuesFile, "valuesFile", "", "Custom values file for chart configuration")
installCmd.PersistentFlags().StringVar(&oidcConfig.IssuerURL, "oidc-issuer-url", "", "Specify the OIDC issuer URL e.g for keycloak: https://[keycloak-domain]/auth/realms/[realm-name]")
installCmd.PersistentFlags().StringVar(&oidcConfig.ClientID, "oidc-client-id", "", "Specify the OIDC client ID")
installCmd.PersistentFlags().StringVar(&oidcConfig.Type, "oidc-type", "", "Specify the OIDC type")
installCmd.PersistentFlags().StringVar(&helmChartUrl, "chartUrl", helmChartUrl, "URL to Trusted Artifact Signer Helm chart")
}

func getFulcioSecretFiles() map[string]string {
Expand Down
4 changes: 2 additions & 2 deletions tas-installer/internal/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"time"
)

func HandleHelmChartInstall(kc *kubernetes.KubernetesClient, oidcConfig oidc.OIDCConfig, tasNamespace, tasReleaseName, helmValuesFile, helmChartVersion string) error {
if err := helm.InstallTrustedArtifactSigner(kc, oidcConfig, tasNamespace, tasReleaseName, helmValuesFile, helmChartVersion); err != nil {
func HandleHelmChartInstall(kc *kubernetes.KubernetesClient, oidcConfig oidc.OIDCConfig, tasNamespace, tasReleaseName, helmValuesFile, helmChartUrl, helmChartVersion string) error {
if err := helm.InstallTrustedArtifactSigner(kc, oidcConfig, tasNamespace, tasReleaseName, helmValuesFile, helmChartUrl, helmChartVersion); err != nil {
return err
}
return nil
Expand Down
3 changes: 1 addition & 2 deletions tas-installer/pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ func UninstallTrustedArtifactSigner(tasNamespace, tasReleaseName string) (*relea
return action.NewUninstall(actionConfig).Run(tasReleaseName)
}

func InstallTrustedArtifactSigner(kc *kubernetes.KubernetesClient, oidcConfig oidc.OIDCConfig, tasNamespace, tasReleaseName, pathToValuesFile, chartVersion string) error {
chartUrl := "charts/trusted-artifact-signer"
func InstallTrustedArtifactSigner(kc *kubernetes.KubernetesClient, oidcConfig oidc.OIDCConfig, tasNamespace, tasReleaseName, pathToValuesFile, chartUrl, chartVersion string) error {

tv := templatedValues{
OpenShiftAppsSubdomain: kc.ClusterCommonName,
Expand Down