-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Retry Bitrise Pipeline
The purpose of this document is to show anyone who works within Bitrise to do the following common tasks:
- identify issues reported,
- (re)trigger builds
- unblock common issues. Bitrise grants us the ability to identify common causes of errors and permits reruns targeting failing workflows.
This section illustrates the common failures that could occur at different stages in the pipeline and how we could investigate those failures. Every PR must pass Bitrise before merging.
This stage performs the following:
- Builds the app (Firefox or Focus)
- Identifies lint issues
- Finds warnings
- Runs unit tests
Here is an example pipeline that fails at build_applications and no workflows from run_tests are run.
This stage could fail due to one of the steps or Bitrise related issues.
You can determine the cause of the failure by opening the logs:
- Click the workflow’s name (
firefox_configure_build
orfocus_configure_build
). - Open the Tests tab for any unit test failures.
- Click Build Log for information for build failures, Swiftlint failures and any Bitrise errors.
The same steps could be applied for focus_configure_build.
The same steps could be applied for focus_configure_build
.
- Ensure the supported version of Xcode is installed and invoked. See README of the repository for the currently supported version.
$ xcodebuild -version
- Build the app using the command line.
$ cd firefox-ios/ $ xcodebuild build-for-testing -project Client.xcodeproj -scheme Fennec -configuration Fennec -sdk iphonesimulator -destination 'platform=iOS Simulator,name=<device>,OS=<iOS version>'
- Run
swiftlint
on the command line.
- Run the unit tests in question using the command line.
$ cd firefox-ios/ $ xcodebuild test -target Client -scheme Fennec -destination 'platform=iOS Simulator,name=<device>,OS=<version>' -only-testing:<test>
- If the unit tests in question passes, run the same tests repeatedly.
$ xcodebuild test -target Client -scheme Fennec -destination 'platform=iOS Simulator,name=<device>,OS=<version>' -test-iterations 100 -only-testing:<test>
If the unrelated unit tests fail intermittently, please retrigger the pipeline (see Retrigger the complete pipeline).
For any issues that are not covered above, please message @mobiletest on Slack.
run_tests
consists of the XCUITest in the Smoke Tests suite running in parallel. The smoke tests consist of the key functionalities of the app.
- Click the failed workflow’s name under run_tests from the pipeline’s page.
- Identify the test’s name.
- You could also click the View Test Reports button to open up the Test Reports. From there you can get more detailed information about the error.
- Run the particular test using command line command locally.
For this example, the file would be
xcodebuild test -target Client -scheme Fennec -destination 'platform=iOS Simulator,name=<device>,OS=<version>' -only-testing:XCUITests/<file>/<test> -test-plan Smoketest<number>
CreditCardsTest
s and the test would betestAutofillCreditCardsToggleOnOff
. - For more information on the test failure reported by Bitrise, you may check the Build log. Scroll down to read the relevant section of the log.
. - If the smoke test passes locally on your computer, please rebuild the unsuccessful workflow instead of rebuilding the whole pipeline.
In the event that the issue persists, please ping @mobiletest on Slack if you are unsure.
We can re-run the failing pipeline or workflow without committing a change to the branch.
If one of the workflows for smoke tests fails, you may run just the failed workflow. (See Test Retries for an explanation on how we handle intermittently failing tests.)
- Open the pipeline’s page on Bitrise.
- Open the Rebuild dropdown menu and select Rebuild unsuccessful Workflows.
- Open Bitrise Firefox iOS page. Locate the Manual Approval Builds section.
- Click Approve and run Build button for your PR.
⛔Important: Please do not re-run any part of the builds via Github. These links from Github do not invoke Bitrise properly.
If the pipeline fails on build_applications
or earlier, you may retrigger the whole pipeline. An example use would be when a unit test fails intermittently.
- Open the pipeline’s page on Bitrise.
- Open the Rebuild dropdown menu and select Rebuild entire Pipeline.
- Go back to Bitrise Firefox iOS page. Locate the _Manual Approval Builds section.
- Click Approve and run Build button for your PR.
⛔Important: Please do not re-run any part of the builds via Github. These links do not invoke Bitrise properly.
If the Bitrise pipeline fails before the stages are run, there may be a syntax error in the bitrise.yml
file. We can do a sanity check on this file by using Bitrise CLI.
- Install bitrise using brew:
brew update && brew install bitrise
. - Run bitrise validate bitrise.yml.
UI tests could be flaky due to its complexity, the nature of the framework and the external assets outside our control.
In order to prevent flaky issues, we have set up a re-try mechanism.
If a test fails, it runs again up to 3 times. Once it passes, Bitrise general check will be green ✅ and the PR unblocked to be merged.
NOTE that the github check when there is a re-try is not updated and remains red. However, the test run in Bitrise is green as well as the general check.
If the UI test fails 3 out of 3 times, both the test run check is red and the Bitrise general check. This will block the PR to be merged.
At this point, it will be necessary to debug the test and understand why the changes in the PR are causing its failure.
Please feel free to contact @mobiletest whenever you are in this situation and you are unsure about what to do.
When a PR is created, the PR may need approval to run Bitrise. From the Bitrise Firefox iOS page on Bitrise, you may click Approve and run Build button for the PR’s entry to start a build.
If the Manual approval builds button does not appear or does not work for some reason, you may close and reopen the PR or fetch the changes from main to the branch.
- Go to the PR’s page on Github.
- Write a brief comment and click Close pull request.
- Write a brief comment and click Reopen pull request.
- Go to Bitrise Firefox iOS page on Bitrise. Scroll down to the list of running and recent pipelines to ensure that the pipeline is running.
- Open a terminal.
-
cd
to the Firefox iOS repository. - Merge the latest changes from main to your branch.
- Go to the Bitrise Firefox iOS page on Bitrise.
- Scroll down to the list of running and recent pipelines to ensure that the pipeline is running.