Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] add target-profile and source-profile flags to eas build:resign #2410

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🎉 New features

- Add `target-profile` and `source-profile` flags to the `eas build:resign` command. ([#2410](https://github.com/expo/eas-cli/pull/2410) by [@szdziedzic](https://github.com/szdziedzic))

### 🐛 Bug fixes

- Use the correct app config for no GitHub flow in `init:onboarding`. ([#2397](https://github.com/expo/eas-cli/pull/2397) by [@szdziedzic](https://github.com/szdziedzic))
Expand Down
34 changes: 27 additions & 7 deletions packages/eas-cli/src/commands/build/resign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ interface BuildResignFlags {
offset?: number;
limit?: number;
platform?: Platform;
profile?: string;
targetProfile?: string;
sourceProfile?: string;
maybeBuildId?: string;
wait: boolean;
}
Expand All @@ -52,7 +53,8 @@ interface RawBuildResignFlags {
offset: number | undefined;
limit: number | undefined;
platform: 'android' | 'ios' | undefined;
profile: string | undefined;
'target-profile': string | undefined;
'source-profile': string | undefined;
wait: boolean;
id: string | undefined;
}
Expand All @@ -65,10 +67,16 @@ export default class BuildResign extends EasCommand {
char: 'p',
options: ['android', 'ios'],
}),
profile: Flags.string({
'target-profile': Flags.string({
char: 'e',
description:
'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
'Name of the target build profile from eas.json. Used to resolve credentials for re-signing. Defaults to "production" if defined in eas.json.',
helpValue: 'PROFILE_NAME',
aliases: ['profile'],
}),
'source-profile': Flags.string({
description:
'Name of the source build profile from eas.json. Used to filter builds eligible for re-signing.',
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think descriptions are really helpful. Will users know what these refer to?

Copy link
Member Author

Choose a reason for hiding this comment

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

I hope so, I mean I understood it and I assumed that everybody else would also understand 😅. But maybe that's not the case 😂. Do you have any suggestions about how I can improve it?

Copy link

Choose a reason for hiding this comment

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

The source-profile description seems clear enough to me but I agree the target-profile description may not be immediately obvious if you don't have the context (that I now have after reading your explanation in #2404)

I'm afraid I can't come up with a better suggestion right now (traveling and not in the right space to think carefully) but I can take a second look next week if nobody else steps in to help :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe Name of the target build profile from eas.json. Credentials and environment variables from this profile will be used when re-signing. Defaults to "production" if defined in eas.json. ?

helpValue: 'PROFILE_NAME',
}),
wait: Flags.boolean({
Expand Down Expand Up @@ -130,12 +138,20 @@ export default class BuildResign extends EasCommand {
const buildProfile = await EasJsonUtils.getBuildProfileAsync(
easJsonAccessor,
platform,
flags.profile ?? 'production'
flags.targetProfile ?? 'production'
);
const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: buildProfile.env });
const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId);
const build = await this.ensureBuildSelectedAsync(
{ graphqlClient, projectId, platform, nonInteractive, limit, offset },
{
graphqlClient,
projectId,
platform,
nonInteractive,
limit,
offset,
buildProfile: flags.sourceProfile,
},
maybeBuild
);
const credentialsCtx = new CredentialsContext({
Expand Down Expand Up @@ -228,7 +244,8 @@ export default class BuildResign extends EasCommand {
offset: flags.offset,
limit: flags.limit,
platform: flags.platform as Platform | undefined,
profile: flags.profile,
sourceProfile: flags['source-profile'],
targetProfile: flags['target-profile'],
maybeBuildId: flags.id,
wait: flags.wait,
};
Expand All @@ -242,13 +259,15 @@ export default class BuildResign extends EasCommand {
nonInteractive,
limit,
offset,
buildProfile,
}: {
graphqlClient: ExpoGraphqlClient;
projectId: string;
platform: Platform;
nonInteractive: boolean;
limit?: number;
offset?: number;
buildProfile?: string;
},
maybeBuild?: BuildFragment
): Promise<BuildFragment> {
Expand All @@ -268,6 +287,7 @@ export default class BuildResign extends EasCommand {
distribution: DistributionType.Internal,
platform: toAppPlatform(platform),
status: BuildStatus.Finished,
buildProfile,
},
});
if (!build) {
Expand Down
Loading