Merge pull request #1695 from runcom/abstract-release-tool
cmd: containerd-release: abstract it out to create a new project
This commit is contained in:
commit
5fb3a0e0cf
@ -8,6 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func build() error {
|
func build() error {
|
||||||
@ -18,10 +19,10 @@ func build() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const tarFormat = "containerd-%s.%s-%s.tar.gz"
|
const tarFormat = "%s-%s.%s-%s.tar.gz"
|
||||||
|
|
||||||
func tarRelease(tag string) (string, error) {
|
func tarRelease(projectName, tag string) (string, error) {
|
||||||
path := fmt.Sprintf(tarFormat, tag, runtime.GOOS, runtime.GOARCH)
|
path := fmt.Sprintf(tarFormat, strings.ToLower(projectName), tag, runtime.GOOS, runtime.GOARCH)
|
||||||
out, err := exec.Command("tar", "-zcf", path, "bin/").CombinedOutput()
|
out, err := exec.Command("tar", "-zcf", path, "bin/").CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("%s: %s", err, out)
|
return "", fmt.Errorf("%s: %s", err, out)
|
||||||
|
@ -33,6 +33,8 @@ type download struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type release struct {
|
type release struct {
|
||||||
|
ProjectName string `toml:"project_name"`
|
||||||
|
GithubRepo string `toml:"github_repo"`
|
||||||
Commit string `toml:"commit"`
|
Commit string `toml:"commit"`
|
||||||
Previous string `toml:"previous"`
|
Previous string `toml:"previous"`
|
||||||
PreRelease bool `toml:"pre_release"`
|
PreRelease bool `toml:"pre_release"`
|
||||||
@ -49,10 +51,10 @@ type release struct {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "containerd-release"
|
app.Name = "release"
|
||||||
app.Description = `release tooling for containerd.
|
app.Description = `release tooling.
|
||||||
|
|
||||||
This tool should be ran from the root of the containerd repository for a new release.
|
This tool should be ran from the root of the project repository for a new release.
|
||||||
`
|
`
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
@ -61,7 +63,6 @@ This tool should be ran from the root of the containerd repository for a new rel
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
app.Action = func(context *cli.Context) error {
|
app.Action = func(context *cli.Context) error {
|
||||||
logrus.Info("Welcome to the containerd release tool...")
|
|
||||||
var (
|
var (
|
||||||
path = context.Args().First()
|
path = context.Args().First()
|
||||||
tag = parseTag(path)
|
tag = parseTag(path)
|
||||||
@ -70,6 +71,7 @@ This tool should be ran from the root of the containerd repository for a new rel
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
logrus.Info("Welcome to the %s release tool...", r.ProjectName)
|
||||||
previous, err := getPreviousDeps(r.Previous)
|
previous, err := getPreviousDeps(r.Previous)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
const releaseNotes = `Welcome to the release of containerd {{.Version}}!
|
const releaseNotes = `Welcome to the release of {{.ProjectName}} {{.Version}}!
|
||||||
{{if .PreRelease}}
|
{{if .PreRelease}}
|
||||||
*This is a pre-release of containerd*
|
*This is a pre-release of {{.ProjectName}}*
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
|
||||||
{{.Preface}}
|
{{.Preface}}
|
||||||
|
|
||||||
Please try out the release binaries and report any issues at
|
Please try out the release binaries and report any issues at
|
||||||
https://github.com/containerd/containerd/issues.
|
https://github.com/{{.GithubRepo}}/issues.
|
||||||
|
|
||||||
{{range $note := .Notes}}
|
{{range $note := .Notes}}
|
||||||
### {{$note.Title}}
|
### {{$note.Title}}
|
||||||
@ -28,7 +28,7 @@ https://github.com/containerd/containerd/issues.
|
|||||||
|
|
||||||
### Dependency Changes
|
### Dependency Changes
|
||||||
|
|
||||||
Previous release can be found at [{{.Previous}}](https://github.com/containerd/containerd/releases/tag/{{.Previous}})
|
Previous release can be found at [{{.Previous}}](https://github.com/{{.GithubRepo}}/releases/tag/{{.Previous}})
|
||||||
{{range $dep := .Dependencies}}
|
{{range $dep := .Dependencies}}
|
||||||
* {{$dep.Previous}} -> {{$dep.Commit}} **{{$dep.Name}}**
|
* {{$dep.Previous}} -> {{$dep.Commit}} **{{$dep.Name}}**
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# commit to be tagged for new release
|
# commit to be tagged for new release
|
||||||
commit = "HEAD"
|
commit = "HEAD"
|
||||||
|
|
||||||
|
project_name = "containerd"
|
||||||
|
github_repo = "containerd/containerd"
|
||||||
|
|
||||||
# previous release
|
# previous release
|
||||||
previous = "v1.0.0-beta.1"
|
previous = "v1.0.0-beta.1"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user