Skip to content

The state of pkg/patch #1312

@saschagrunert

Description

@saschagrunert

The only reason why we still ship the ./relnotes script is the presence of pkg/patch/internal, wich is a golang wrapper to the previous bash implementation:

func (r *ReleaseNoter) GetMarkdown() (string, error) {
binPath, err := filepath.Abs(filepath.Join(r.ReleaseToolsDir, "relnotes"))
if err != nil {
return "", fmt.Errorf("could not determine current working directory")
}
r.Logger().WithField("binpath", binPath).Debug("binpath set")
cmd := r.CommandCreator.create(
"bash", "-c", fmt.Sprintf(relnoteScript, binPath),
)
if cmd == nil {
return "", fmt.Errorf("command is nil")
}
r.Logger().Debug("command created")
cmd.SetDir(r.K8sDir)
cmd.SetEnv([]string{
"GITHUB_TOKEN=" + r.GithubToken,
})
r.Logger().WithField("workdir", r.K8sDir).Info("starting release notes gatherer ... this may take a while ...")
s, eerr := cmdOutput(cmd)
if eerr != nil {
r.Logger().WithError(eerr).Debug("execing & getting output failed")
r.Logger().WithField("error", eerr.FullError()).Trace("full exec error")
return "", eerr
}
return s, nil
}

This code is mainly used by krel patch-announce. This leaves us in an undefined state when it comes to removing the code duplication inside this repository. krel patch-announce is not used by the release engineering right now, whereas in the future we can utilize krel announce for patch and minor releases in the same way.

I'm wondering how we should move forward with this kind of issue, since I'd like to move forward in removing parts of the bash scripts for sake of better maintainability.

/cc @hoegaarden

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/release-engIssues or PRs related to the Release Engineering subprojectkind/featureCategorizes issue or PR as related to a new feature.needs-prioritysig/releaseCategorizes an issue or PR as relevant to SIG Release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions