Skip to content

Remove unused env vars from fastlane tooling#25771

Open
mokagio wants to merge 5 commits into
trunkfrom
ainfra-2643-remove-unused-env-vars-from-wordpress-ios-tooling
Open

Remove unused env vars from fastlane tooling#25771
mokagio wants to merge 5 commits into
trunkfrom
ainfra-2643-remove-unused-env-vars-from-wordpress-ios-tooling

Conversation

@mokagio

@mokagio mokagio commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Prep work for migrating to https://github.com/Automattic/a8c-secrets. Removes the encrypted project.env which contained unused env vars and env vars that did not need to be secret.

mokagio and others added 5 commits July 10, 2026 14:30
Wraps `Xcodeproj::Config` with the error handling its raw API lacks: a
missing file, a missing key, and a key set to an empty value all raise
rather than silently yielding `nil`.

Uses `to_hash` rather than `attributes`, since the latter only sees the
settings assigned in the file itself, not those it pulls in via
`#include`.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`INT_EXPORT_TEAM_ID` duplicated a value the project already declares:
enterprise and prototype builds use the `Release-Alpha` configuration,
whose `DEVELOPMENT_TEAM` is set in `config/Common.alpha.xcconfig`.
Reading it from there removes one secret from the environment the
tooling needs to be handed.

Note the value also lives in `project.env` in the `mobile-secrets`
repository, where it now has no consumer.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Same reasoning as the internal team ID in the previous commit:
`EXT_EXPORT_TEAM_ID` duplicated the `DEVELOPMENT_TEAM` that
`config/Common.release.xcconfig` already declares for the App Store
builds, which use the `Release` configuration.

With both gone, `project.env` no longer has to carry either team ID.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both call sites authenticate with `api_key`, and pilot only ever reads
`team_id` on the username/password Spaceship path — see
`pilot/lib/pilot/manager.rb:36`, the sole reader of `config[:team_id]` in
the whole of `pilot/lib`, which sits in the `else` branch that an API
token skips.

An App Store Connect API key is issued by a single team, so there is no
team left to disambiguate. `woocommerce-ios` has shipped its TestFlight
uploads without the parameter for this reason.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Every key it carried is now unused: the two export team IDs come from
`xcconfig`, `FASTLANE_ITC_TEAM_ID` was inert alongside an `api_key`, the
Sentry slugs are hardcoded constants in `build.rb`, and the two HockeyApp
IDs outlived the service.

With nothing reading the file, the `before_all` guard demanding it had no
purpose either — which is what the three CI scripts were copying the
example file to satisfy. `configure_apply` creates its destination
directory itself, so nothing else needed that block.

The file still exists in `mobile-secrets`, where it can now be deleted.

---

Generated with the help of Claude Code, https://claude.com/claude-code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mokagio mokagio self-assigned this Jul 10, 2026
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number33099
VersionPR #25771
Bundle IDorg.wordpress.alpha
Commite1b296d
Installation URL6icfask3920pg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number33099
VersionPR #25771
Bundle IDcom.jetpack.alpha
Commite1b296d
Installation URL5inshnp23873g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Comment thread fastlane/lanes/build.rb

upload_to_testflight(
team_id: get_required_env('FASTLANE_ITC_TEAM_ID'),
api_key: app_store_connect_api_key,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Team id is unnecessary thanks to the API key.

See it validated in WooCommerce https://github.com/woocommerce/woocommerce-ios/blob/9b84ea2e77e91cecf8f0ee6d0021f49f75390d24/fastlane/Fastfile#L919-L928

Comment thread fastlane/lanes/build.rb
output_name: APP_STORE_CONNECT_BUILD_NAME_WORDPRESS,
derived_data_path: DERIVED_DATA_PATH,
export_team_id: get_required_env('EXT_EXPORT_TEAM_ID'),
export_team_id: EXTERNAL_TEAM_ID,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Might want to follow up with a PR that audits the code and docs and aligns names such as external/app-store/production/release and internal/alpha/prototype/enterprise. Of course, before being able to do that it would be good to have a naming preference to adopt. cc @jkmassel on that.

@mokagio mokagio marked this pull request as ready for review July 10, 2026 06:20
@mokagio mokagio requested a review from a team as a code owner July 10, 2026 06:20
Copilot AI review requested due to automatic review settings July 10, 2026 06:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the previously-encrypted project.env secret file and eliminates Fastlane’s dependency on several env vars that are either unused or can be derived from the repo’s existing Xcode configuration, as prep work for migrating secrets management to a8c-secrets.

Changes:

  • Introduces an XcconfigHelper to read build settings from .xcconfig files and uses it to derive internal/external DEVELOPMENT_TEAM IDs.
  • Removes project.env usage from Fastlane bootstrapping and deletes the project.env-example.
  • Cleans up Buildkite scripts and .configure to stop copying/installing the removed env file, and removes now-unnecessary team_id usage in TestFlight uploads.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
fastlane/lanes/xcconfig_helper.rb Adds a helper for reading .xcconfig build settings (resolving #includes) so Fastlane can reuse Xcode-declared values.
fastlane/Fastfile Removes project.env loading/checks and derives INTERNAL_TEAM_ID / EXTERNAL_TEAM_ID from Common.alpha.xcconfig and Common.release.xcconfig.
fastlane/lanes/build.rb Replaces export team env vars with INTERNAL_TEAM_ID / EXTERNAL_TEAM_ID constants and removes TestFlight team_id usage.
fastlane/lanes/codesign.rb Switches match/code signing team IDs from env vars to the new constants.
fastlane/lanes/promote.rb Removes TestFlight team_id usage for promotion flow.
fastlane/env/project.env-example Deletes the obsolete example env file that mirrored the removed secret env file.
.configure Stops copying/encrypting iOS/WPiOS/project.env into the secrets directory.
.buildkite/commands/verify-strings-catalog.sh Removes CI steps that created/copied project.env solely to satisfy Fastlane prechecks.
.buildkite/commands/lint-localized-strings-format.sh Removes CI steps that created/copied project.env solely to satisfy Fastlane prechecks.
.buildkite/commands/build-for-testing.sh Removes the project.env copy step before running configure_apply.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AliSoftware AliSoftware left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM except for the forgotten .enc file cleanup

Comment thread .configure
Comment on lines -6 to -10
{
"file": "iOS/WPiOS/project.env",
"destination": "~/.configure/wordpress-ios/secrets/project.env",
"encrypt": true
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should also remove the project.env.enc file from this repo's .configure-files/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Facepalm.

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.

5 participants