EAS Custom Build issues
- Dominant language
- TypeScript
- Stars
- 1.4k
- Forks
- 236
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 91
Description
### Build/Submit details page URL
_No response_
### Summary
Hi!
I'm using Custom EAS Builds to set up slack integration with `eas/send_slack_message`. I appreciate this might belong in https://github.com/expo/eas-build but I'm not able to create a new issue there.
I have created two almost identical build configs for android and ios.
IOS:
```
build:
name: My config
steps:
- pre_install_private_npm_registry
- eas/build
- eas/send_slack_message:
if: ${ always() }
name: Send Slack message when the build finishes
inputs:
slack_hook_url: ${ eas.env.live_slack_webhook_url }
message: |
Build Information:
Status: ${ steps.run_fastlane.status_text }
App Name: ${ eas.metadata.appName }
App Identifier: ${ eas.metadata.appIdentifier }
App Version: ${ eas.metadata.appVersion }
App Build Version: ${ eas.metadata.appBuildVersion }
Platform: ${ eas.job.platform }
Expo Build URL: ${ eas.job.expoBuildUrl }
Triggered By: ${ eas.job.triggeredBy }
Git Commit Hash ${ eas.metadata.gitCommitHash }
https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=${ eas.job.expoBuildUrl }
functions:
pre_install_private_npm_registry:
name: Pre install hook
path: ./pre-install
```
Android:
```
build:
name: My config
steps:
- pre_install_private_npm_registry
- eas/build
- eas/send_slack_message:
if: ${ always() }
name: Send Slack message when the build finishes
inputs:
slack_hook_url: ${ eas.env.live_slack_webhook_url }
message: |
Build Information:
Status: ${ steps.run_gradle.status_text }
App Name: ${ eas.metadata.appName }
App Identifier: ${ eas.metadata.appIdentifier }
App Version: ${ eas.metadata.appVersion }
App Build Version: ${ eas.metadata.appBuildVersion }
Platform: ${ eas.job.platform }
Expo Build URL: ${ eas.job.expoBuildUrl }
Triggered By: ${ eas.job.triggeredBy }
Git Commit Hash ${ eas.metadata.gitCommitHash }
https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=${ eas.job.expoBuildUrl }
functions:
pre_install_private_npm_registry:
name: Pre install hook
path: ./pre-install
```
Whilst trying to configure this I'm running into a couple issues:
### 1) Unable to conditionally execute a step depending on the platform
Ideally I want to use a single `yml` file where I configure my build steps. I would then be able to use
```
- eas/send_slack_message:
if: ${ android() }
...
```
### 2) Unable to pass parameters into the config
My `eas.json` currently looks like
```json
"build": {
"common": {
"android": {
"config": "android.config.yml"
},
"ios": {
"config": "ios.config.yml"
}
}
```
Depending on the config I want to use a different `slack_url`, ideally I can do something like:
```json
"android": {
"config": "android.config.yml",
"parameters": {
"slack_url": "..."
}
},
```
### 3) Unable to generate a string inside of a custom function with newlines
I've tried to create a custom function that would generate a custom slack message, set that as it's output and then use this output inside the `eas/send_slack_message`. Unfortunately I could not get this to work properly. I would get the expected data in my slack channel but was unable to get it formatted correctly with newlines. I tried everything I could think of but had no luck. Using the `message:` input directly did work without issues so I've gone with this approach for now.
### 4) Custom builds that do not run `- eas/build` cost the same amount as a normal build
Due to running into the above mentioned issues I had to create around [60 builds](https://expo.dev/accounts/motors/projects/consumer-app/builds/cae5f01b-a04d-479f-a903-0a857b37c8ac). To make it faster to test my various approaches I disabled the `eas/build` step and only had the slack integration running. I was surprised to find out that this costs the same amount as actually creating a full build. I'm wondering if in the future there could be a free/discounted rate for this?
### Managed or bare?
Managed
### Environment
expo-env-info 1.2.0 environment info:
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 20.11.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.8.0 - C:\Program Files\nodejs\npm.CMD
Expo Workflow: managed
### Error output
_No response_
### Reproducible demo or steps to reproduce from a blank project
My projectId is `a5c2db3f-5810-4a9e-8e9a-54a463a29af9`. You should be able to see all the builds I've created on there.
Contributor guide
Assessment
This issue has not been assessed yet.