Skip to content

Commit 8121cd9

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

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ The only required input is `project-name`.
2525
1. **compute-type-override** (optional) :
2626
The name of a compute type for this build that overrides the one specified
2727
in the build project.
28+
1. **environment-type-override** (optional) :
29+
A container type for this build that overrides the one specified in the
30+
build project.
2831
1. **image-override** (optional) :
2932
The name of an image for this build that overrides the one specified
3033
in the build project.
@@ -169,6 +172,7 @@ this will overwrite them.
169172
project-name: CodeBuildProjectName
170173
buildspec-override: path/to/buildspec.yaml
171174
compute-type-override: compute-type
175+
environment-type-override: environment-type
172176
image-override: ecr-image-uri
173177
env-vars-for-codebuild: |
174178
custom,

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
compute-type-override:
1414
description: 'The name of a compute type for this build that overrides the one specified in the build project.'
1515
required: false
16+
environment-type-override:
17+
description: 'A container type for this build that overrides the one specified in the build project.'
18+
required: false
1619
image-override:
1720
description: 'The name of an image for this build that overrides the one specified in the build project.'
1821
required: false

code-build.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ function githubInputs() {
172172
const computeTypeOverride =
173173
core.getInput("compute-type-override", { required: false }) || undefined;
174174

175+
const environmentTypeOverride =
176+
core.getInput("environment-type-override", { required: false }) || undefined;
175177
const imageOverride =
176178
core.getInput("image-override", { required: false }) || undefined;
177179

@@ -188,6 +190,7 @@ function githubInputs() {
188190
sourceVersion,
189191
buildspecOverride,
190192
computeTypeOverride,
193+
environmentTypeOverride,
191194
imageOverride,
192195
envPassthrough,
193196
};
@@ -201,6 +204,7 @@ function inputs2Parameters(inputs) {
201204
sourceVersion,
202205
buildspecOverride,
203206
computeTypeOverride,
207+
environmentTypeOverride,
204208
imageOverride,
205209
envPassthrough = [],
206210
} = inputs;
@@ -223,6 +227,7 @@ function inputs2Parameters(inputs) {
223227
sourceLocationOverride,
224228
buildspecOverride,
225229
computeTypeOverride,
230+
environmentTypeOverride,
226231
imageOverride,
227232
environmentVariablesOverride,
228233
};

dist/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295411,6 +295411,8 @@ module.exports = /******/ (function (modules, runtime) {
295411295411
core.getInput("buildspec-override", { required: false }) || undefined;
295412295412
const computeTypeOverride =
295413295413
core.getInput("compute-type-override", { required: false }) || undefined;
295414+
const environmentTypeOverride =
295415+
core.getInput("environment-type-override", { required: false }) || undefined;
295414295416
const imageOverride =
295415295417
core.getInput("image-override", { required: false }) || undefined;
295416295418
const envPassthrough = core
@@ -295426,6 +295428,7 @@ module.exports = /******/ (function (modules, runtime) {
295426295428
sourceVersion,
295427295429
buildspecOverride,
295428295430
computeTypeOverride,
295431+
environmentTypeOverride,
295429295432
imageOverride,
295430295433
envPassthrough,
295431295434
};
@@ -295439,6 +295442,7 @@ module.exports = /******/ (function (modules, runtime) {
295439295442
sourceVersion,
295440295443
buildspecOverride,
295441295444
computeTypeOverride,
295445+
environmentTypeOverride,
295442295446
imageOverride,
295443295447
envPassthrough = [],
295444295448
} = inputs;
@@ -295461,6 +295465,7 @@ module.exports = /******/ (function (modules, runtime) {
295461295465
sourceLocationOverride,
295462295466
buildspecOverride,
295463295467
computeTypeOverride,
295468+
environmentTypeOverride,
295464295469
imageOverride,
295465295470
environmentVariablesOverride,
295466295471
};

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, computeTypeOverride, imageOverride, envPassthrough, remote } = yargs
11+
const { projectName, buildspecOverride, computeTypeOverride, environmentTypeOverride, imageOverride, envPassthrough, remote } = yargs
1212
.option("project-name", {
1313
alias: "p",
1414
describe: "AWS CodeBuild Project Name",
@@ -25,6 +25,11 @@ const { projectName, buildspecOverride, computeTypeOverride, imageOverride, envP
2525
describe: "The name of a compute type for this build that overrides the one specified in the build project.",
2626
type: "string",
2727
})
28+
.option("environment-type-override", {
29+
alias: "et",
30+
describe: "A container type for this build that overrides the one specified in the build project.",
31+
type: "string",
32+
})
2833
.option("image-override", {
2934
alias: "i",
3035
describe: "The name of an image for this build that overrides the one specified in the build project.",
@@ -50,6 +55,7 @@ const params = cb.inputs2Parameters({
5055
sourceVersion: BRANCH_NAME,
5156
buildspecOverride,
5257
computeTypeOverride,
58+
environmentTypeOverride,
5359
imageOverride,
5460
envPassthrough,
5561
});

test/code-build-test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ describe("githubInputs", () => {
7272
.to.haveOwnProperty("buildspecOverride")
7373
.and.to.equal(undefined);
7474
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
75+
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
7576
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
7677
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
7778
});
@@ -124,6 +125,9 @@ describe("githubInputs", () => {
124125
.and.to.equal(undefined);
125126
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
126127
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
128+
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
129+
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
130+
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
127131
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
128132
});
129133

@@ -179,6 +183,9 @@ describe("inputs2Parameters", () => {
179183
.and.to.equal(undefined);
180184
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
181185
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
186+
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
187+
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
188+
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
182189

183190
// I send everything that starts 'GITHUB_'
184191
expect(test)

0 commit comments

Comments
 (0)