Skip to content

Commit

Permalink
Merge pull request #4 from ksimon1/remove-upstream-sources
Browse files Browse the repository at this point in the history
feat: remove upstream sources
  • Loading branch information
ksimon1 authored Oct 16, 2024
2 parents 0665f23 + d855bbe commit 65fbdcd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
15 changes: 2 additions & 13 deletions pkg/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,8 @@ func ProcessNewReleases(options *util.Options) {
}

func createNewReleases(newTags map[string]*semver.Version) error {
mapping, err := util.LoadUpstreamSources()
if err != nil {
log.Fatal("err during loading upstream sources: " + err.Error())
}

for _, tag := range newTags {
tektonTaskBranch, err := util.GetTektonTasksBranch(mapping, fmt.Sprintf("%v.%v", tag.Major(), tag.Minor()))
if err != nil {
return err
}

err = generateManifests(tag.Original(), tektonTaskBranch)
err := generateManifests(tag.Original())
if err != nil {
log.Fatal("err during generation of manifests: " + err.Error())
}
Expand All @@ -76,9 +66,8 @@ func createNewReleases(newTags map[string]*semver.Version) error {
return nil
}

func generateManifests(tag, branch string) error {
func generateManifests(tag string) error {
os.Setenv("RELEASE_VERSION", tag)
os.Setenv("RELEASE_BRANCH", branch)
cmd := exec.Command("bash", "-c", "./generate-manifests.sh")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdout
Expand Down
30 changes: 0 additions & 30 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package util

import (
"bufio"
"fmt"
"os"
"strings"
)

type Options struct {
DryRun bool
ExistingTags string
Expand All @@ -15,26 +8,3 @@ type Options struct {
Username string
GitToken string
}

func LoadUpstreamSources() (map[string]string, error) {
file, err := os.Open("upstream_sources.yaml")
if err != nil {
return nil, err
}
fscanner := bufio.NewScanner(file)
upstreamSourcesMapping := make(map[string]string)
for fscanner.Scan() {
line := strings.Split(fscanner.Text(), ":")
upstreamSourcesMapping[line[0]] = line[1]
}
return upstreamSourcesMapping, nil
}

func GetTektonTasksBranch(upstreamSources map[string]string, version string) (string, error) {
var branch string
var ok bool
if branch, ok = upstreamSources[version]; !ok {
return "", fmt.Errorf("There is missing mapping between branch of kubevirt-tekton-tasks and OCP V version " + version)
}
return branch, nil
}
2 changes: 0 additions & 2 deletions upstream_sources.yaml

This file was deleted.

0 comments on commit 65fbdcd

Please sign in to comment.