Skip to main content

gg_multi_maintain 0.1.0 copy "gg_multi_maintain: ^0.1.0" to clipboard
gg_multi_maintain: ^0.1.0 copied to clipboard

Runs maintenance tasks like SDK, DNA and dependency upgrades in all ocean repos in parallel and publishes every changed repo.

gg_multi_maintain #

English | Deutsch

CI pub package

Runs maintenance tasks like SDK, DNA and dependency upgrades in all ocean repos in parallel and publishes every changed repo.

Motivation #

A gg workspace holds a hundred repos in its ocean. Raising the Dart SDK, pulling in a new DNA layer or upgrading the dependencies used to mean a ticket per repo, or one huge ticket whose dependency hull dragged every repo in. gg do maintain does such routine work for the whole ocean in one call:

  • every repo gets its own fresh clone and branch, the ocean stays as it is
  • the repos run in parallel, but a repo waits for the repos it depends on, so an upgrade sees the versions the same run just released
  • every changed repo is committed and published on its own with gg one do publish, with all checks and tests of gg one do commit
  • a failing repo only stops the repos that depend on it

Installation #

gg do maintain comes with gg:

dart pub global activate gg

Usage #

Run it at the root of a gg workspace and choose at least one task:

gg do maintain --upgrade-sdk                 # Dart SDK and Node constraints
gg do maintain --upgrade-dna                 # the DNA layers, then regenerate
gg do maintain --upgrade-deps                # compatible dependency upgrades
gg do maintain --upgrade-deps --major        # also across major versions
gg do maintain --nightly                     # the nightly build
gg do maintain --all --org ggsuite --dry-run # see what would change
Option Meaning
--upgrade-sdk Raises environment: sdk: to the installed Dart and engines.node to the installed Node
--upgrade-deps Upgrades the dependencies to the newest compatible versions
--major With --upgrade-deps: allows major version jumps
--upgrade-dna Upgrades the DNA layers and the helix engine, then regenerates the DNA
--all All tasks above
--nightly The nightly build: --upgrade-deps --major, see below
-j, --jobs How many repos run at the same time, default 4
--org, --repo Limit the run, e.g. --org tssuite or --repo 'gg_*'
--version-increment patch, minor or major for every repo
--no-pana Skip pana before publishing Dart packages
-n, --dry-run Apply the tasks and report the changes, without commit and publish

The example prints the help of the command:

import 'package:args/command_runner.dart' show CommandRunner;
import 'package:gg_multi_maintain/gg_multi_maintain.dart';

Future<void> main() async {
  final runner = CommandRunner<void>('gg', 'Maintains the ocean.')
    ..addCommand(DoMaintain(ggLog: print));
  await runner.run(['help', 'maintain']);
}

At the end, the command prints a summary like this:

Published (2):
  ggsuite/gg_hash: 3.1.5
  ggsuite/gg_json: 2.4.1
Unchanged (1):
  ggsuite/gg_log
Skipped (1):
  ggsuite/testproject_gg_1: a test project

Nightly build #

Commit, push and publish of a ticket upgrade no dependency. New versions, major versions included, reach the ocean through one run every night:

gg do maintain --nightly

It raises the dependencies of every repo across major versions and publishes every changed repo without a review — it changes versions, no code. A repo whose checks or tests fail after the upgrade is not published, and nothing is published on top of it: the repos depending on it are blocked. The run then exits with an error and writes <workspace>/.maintain/<run id>/report.txt: which repo failed, in which step, why, and where its clone and log are. Fix the repo in a ticket; the next night picks up where this one stopped.

Set up the computer of the nightly build #

The nightly build runs on a computer of its own, not on a developer's machine and not on GitHub:

  1. Install Dart, Flutter (for Flutter repos), Node with pnpm, git and the GitHub CLI, then gg: dart pub global activate gg

  2. Sign in once, with an account that may push to main through pull requests and publish the packages:

    • gh auth login — pull requests and their merge
    • dart pub login — uploads to pub.dev
    • an npm access token that may publish without a one-time password, in ~/.npmrc (//registry.npmjs.org/:_authToken=<token>) — a run without a terminal cannot answer a one-time password prompt
  3. Create a workspace with the ocean of the organizations, e.g. C:\nightly\.ocean, as on a developer machine. gg do upgrade ocean brings in the repos created since

  4. Schedule the run at night, from the workspace root. On Windows:

    schtasks /create /tn gg-nightly /sc daily /st 02:00 /tr "cmd /c cd /d C:\nightly && gg do maintain --nightly > nightly.log 2>&1"
    

    On Linux or macOS, as a line of the crontab:

    0 2 * * * cd ~/nightly && gg do maintain --nightly > nightly.log 2>&1
    
  5. Read nightly.log and, after a failed night, the report.txt it names

Limitations #

  • Test projects, private packages and repos without a remote are skipped. A package that was never published is skipped too, because its first version is published by hand.
  • npm publishes may ask for a one-time password, so they run one at a time. pnpm's minimum release age can hold back a version that the same run has just published.
  • Only lock files or gg's state in .gg/ changed? Then the repo counts as unchanged and is not published.

How it works #

Each run gets a folder <workspace>/.maintain/<run id>/<org>/<repo>. The pipeline of a repo is: clone, skip it if it was never published, create the branch maintain_<run id>, install, run the tasks, detect the changes, gg one do commit, gg one do publish, delete the clone. The version increment is minor when a regular dependency jumps across its old constraint, otherwise patch. A failed clone stays in the run folder with its log.

Status #

Before 1.0 — the options may change between minor versions.

Contributing #

See the Develop Guide.

License #

MIT — see LICENSE.

0
likes
0
points
836
downloads

Publisher

verified publisherinlavigo.com

Weekly Downloads

Runs maintenance tasks like SDK, DNA and dependency upgrades in all ocean repos in parallel and publishes every changed repo.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, gg_args, gg_console_colors, gg_lang, gg_local_package_dependencies, gg_log, gg_multi_core, gg_one, gg_process, gg_publish, path, pub_semver, yaml

More

Packages that depend on gg_multi_maintain