Skip to content

Commit

Permalink
Not needed?
Browse files Browse the repository at this point in the history
  • Loading branch information
abrisco committed Oct 30, 2024
1 parent 8f0ac93 commit 4e6cb40
Showing 1 changed file with 1 addition and 45 deletions.
46 changes: 1 addition & 45 deletions helm/private/registrar/registrar.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package main

import (
"archive/tar"
"bufio"
"bytes"
"compress/gzip"
"flag"
"fmt"
"log"
Expand All @@ -13,7 +10,6 @@ import (
"strings"

"github.com/bazelbuild/rules_go/go/runfiles"
"gopkg.in/yaml.v3"
)

// Chart represents the structure of Chart.yaml
Expand All @@ -40,40 +36,6 @@ func readArgsFromFile(filepath string) ([]string, error) {
return args, nil
}

func extractChartVersion(chartPath string) (string, error) {
file, err := os.Open(chartPath)
if err != nil {
return "", fmt.Errorf("failed to open chart file: %w", err)
}
defer file.Close()

gzr, err := gzip.NewReader(file)
if err != nil {
return "", fmt.Errorf("failed to create gzip reader: %w", err)
}
defer gzr.Close()

tr := tar.NewReader(gzr)
for {
header, err := tr.Next()
if err != nil {
return "", fmt.Errorf("failed to read tar file: %w", err)
}
if header.Typeflag == tar.TypeReg && strings.HasSuffix(header.Name, "Chart.yaml") {
var chartData bytes.Buffer
if _, err := chartData.ReadFrom(tr); err != nil {
return "", fmt.Errorf("failed to read Chart.yaml: %w", err)
}

var chart Chart
if err := yaml.Unmarshal(chartData.Bytes(), &chart); err != nil {
return "", fmt.Errorf("failed to parse Chart.yaml: %w", err)
}
return chart.Version, nil
}
}
}

func getRunfile(runfile_path string) string {

runfiles, err := runfiles.New()
Expand Down Expand Up @@ -134,12 +96,6 @@ func main() {
}
}

// Extract the chart version
version, err := extractChartVersion(chartPath)
if err != nil {
log.Fatalf("Failed to extract chart version: %v", err)
}

// Subprocess image pushers
for _, pusher := range imagePushers {
cmd := exec.Command(pusher)
Expand All @@ -153,7 +109,7 @@ func main() {
}

// Subprocess helm push
pushCmd := exec.Command(helmPath, "push", chartPath, *registryURL, "--version", version)
pushCmd := exec.Command(helmPath, "push", chartPath, *registryURL)
pushCmd.Stdout = os.Stdout
pushCmd.Stderr = os.Stderr

Expand Down

0 comments on commit 4e6cb40

Please sign in to comment.