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

Add support for minInstances and custom_worker_pool #213

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ jobs:
env_vars_file: './tests/env-var-files/test.good.yaml'
build_environment_variables: 'FOO=bar, ZIP=zap'
build_environment_variables_file: './tests/env-var-files/test.good.yaml'
min_instances: 2
max_instances: 5

# Auth as the main account for integration and cleanup
- uses: 'google-github-actions/auth@main'
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ steps:

- `timeout`: (Optional) The function execution timeout in seconds. Defaults to 60.

- `min_instances`: (Optional) The minimum number of instances for the function.

- `max_instances`: (Optional) The maximum number of instances for the function.

- `event_trigger_type`: (Optional) Specifies which action should trigger the function. Defaults to creation of http trigger.
Expand All @@ -95,6 +97,10 @@ steps:

- `deploy_timeout`: (Optional) The function deployment timeout in seconds. Defaults to 300.

- `build_worker_pool`: (Optional) Name of the Cloud Build Custom Worker Pool
that should be used to build the function. The format of this field is
`projects/p/locations/l/workerPools/w`.

- `build_environment_variables`: (Optional) List of environment variables that
should be available while the function is built. Note this is different than
runtime environment variables, which should be set with 'env_vars'.
Expand Down
11 changes: 11 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ inputs:
The function execution timeout.
required: false

min_instances:
description: |-
The minimum number of instances for the function.
required: false

max_instances:
description: |-
The maximum number of instances for the function.
Expand All @@ -134,6 +139,12 @@ inputs:
default: 300
required: false

build_worker_pool:
description: |-
Name of the Cloud Build Custom Worker Pool that should be used to build
the function.
required: false

build_environment_variables:
description: |-
Optional list of environment variables that should be available while the
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async function run(): Promise<void> {
const serviceAccountEmail = presence(getInput('service_account_email'));
const timeout = presence(getInput('timeout'));
const maxInstances = presence(getInput('max_instances'));
const minInstances = presence(getInput('min_instances'));
const eventTriggerType = presence(getInput('event_trigger_type'));
const eventTriggerResource = presence(getInput('event_trigger_resource'));
const eventTriggerService = presence(getInput('event_trigger_service'));
Expand All @@ -66,6 +67,7 @@ async function run(): Promise<void> {
const buildEnvVarsFile = presence(
getInput('build_environment_variables_file'),
);
const buildWorkerPool = presence(getInput('build_worker_pool'));

const dockerRepository = presence(getInput('docker_repository'));
const kmsKeyName = presence(getInput('kms_key_name'));
Expand Down Expand Up @@ -137,15 +139,15 @@ async function run(): Promise<void> {
description: description,
availableMemoryMb: availableMemoryMb ? +availableMemoryMb : undefined,
buildEnvironmentVariables: buildEnvironmentVariables,
// buildWorkerPool: buildWorkerPool, // TODO: add support
buildWorkerPool: buildWorkerPool,
dockerRepository: dockerRepository,
entryPoint: entryPoint,
environmentVariables: environmentVariables,
ingressSettings: ingressSettings,
kmsKeyName: kmsKeyName,
labels: labels,
maxInstances: maxInstances ? +maxInstances : undefined,
// minInstances: minInstances ? + minInstances : undefined, // TODO: add support
minInstances: minInstances ? +minInstances : undefined,
// network: network, // TODO: add support
serviceAccountEmail: serviceAccountEmail,
// sourceToken: sourceToken, // TODO: add support
Expand Down