Skip to content

Add --dry-run flag and workflow_dispatch trigger for Launchpad script#112

Merged
rtibbles merged 4 commits intolearningequality:mainfrom
rtibblesbot:issue-108-b5f1c0
Mar 3, 2026
Merged

Add --dry-run flag and workflow_dispatch trigger for Launchpad script#112
rtibbles merged 4 commits intolearningequality:mainfrom
rtibblesbot:issue-108-b5f1c0

Conversation

@rtibblesbot
Copy link
Contributor

Summary

  • Add a global --dry-run flag to scripts/launchpad_copy.py that applies to all subcommands (copy-to-series, promote, wait-for-builds). When set, read operations execute normally while write operations (copyPackage, syncSources) are replaced with log messages describing what would happen.
  • Add a workflow_dispatch trigger to build_debian.yml with a dry_run boolean input (default true). When triggered with dry-run enabled, the build/upload job and manual approval gate are skipped, and --dry-run is passed to all script invocations.
  • Update README.rst with documentation on Launchpad credentials setup, the automated release workflow, manual dry-run testing, and CLI usage.

References

Reviewer guidance

  • The script changes are in scripts/launchpad_copy.py — review the perform_queued_copies and promote methods for the dry-run guard logic.
  • The workflow changes in .github/workflows/build_debian.yml use if conditions and always() with result checks to handle skipped jobs in the dependency chain. Verify the conditional logic for copy_to_other_distributions and copy_package_from_proposed_to_ppa jobs.
  • To test: trigger the workflow manually from the Actions tab with dry_run: true — it should skip build/upload, run copy-to-series and promote with --dry-run, and skip the approval gate.
  • The check_version job now falls back to the changelog version for workflow_dispatch (no release tag available).
Test evidence

All 62 tests pass (4 skipped due to missing ubuntu-distro-info on non-Ubuntu):

python3 -m pytest tests/ -v
...
62 passed, 4 skipped in 0.27s

Dry-run specific test coverage:

  • TestDryRunPromote::test_dry_run_skips_copy_package — verifies copyPackage is never called
  • TestDryRunPromote::test_dry_run_logs_what_would_be_promoted — verifies DRY-RUN log with package name and version
  • TestDryRunCopyToSeries::test_dry_run_skips_sync_sources — verifies syncSources is never called
  • TestDryRunCopyToSeries::test_dry_run_logs_what_would_be_copied — verifies DRY-RUN log with package name and destination
  • TestDryRunWaitForBuilds::test_dry_run_wait_for_builds_still_works — verifies wait-for-builds works normally (already read-only)
  • TestDryRunIntegration::test_cmd_*_sets_dry_run_on_wrapper — verifies CLI flag threads through to wrapper for all 3 subcommands

Pre-commit linting passes:

pre-commit run --all-files
trim trailing whitespace.................................................Passed
check yaml...............................................................Passed
check for added large files..............................................Passed
fix end of files.........................................................Passed
yamlfmt..................................................................Passed
Lint GitHub Actions workflow files.......................................Passed
ruff check...............................................................Passed
ruff format..............................................................Passed

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

Closes #108

rtibblesbot and others added 3 commits February 22, 2026 14:50
Add a global --dry-run flag that applies to all subcommands
(copy-to-series, promote, wait-for-builds). When set, all read
operations execute normally while write operations (copyPackage,
syncSources) are replaced with log messages describing the action
that would be taken, including package name, version, and
source/destination.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a workflow_dispatch trigger with a dry_run boolean input (default
true) to enable manual end-to-end testing of the publishing workflow.
When dry_run is true: build_package and wait_for_source_builds jobs are
skipped, block_release_step approval gate is skipped, and --dry-run is
passed to all launchpad_copy.py invocations. The check_version job
falls back to the changelog version when no release tag is present.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the outdated Releasing section with comprehensive documentation
covering: automated release workflow steps, Launchpad credentials
generation via create_lp_creds.py, manual dry-run testing via
workflow_dispatch, and launchpad_copy.py CLI usage for all subcommands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your fault, but I think a change in approach would be more informative.

types: [published]
workflow_dispatch:
inputs:
dry_run:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the implementation I am not so sure that this is what is needed.

I think instead we should switch focus slightly and instead make sure each step is robust to the workflow being rerun. So as we are testing the publish workflow with the workflow dispatch, if it fails part way through we can rerun it for the same version after making edits and have it not break because one step succeeded already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — replaced the dry-run approach with idempotent steps. copyPackage and syncSources now handle "already published" errors gracefully (log and skip). The workflow_dispatch trigger no longer has a dry_run input — it just runs the real workflow, and each step is safe to rerun.

…flow

Replace the --dry-run flag approach with idempotent operations so the
workflow can be safely rerun after partial failure. Instead of skipping
write operations, copyPackage and syncSources now handle "already
published" errors gracefully, logging and continuing.

- Remove --dry-run flag from CLI and LaunchpadWrapper
- Add error handling for "same version already published" in promote()
  and perform_queued_copies()
- Simplify workflow_dispatch: remove dry_run input, use event_name checks
- Update README to document rerunnable workflow dispatch behavior
- Replace dry-run tests with idempotency tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rtibblesbot
Copy link
Contributor Author

Addressed 2/2 review items. 0 deferred.

Replaced the --dry-run approach with idempotent operations:

  • promote() and perform_queued_copies() now catch BadRequest errors for "same version already published" and log-and-skip instead of failing
  • Removed --dry-run flag, self.dry_run, and all dry-run conditional logic from the script
  • Simplified workflow_dispatch — removed the dry_run input, using github.event_name checks instead
  • copy_to_series was already idempotent (checks is_missing before queueing)
  • Updated README to document the rerunnable workflow behavior
  • All 52 tests pass (4 skipped), pre-commit clean

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll give this a go!

@rtibbles rtibbles merged commit 432aef4 into learningequality:main Mar 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add default dry run flag to Launchpad script

2 participants