Skip to content

Commit 000d07c

Browse files
authored
Merge pull request #119 from infosiftr/dry-run-progress
Update deploy to have output during dry-run too
2 parents 94e9f37 + d3a9bdd commit 000d07c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cmd/deploy/main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ func main() {
221221
defer lock.(*sync.RWMutex).RUnlock()
222222
}
223223

224+
logText := ref.StringWithKnownDigest(refsDigest) + logSuffix
225+
fmt.Fprintln(os.Stderr, startedPrefix+logText)
226+
224227
if dryRun {
225228
needsDeploy, err := normal.dryRun(ctx, ref)
226229
if err != nil {
@@ -235,10 +238,13 @@ func main() {
235238
panic(err) // TODO exit in a more clean way (we can't use "os.Exit" because that causes *more* errors 😭)
236239
}
237240
dryRunOut <- j
241+
242+
// https://github.com/docker-library/meta-scripts/pull/119#discussion_r1978375608 -- "failure" here because we would've pushed, but the configuration (--dry-run) blocks us from doing so
243+
fmt.Fprintln(os.Stderr, failurePrefix+logText)
244+
} else {
245+
fmt.Fprintln(os.Stderr, successPrefix+logText)
238246
}
239247
} else {
240-
logText := ref.StringWithKnownDigest(refsDigest) + logSuffix
241-
fmt.Println(startedPrefix + logText)
242248
desc, err := normal.do(ctx, ref)
243249
if err != nil {
244250
fmt.Fprintf(os.Stderr, "%s%s -- ERROR: %v\n", failurePrefix, logText, err)
@@ -247,7 +253,8 @@ func main() {
247253
if ref.Digest == "" && refsDigest == "" {
248254
logText += "@" + string(desc.Digest)
249255
}
250-
fmt.Println(successPrefix + logText)
256+
257+
fmt.Fprintln(os.Stderr, successPrefix+logText)
251258
}
252259
}
253260
if parallel {

0 commit comments

Comments
 (0)