diff --git a/.github/workflows/online_test_deck.yml b/.github/workflows/online_test_deck.yml index cf3f19b..487f8c4 100644 --- a/.github/workflows/online_test_deck.yml +++ b/.github/workflows/online_test_deck.yml @@ -10,7 +10,7 @@ on: description: 'The ref tag to bundle' required: true prev: - description: 'Use previous ref' + description: 'Use previous plan' type: boolean default: true latest: @@ -38,7 +38,8 @@ jobs: uses: ./. with: ref: 'ghcr.io/ublue-os/bazzite-deck:${{ github.event.inputs.ref }}' - prev-ref: ${{ github.event.inputs.prev == 'true' && 'ghcr.io/hhd-dev/bazzite-automated-deck:stable' || '' }} + prev-ref: ghcr.io/hhd-dev/bazzite-automated-deck:stable + clear-plan: ${{ github.event.inputs.prev == 'true' && '' || '1' }} rechunk: 'ghcr.io/hhd-dev/rechunk:latest' version: 'rc${{ github.event.inputs.ref }}' revision: ${{ github.sha }} diff --git a/3_chunk.sh b/3_chunk.sh index 1230e2e..940e8e7 100755 --- a/3_chunk.sh +++ b/3_chunk.sh @@ -81,6 +81,9 @@ fi if [ -n "$REVISION" ]; then PREV_ARG+=("--revision" "$REVISION") fi +if [ -n "$CLEAR_PLAN" ]; then + PREV_ARG+=("--clear-plan") +fi LABEL_ARR=() if [ -n "$LABELS" ]; then diff --git a/action.yml b/action.yml index 21faf97..292efbc 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,9 @@ inputs: description: | The previous image reference, if any. Used for versioning the current image and to avoid layer shifts (important; may be skipped). + clear-plan: + description: | + If set, a new plan will be recreated. prev-ref-fail: description: | If set, fail if the previous image reference is not found. @@ -169,6 +172,7 @@ runs: -e CHANGELOG="${{ inputs.changelog }}" \ -e OUT_REF="oci:$OUT_NAME" \ -e GIT_DIR="/var/git" \ + -e CLEAR_PLAN="${{ inputs.clear-plan }}" \ -e REVISION="${{ inputs.revision }}" \ -e PREV_REF_FAIL="${{ inputs.prev-ref-fail }}" \ -u 0:0 \ diff --git a/src/rechunk/__main__.py b/src/rechunk/__main__.py index 9122d8c..27e4d94 100644 --- a/src/rechunk/__main__.py +++ b/src/rechunk/__main__.py @@ -87,6 +87,11 @@ def argparse_func(): help="A debug file with the file packaging results.", default=None, ) + parser.add_argument( + "--clear-plan", + help="Use a fresh plan, regardless of previous ref.", + action="store_true", + ) # Hyperparameters group = parser.add_argument_group("Hyperparameters") @@ -139,6 +144,7 @@ def argparse_func(): git_dir=args.git_dir, changelog=args.changelog, changelog_fn=args.changelog_fn, + clear_plan=args.clear_plan, ) diff --git a/src/rechunk/alg.py b/src/rechunk/alg.py index 1f5fd51..b26d85f 100644 --- a/src/rechunk/alg.py +++ b/src/rechunk/alg.py @@ -546,6 +546,7 @@ def main( git_dir: str | None = None, changelog: str | None = None, changelog_fn: str | None = None, + clear_plan: bool = False, ): if not meta_fn: meta_fn = get_default_meta_yaml() @@ -609,6 +610,8 @@ def main( logger.info(f"Update matrix shape: {upd_matrix.shape}.") found_previous_plan = False + manifest_json = None + info = None if previous_manifest: try: logger.info("Loading existing layer data.") @@ -619,10 +622,11 @@ def main( except Exception as e: logger.error(f"Error loading previous manifest:\n{e}") - if not found_previous_plan: - manifest_json = None - info = None - logger.warning("No existing layer data. Expect layer shifts") + if not found_previous_plan or clear_plan: + if clear_plan: + logger.warning("Creating a fresh plan due to --clear-plan.") + else: + logger.warning("No existing layer data. Expect layer shifts") todo, dedi_layers, prefill = prefill_layers( new_packages, upd_matrix, max_layers, prefill_size )