Skip to content

Fix successful uploads reported as failed when altool logs an ERROR line - #507

Open
kevmo314 wants to merge 1 commit into
codemagic-ci-cd:masterfrom
kevmo314:fix-altool-upload-succeeded-detection
Open

kevmo314 wants to merge 1 commit into
codemagic-ci-cd:masterfrom
kevmo314:fix-altool-upload-succeeded-detection

Conversation

@kevmo314

Copy link
Copy Markdown

With Xcode 27, app-store-connect publish reports a successful upload as failed. altool now writes a harmless ERROR: line before the success message:

2026-10-24 04:48:45.654 ERROR: [ContentDelivery.Uploader.7894C51FC0] Failed to create URL for 'CDUploaderStateInfoResumeFilePath'. The file doesn’t exist. (4) The file doesn’t exist.
...
UPLOAD SUCCEEDED with no errors

Altool._run_command is meant to ignore logged errors when the upload succeeded, but it checks with re.match(".*UPLOAD SUCCEEDED.*", stdout). re.match only matches at the start of the string, and . doesn't match newlines, so the check only passes when UPLOAD SUCCEEDED is on the first line of the output. With this Xcode 27 output the command raises AltoolCommandError("[ContentDelivery.Uploader...] Failed to create URL for 'CDUploaderStateInfoResumeFilePath'...") even though the build was delivered.

This PR checks for UPLOAD SUCCEEDED anywhere in the output. Non-zero exit codes and parsed product errors are still handled first and still fail. Output that has ERROR: lines but no success message still fails as before.

Changes:

  • src/codemagic/models/altool/altool.py: replace the re.match check with a substring check.
  • tests/models/altool/mocks/mock_upload_success_with_error_log_stdout_xcode_27_2.txt: real altool 27.10.4 output from an upload that succeeded.
  • tests/models/altool/test_altool.py: new test showing the upload succeeds. It fails without the fix. The new mock is also added to the parse test.
  • Version 0.70.1 and changelog entry.

uv run pytest tests/models/altool, ruff format --check, ruff check and mypy all pass.

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.

1 participant