bito-code-review[bot] commented on PR #44248:
URL: https://github.com/apache/superset/pull/44248#issuecomment-5674736165

   <!-- Bito Reply -->
   Refactoring the target-detection logic into a helper function is a sound 
approach to improve testability and maintainability. By isolating the logic 
that determines the `TARGET_STAGE` and validates it against the `Dockerfile`, 
you can unit test the fallback behavior (e.g., `superset` -> `lean`), the 
pass-through case, and the refusal logic for unknown mismatches without needing 
to trigger the full `supersetbot` execution in CI.
   
   This would allow you to verify the assembled-command boundary by mocking the 
`supersetbot --dry-run` output and the `Dockerfile` content, ensuring that 
regressions in flag ordering or parsing are caught early.
   
   **.github/workflows/scheduled-docker-image-refresh.yml**
   ```
   # Detect the mismatch by asking supersetbot what it would actually
             # run (--dry-run) and checking the target stage it picked against
             # the Dockerfile actually checked out for this release.
             EXTRA_FLAGS=""
             DRY_RUN_CMD="$(supersetbot docker \
               --preset "$BUILD_PRESET" \
               --context release \
               --context-ref "$LATEST_RELEASE" \
               $FORCE_LATEST_FLAG \
               --platform linux/amd64 \
               --dry-run)"
             TARGET_STAGE="$(grep -oE -- '--target [A-Za-z0-9_.-]+' 
<<<"$DRY_RUN_CMD" | tail -1 | cut -d' ' -f2 || true)"
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to