Skip to content

Commit 6cc6f29

Browse files
authored
Merge pull request #217 from smoser/bump-constraints-empty-updates
Allow empty constraints file as a placeholder.
2 parents a47349d + be92697 commit 6cc6f29

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pipelines/py/tw/bump-constraints.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ inputs:
55
description: Path to the constraints file to update
66
default: constraints.txt
77
packages:
8-
description: List of package==version pairs to update (newline separated, with optional comments)
8+
description: |
9+
List of package==version pairs to update (newline separated, with optional comments)
10+
Use the string '# future-updates' as a placeholder.
911
required: true
1012
only-replace:
1113
description: Only update packages already in the constraints file (set to false to allow adding new packages)

tw/pkg/commands/bumpconstraints/bumpconstraints.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ func (c *cfg) Run(cmd *cobra.Command) error {
104104

105105
// Check that we have updates to process
106106
if len(c.Packages) == 0 {
107-
return fmt.Errorf("no package updates specified (provide as arguments or use -u/--updates-file)")
107+
contents, err := os.ReadFile(c.UpdatesFile)
108+
placeholder := "# future-updates"
109+
if err == nil && strings.TrimSpace(string(contents)) == placeholder {
110+
log.InfoContextf(ctx, "Constraints file is intentionally empty")
111+
} else {
112+
return fmt.Errorf("no package updates specified (provide as arguments or use -u/--updates-file). Use string '%s' as placeholder", placeholder)
113+
}
108114
}
109115

110116
// Parse package updates from arguments

0 commit comments

Comments
 (0)