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

[steps] Add support for ${{ ... }} interpolations to function inputs #503

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert "Interpolate inputs"
This reverts commit 3978133.

# Conflicts:
#	packages/steps/src/BuildStep.ts
#	packages/steps/src/BuildStepInput.ts
sjchmiela committed Jan 23, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 195d59dc3a73ce2ab91713298f4d3a54231126ad
11 changes: 9 additions & 2 deletions packages/steps/src/BuildStep.ts
Original file line number Diff line number Diff line change
@@ -349,12 +349,19 @@ export class BuildStep extends BuildStepOutputAccessor {
}

public getInterpolationContext(): JobInterpolationContext {
const hasAnyPreviousStepFailed = this.ctx.global.hasAnyPreviousStepFailed;

return {
...this.ctx.global.jobInterpolationContext,
...this.ctx.global.staticContext,
always: () => true,
never: () => false,
success: () => !hasAnyPreviousStepFailed,
failure: () => hasAnyPreviousStepFailed,
env: this.getScriptEnv(),
fromJSON: (json: string) => JSON.parse(json),
toJSON: (value: unknown) => JSON.stringify(value),
};
}

private async executeCommandAsync(): Promise<void> {
assert(this.command, 'Command must be defined.');

21 changes: 1 addition & 20 deletions packages/steps/src/BuildStepContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os from 'os';
import path from 'path';

import { JobInterpolationContext, StaticJobInterpolationContext } from '@expo/eas-build-job';
import { StaticJobInterpolationContext } from '@expo/eas-build-job';
import { bunyan } from '@expo/logger';
import { v4 as uuidv4 } from 'uuid';

@@ -107,25 +107,6 @@ export class BuildStepGlobalContext {
};
}

public get jobInterpolationContext(): JobInterpolationContext {
const hasAnyPreviousStepFailed = this.hasAnyPreviousStepFailed;

return {
...this.staticContext,
always: () => true,
never: () => false,
success: () => !hasAnyPreviousStepFailed,
failure: () => hasAnyPreviousStepFailed,
env: Object.fromEntries(
Object.entries(this.env).flatMap(([key, value]) =>
value !== undefined ? [[key, value]] : []
)
),
fromJSON: (json: string) => JSON.parse(json),
toJSON: (value: unknown) => JSON.stringify(value),
};
}

public updateEnv(updatedEnv: BuildStepEnv): void {
this.provider.updateEnv(updatedEnv);
}