Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ licenses: .bin/licenses node_modules # checks open-source licenses
docker:
docker build -f .docker/Dockerfile-build -t oryd/ory:latest-sqlite .

# Dummy target for ory/ci pipeline to run after a release has been made. Needs to exist or release pipeline fails.
.PHONY: post-release
post-release:
echo "nothing to do"

node_modules: package-lock.json
npm ci
touch node_modules
5 changes: 4 additions & 1 deletion cmd/cloudx/testhelpers/testhelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ func NewPage(t testing.TB, browser playwright.Browser) playwright.Page {
require.NoError(t, page.Context().Route(func(actual string) bool {
return strings.Contains(actual, route)
}, func(r playwright.Route) {
require.NoError(t, r.Abort())
// Best-effort: the page may already be closed during teardown, in
// which case Abort returns "target closed" for a request we no
// longer care about. Failing the test here races test completion.
_ = r.Abort()
}))
}
return page
Expand Down
36 changes: 31 additions & 5 deletions cmd/pkg/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import (

const GitCommitMessagePreviousVersion = "Bumps from"

// stdin is shared across all prompts. Creating a fresh bufio.Reader per prompt
// discards read-ahead input, which breaks piped stdin and typed-ahead answers.
var stdin = bufio.NewReader(os.Stdin)

func NewCommand(name string, args ...string) *exec.Cmd {
_, _ = fmt.Fprintf(os.Stderr, "$ %s %s\n", name, strings.Join(args, " "))
ec := exec.Command(name, args...)
Expand Down Expand Up @@ -43,9 +47,8 @@ func GitTagRelease(dir string, annotate, dry bool, nextVersion semver.Version, p
Check(NewCommandIn(dir, "git", gitArgs...).Run())

if annotate {
tag := NewCommandIn(dir, "git", "tag", fmt.Sprintf("v%s", nextVersion.String()), "-a")
tag.Stdin = os.Stdin
Check(tag.Run())
message := promptTagMessage(nextVersion)
Check(NewCommandIn(dir, "git", "tag", fmt.Sprintf("v%s", nextVersion.String()), "-a", "-m", message).Run())
} else {
Check(NewCommandIn(dir, "git", "tag", fmt.Sprintf("v%s", nextVersion.String())).Run())
}
Expand All @@ -64,11 +67,34 @@ func GitClone(repo string) string {
return dest
}

// promptTagMessage reads the annotated tag message from stdin. Opening
// $EDITOR instead is not safe here: handing the inherited terminal to vim
// mid-run can leave the terminal in a broken state and subsequent stdin
// reads fail with EOF.
func promptTagMessage(version semver.Version) string {
fmt.Printf("Enter the tag message for v%s. Finish with an empty line:\n> ", version.String())
var lines []string
for {
line, err := stdin.ReadString('\n')
Check(err)

line = strings.TrimRight(line, "\r\n")
if line == "" {
if len(lines) > 0 {
return strings.Join(lines, "\n")
}
fmt.Print("The tag message must not be empty.\n> ")
continue
}
lines = append(lines, line)
fmt.Print("> ")
}
}

func Confirm(message string, args ...interface{}) {
for {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("%s [y/n] ", fmt.Sprintf(message, args...))
answer, err := reader.ReadString('\n')
answer, err := stdin.ReadString('\n')
Check(err)

answer = strings.TrimSpace(answer)
Expand Down
Loading