Skip to content

Commit 1c8fa78

Browse files
committed
Add compute-type-override input to aws-codebuild-run-build action
This commit allows users to override the compute type specified in the build project for this build.
1 parent b277b24 commit 1c8fa78

File tree

6 files changed

+28
-1
lines changed

6 files changed

+28
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ The only required input is `project-name`.
2222
that CodeBuild requires.
2323
By default, the action uses the buildspec file location
2424
that you configured in the CodeBuild project.
25+
1. **compute-type-override** (optional) :
26+
The name of a compute type for this build that overrides the one specified
27+
in the build project.
2528
1. **image-override** (optional) :
2629
The name of an image for this build that overrides the one specified
2730
in the build project.
@@ -165,6 +168,7 @@ this will overwrite them.
165168
with:
166169
project-name: CodeBuildProjectName
167170
buildspec-override: path/to/buildspec.yaml
171+
compute-type-override: compute-type
168172
image-override: ecr-image-uri
169173
env-vars-for-codebuild: |
170174
custom,

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
buildspec-override:
1111
description: 'Buildspec Override'
1212
required: false
13+
compute-type-override:
14+
description: 'The name of a compute type for this build that overrides the one specified in the build project.'
15+
required: false
1316
image-override:
1417
description: 'The name of an image for this build that overrides the one specified in the build project.'
1518
required: false

code-build.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ function githubInputs() {
169169
const buildspecOverride =
170170
core.getInput("buildspec-override", { required: false }) || undefined;
171171

172+
const computeTypeOverride =
173+
core.getInput("compute-type-override", { required: false }) || undefined;
174+
172175
const imageOverride =
173176
core.getInput("image-override", { required: false }) || undefined;
174177

@@ -184,6 +187,7 @@ function githubInputs() {
184187
repo,
185188
sourceVersion,
186189
buildspecOverride,
190+
computeTypeOverride,
187191
imageOverride,
188192
envPassthrough,
189193
};
@@ -196,6 +200,7 @@ function inputs2Parameters(inputs) {
196200
repo,
197201
sourceVersion,
198202
buildspecOverride,
203+
computeTypeOverride,
199204
imageOverride,
200205
envPassthrough = [],
201206
} = inputs;
@@ -217,6 +222,7 @@ function inputs2Parameters(inputs) {
217222
sourceTypeOverride,
218223
sourceLocationOverride,
219224
buildspecOverride,
225+
computeTypeOverride,
220226
imageOverride,
221227
environmentVariablesOverride,
222228
};

dist/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295409,6 +295409,8 @@ module.exports = /******/ (function (modules, runtime) {
295409295409
assert(sourceVersion, "No source version could be evaluated.");
295410295410
const buildspecOverride =
295411295411
core.getInput("buildspec-override", { required: false }) || undefined;
295412+
const computeTypeOverride =
295413+
core.getInput("compute-type-override", { required: false }) || undefined;
295412295414
const imageOverride =
295413295415
core.getInput("image-override", { required: false }) || undefined;
295414295416
const envPassthrough = core
@@ -295423,6 +295425,7 @@ module.exports = /******/ (function (modules, runtime) {
295423295425
repo,
295424295426
sourceVersion,
295425295427
buildspecOverride,
295428+
computeTypeOverride,
295426295429
imageOverride,
295427295430
envPassthrough,
295428295431
};
@@ -295435,6 +295438,7 @@ module.exports = /******/ (function (modules, runtime) {
295435295438
repo,
295436295439
sourceVersion,
295437295440
buildspecOverride,
295441+
computeTypeOverride,
295438295442
imageOverride,
295439295443
envPassthrough = [],
295440295444
} = inputs;
@@ -295456,6 +295460,7 @@ module.exports = /******/ (function (modules, runtime) {
295456295460
sourceTypeOverride,
295457295461
sourceLocationOverride,
295458295462
buildspecOverride,
295463+
computeTypeOverride,
295459295464
imageOverride,
295460295465
environmentVariablesOverride,
295461295466
};

local.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const cb = require("./code-build");
88
const assert = require("assert");
99
const yargs = require("yargs");
1010

11-
const { projectName, buildspecOverride, imageOverride, envPassthrough, remote } = yargs
11+
const { projectName, buildspecOverride, computeTypeOverride, imageOverride, envPassthrough, remote } = yargs
1212
.option("project-name", {
1313
alias: "p",
1414
describe: "AWS CodeBuild Project Name",
@@ -20,6 +20,11 @@ const { projectName, buildspecOverride, imageOverride, envPassthrough, remote }
2020
describe: "Path to buildspec file",
2121
type: "string",
2222
})
23+
.option("compute-type-override", {
24+
alias: "c",
25+
describe: "The name of a compute type for this build that overrides the one specified in the build project.",
26+
type: "string",
27+
})
2328
.option("image-override", {
2429
alias: "i",
2530
describe: "The name of an image for this build that overrides the one specified in the build project.",
@@ -44,6 +49,7 @@ const params = cb.inputs2Parameters({
4449
...githubInfo(remote),
4550
sourceVersion: BRANCH_NAME,
4651
buildspecOverride,
52+
computeTypeOverride,
4753
imageOverride,
4854
envPassthrough,
4955
});

test/code-build-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ describe("githubInputs", () => {
7171
expect(test)
7272
.to.haveOwnProperty("buildspecOverride")
7373
.and.to.equal(undefined);
74+
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
7475
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
7576
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
7677
});
@@ -121,6 +122,7 @@ describe("githubInputs", () => {
121122
expect(test)
122123
.to.haveOwnProperty("buildspecOverride")
123124
.and.to.equal(undefined);
125+
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
124126
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
125127
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
126128
});
@@ -175,6 +177,7 @@ describe("inputs2Parameters", () => {
175177
expect(test)
176178
.to.haveOwnProperty("buildspecOverride")
177179
.and.to.equal(undefined);
180+
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
178181
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
179182

180183
// I send everything that starts 'GITHUB_'

0 commit comments

Comments
 (0)