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:
Phil Estes 2017-10-30 10:23:52 -04:00 committed by GitHub
commit 5fb3a0e0cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 11 deletions

View File

@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"runtime"
"strings"
)
func build() error {
@ -18,10 +19,10 @@ func build() error {
return nil
}
const tarFormat = "containerd-%s.%s-%s.tar.gz"
const tarFormat = "%s-%s.%s-%s.tar.gz"
func tarRelease(tag string) (string, error) {
path := fmt.Sprintf(tarFormat, tag, runtime.GOOS, runtime.GOARCH)
func tarRelease(projectName, tag string) (string, error) {
path := fmt.Sprintf(tarFormat, strings.ToLower(projectName), tag, runtime.GOOS, runtime.GOARCH)
out, err := exec.Command("tar", "-zcf", path, "bin/").CombinedOutput()
if err != nil {
return "", fmt.Errorf("%s: %s", err, out)

View File

@ -33,6 +33,8 @@ type download struct {
}
type release struct {
ProjectName string `toml:"project_name"`
GithubRepo string `toml:"github_repo"`
Commit string `toml:"commit"`
Previous string `toml:"previous"`
PreRelease bool `toml:"pre_release"`
@ -49,10 +51,10 @@ type release struct {
func main() {
app := cli.NewApp()
app.Name = "containerd-release"
app.Description = `release tooling for containerd.
app.Name = "release"
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{
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 {
logrus.Info("Welcome to the containerd release tool...")
var (
path = context.Args().First()
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 {
return err
}
logrus.Info("Welcome to the %s release tool...", r.ProjectName)
previous, err := getPreviousDeps(r.Previous)
if err != nil {
return err

View File

@ -1,14 +1,14 @@
package main
const releaseNotes = `Welcome to the release of containerd {{.Version}}!
const releaseNotes = `Welcome to the release of {{.ProjectName}} {{.Version}}!
{{if .PreRelease}}
*This is a pre-release of containerd*
*This is a pre-release of {{.ProjectName}}*
{{- end}}
{{.Preface}}
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}}
### {{$note.Title}}
@ -28,7 +28,7 @@ https://github.com/containerd/containerd/issues.
### 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}}
* {{$dep.Previous}} -> {{$dep.Commit}} **{{$dep.Name}}**
{{- end}}

View File

@ -1,6 +1,9 @@
# commit to be tagged for new release
commit = "HEAD"
project_name = "containerd"
github_repo = "containerd/containerd"
# previous release
previous = "v1.0.0-beta.1"