Skip to content

Commit b863bde

Browse files
authored
Add support for minInstances and custom_worker_pool (#213)
1 parent c9db079 commit b863bde

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.github/workflows/integration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ jobs:
222222
env_vars_file: './tests/env-var-files/test.good.yaml'
223223
build_environment_variables: 'FOO=bar, ZIP=zap'
224224
build_environment_variables_file: './tests/env-var-files/test.good.yaml'
225+
min_instances: 2
226+
max_instances: 5
225227

226228
# Auth as the main account for integration and cleanup
227229
- uses: 'google-github-actions/auth@main'

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ steps:
8585

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

88+
- `min_instances`: (Optional) The minimum number of instances for the function.
89+
8890
- `max_instances`: (Optional) The maximum number of instances for the function.
8991

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

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

100+
- `build_worker_pool`: (Optional) Name of the Cloud Build Custom Worker Pool
101+
that should be used to build the function. The format of this field is
102+
`projects/p/locations/l/workerPools/w`.
103+
98104
- `build_environment_variables`: (Optional) List of environment variables that
99105
should be available while the function is built. Note this is different than
100106
runtime environment variables, which should be set with 'env_vars'.

action.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ inputs:
108108
The function execution timeout.
109109
required: false
110110

111+
min_instances:
112+
description: |-
113+
The minimum number of instances for the function.
114+
required: false
115+
111116
max_instances:
112117
description: |-
113118
The maximum number of instances for the function.
@@ -134,6 +139,12 @@ inputs:
134139
default: 300
135140
required: false
136141

142+
build_worker_pool:
143+
description: |-
144+
Name of the Cloud Build Custom Worker Pool that should be used to build
145+
the function.
146+
required: false
147+
137148
build_environment_variables:
138149
description: |-
139150
Optional list of environment variables that should be available while the

src/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ async function run(): Promise<void> {
5656
const serviceAccountEmail = presence(getInput('service_account_email'));
5757
const timeout = presence(getInput('timeout'));
5858
const maxInstances = presence(getInput('max_instances'));
59+
const minInstances = presence(getInput('min_instances'));
5960
const eventTriggerType = presence(getInput('event_trigger_type'));
6061
const eventTriggerResource = presence(getInput('event_trigger_resource'));
6162
const eventTriggerService = presence(getInput('event_trigger_service'));
@@ -66,6 +67,7 @@ async function run(): Promise<void> {
6667
const buildEnvVarsFile = presence(
6768
getInput('build_environment_variables_file'),
6869
);
70+
const buildWorkerPool = presence(getInput('build_worker_pool'));
6971

7072
const dockerRepository = presence(getInput('docker_repository'));
7173
const kmsKeyName = presence(getInput('kms_key_name'));
@@ -137,15 +139,15 @@ async function run(): Promise<void> {
137139
description: description,
138140
availableMemoryMb: availableMemoryMb ? +availableMemoryMb : undefined,
139141
buildEnvironmentVariables: buildEnvironmentVariables,
140-
// buildWorkerPool: buildWorkerPool, // TODO: add support
142+
buildWorkerPool: buildWorkerPool,
141143
dockerRepository: dockerRepository,
142144
entryPoint: entryPoint,
143145
environmentVariables: environmentVariables,
144146
ingressSettings: ingressSettings,
145147
kmsKeyName: kmsKeyName,
146148
labels: labels,
147149
maxInstances: maxInstances ? +maxInstances : undefined,
148-
// minInstances: minInstances ? + minInstances : undefined, // TODO: add support
150+
minInstances: minInstances ? +minInstances : undefined,
149151
// network: network, // TODO: add support
150152
serviceAccountEmail: serviceAccountEmail,
151153
// sourceToken: sourceToken, // TODO: add support

0 commit comments

Comments
 (0)