Kai Ole Hartwig
5 min read
Low
By

No byte without a plan

A tool that writes branches into 200 repositories should be able to say beforehand what it intends. Not as a special case, but every time.

So pinup has an opinion about order: every run first produces a machine-readable plan. The write phase only carries out that plan. It cannot invent a change, only still hold back a planned one, and then with a reason.

01 — The opinion in one sentence

First the plan, then the first written byte.

pinup whatif and pinup run share the same code up to the plan. whatif stops there and needs neither a token nor write access. run carries on: push branches, open merge requests, write the dashboard. It computes the plan before the first write and stores it as JSON at the end, with what happened while writing.

 

pinup whatif --repo . --config .pinup.yaml --report plan.json
jq -r '.branches[] | select(.suppressedBy == null) | .name' plan.json

 

The second line lists the branches the plan does not hold. With a renovate.json, pass it the same way with --config.

02 — The alternative: dry run as a mode

Renovate has a dryRun. It shows in the log what a run would do and writes nothing. That is useful and enough for most setups. You switch it on when you want to check a configuration, and off again.

The difference lies in the normal case. In Renovate the dry run is a mode next to the real run. In pinup the plan is part of every real run, in the same format, from the same code. What I check is exactly what happens next, not a description of it in the log.

03 — The price

Two phases instead of one. The write phase may not invent a change. Whatever it writes, the plan must already contain. That makes every new feature a little more work, because it has to show up in the plan first.

A format as a contract. The plan has a schema version. Other tools read it, so it must not change silently. New fields are added, old ones are meant to stay.

Artefacts on every run. Every run leaves a plan per repository. That costs storage and needs cleaning up.

04 — The occasion

Without a plan I could never have switched pinup on. The shadow mode compared pinup's plans run by run with the merge requests Renovate had open. In my setup Renovate wrote no plan, so its visible output served as the counterpart. A control repository had to yield exactly one difference every time. If it did not, the comparison was broken, not pinup good.

What the plan made possible afterwards

By now the plan is raw material for more than the run itself:

05 — The enforcement

The order lives in the architecture, not in a convention.

Frequently asked questions

Do I need a token for whatif?+

No platform token. whatif works on a checkout and writes nothing. Lookups against public registries work without credentials; private registries need their own.

Can I evaluate the plan in my own pipeline?+

Yes. The plan is JSON with a schema version, and the format is documented in the repository. A jq one-liner, for example, lists every held update with its reason.

What happens if something changes between plan and write?+

The run writes what the plan says. A release that appears afterwards is seen by the next run. Tasks such as regenerating a lock file do run in the write phase. But pinup checks their result against the file scope the plan handed them.

Conclusion

A plan before the first byte costs a second phase and a format that has to stay stable. In return I check what really happens. The same plan fed the shadow comparison, and today it feeds the fast lane and the advice.

Next week: what a change looks like once the plan has decided it. A byte range, not a rewritten file. The overview of all parts and the terms that recur are in the opening of the series.

What would happen in your repositories? I will show you without writing anything.

A plan over your repositories with pinup whatif: which branches would be created, which updates wait and why. Without write access, without changing your existing setup.

Book a call →

About the author

Photo of Kai Ole Hartwig.

Kai Ole Hartwig

Freelance DevSecOps consultant · OnlyOle Consulting

Programming since 2002 – self-taught, set up my own business with KO-Web in 2012. Over 100 projects, with a focus on security, performance, automation and quality. Today freelance: DevSecOps consulting, training and software development.