Skip to content

Commit a95fe55

Browse files
authored
Merge pull request #141 from jpaas/fix/140
Fixes #140
2 parents ea7ff88 + c7cf6e3 commit a95fe55

File tree

6 files changed

+49
-4
lines changed

6 files changed

+49
-4
lines changed

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ The only required input is `project-name`.
2121
The location (in this repository) of the [buildspec file][codebuild buildspec]
2222
that CodeBuild requires.
2323
By default, the action uses the buildspec file location
24-
that you configured in the CodeBuild project.
25-
24+
that you configured in the CodeBuild project.
25+
2626
Alternatively, you can pass in an inline buildspec definition like so:
2727

2828
```
@@ -50,13 +50,14 @@ The only required input is `project-name`.
5050
- npm prune --production
5151
post_build:
5252
commands:
53-
- echo Build completed on `date`
53+
- echo Build completed on `date`
5454
artifacts:
5555
type: zip
5656
files:
5757
- package.json
5858
- package-lock.json
5959
```
60+
6061
1. **compute-type-override** (optional) :
6162
The name of a compute type for this build that overrides the one specified
6263
in the build project.
@@ -66,6 +67,8 @@ The only required input is `project-name`.
6667
1. **image-override** (optional) :
6768
The name of an image for this build that overrides the one specified
6869
in the build project.
70+
1. **image-pull-credentials-type-override** (optional) :
71+
The type of credentials CodeBuild uses to pull images in your build.
6972
1. **disable-source-override** (optional) :
7073
Set to `true` if you want to disable providing `sourceVersion`,
7174
`sourceTypeOverride` and `sourceLocationOverride` to CodeBuild.

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ inputs:
1919
image-override:
2020
description: 'The name of an image for this build that overrides the one specified in the build project.'
2121
required: false
22+
image-pull-credentials-type-override:
23+
description: 'The type of credentials CodeBuild uses to pull images in your build.'
24+
required: false
2225
env-vars-for-codebuild:
2326
description: 'Comma separated list of environment variables to send to CodeBuild'
2427
required: false

code-build.js

+9
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,15 @@ function githubInputs() {
190190
const environmentTypeOverride =
191191
core.getInput("environment-type-override", { required: false }) ||
192192
undefined;
193+
193194
const imageOverride =
194195
core.getInput("image-override", { required: false }) || undefined;
195196

197+
const imagePullCredentialsTypeOverride =
198+
core.getInput("image-pull-credentials-type-override", {
199+
required: false,
200+
}) || undefined;
201+
196202
const envPassthrough = core
197203
.getInput("env-vars-for-codebuild", { required: false })
198204
.split(",")
@@ -225,6 +231,7 @@ function githubInputs() {
225231
computeTypeOverride,
226232
environmentTypeOverride,
227233
imageOverride,
234+
imagePullCredentialsTypeOverride,
228235
envPassthrough,
229236
updateInterval,
230237
updateBackOff,
@@ -244,6 +251,7 @@ function inputs2Parameters(inputs) {
244251
computeTypeOverride,
245252
environmentTypeOverride,
246253
imageOverride,
254+
imagePullCredentialsTypeOverride,
247255
envPassthrough = [],
248256
disableSourceOverride,
249257
disableGithubEnvVars,
@@ -274,6 +282,7 @@ function inputs2Parameters(inputs) {
274282
computeTypeOverride,
275283
environmentTypeOverride,
276284
imageOverride,
285+
imagePullCredentialsTypeOverride,
277286
environmentVariablesOverride,
278287
};
279288
}

dist/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,15 @@ function githubInputs() {
196196
const environmentTypeOverride =
197197
core.getInput("environment-type-override", { required: false }) ||
198198
undefined;
199+
199200
const imageOverride =
200201
core.getInput("image-override", { required: false }) || undefined;
201202

203+
const imagePullCredentialsTypeOverride =
204+
core.getInput("image-pull-credentials-type-override", {
205+
required: false,
206+
}) || undefined;
207+
202208
const envPassthrough = core
203209
.getInput("env-vars-for-codebuild", { required: false })
204210
.split(",")
@@ -231,6 +237,7 @@ function githubInputs() {
231237
computeTypeOverride,
232238
environmentTypeOverride,
233239
imageOverride,
240+
imagePullCredentialsTypeOverride,
234241
envPassthrough,
235242
updateInterval,
236243
updateBackOff,
@@ -250,6 +257,7 @@ function inputs2Parameters(inputs) {
250257
computeTypeOverride,
251258
environmentTypeOverride,
252259
imageOverride,
260+
imagePullCredentialsTypeOverride,
253261
envPassthrough = [],
254262
disableSourceOverride,
255263
disableGithubEnvVars,
@@ -280,6 +288,7 @@ function inputs2Parameters(inputs) {
280288
computeTypeOverride,
281289
environmentTypeOverride,
282290
imageOverride,
291+
imagePullCredentialsTypeOverride,
283292
environmentVariablesOverride,
284293
};
285294
}

local.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
computeTypeOverride,
1515
environmentTypeOverride,
1616
imageOverride,
17+
imagePullCredentialsTypeOverride,
1718
envPassthrough,
1819
remote,
1920
updateInterval,
@@ -45,9 +46,15 @@ const {
4546
.option("image-override", {
4647
alias: "i",
4748
describe:
48-
"The name of an image for this build that overrides the one specified in the build project.",
49+
"The type of credentials CodeBuild uses to pull images in your build.",
4950
type: "string",
5051
})
52+
.option("image-pull-credentials-type-override", {
53+
alias: "it",
54+
describe:
55+
"The name of an image for this build that overrides the one specified in the build project.",
56+
choices: ["CODEBUILD", "SERVICE_ROLE"],
57+
})
5158
.option("env-vars-for-codebuild", {
5259
alias: "e",
5360
describe: "List of environment variables to send to CodeBuild",
@@ -81,6 +88,7 @@ const params = cb.inputs2Parameters({
8188
computeTypeOverride,
8289
environmentTypeOverride,
8390
imageOverride,
91+
imagePullCredentialsTypeOverride,
8492
envPassthrough,
8593
});
8694

test/code-build-test.js

+13
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ describe("githubInputs", () => {
8383
.to.haveOwnProperty("environmentTypeOverride")
8484
.and.to.equal(undefined);
8585
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
86+
expect(test)
87+
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
88+
.and.to.equal(undefined);
8689
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
8790
expect(test).to.haveOwnProperty("hideCloudWatchLogs").and.to.equal(false);
8891
expect(test).to.haveOwnProperty("disableGithubEnvVars").and.to.equal(false);
@@ -156,6 +159,9 @@ describe("githubInputs", () => {
156159
.to.haveOwnProperty("environmentTypeOverride")
157160
.and.to.equal(undefined);
158161
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
162+
expect(test)
163+
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
164+
.and.to.equal(undefined);
159165
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
160166
});
161167

@@ -248,6 +254,9 @@ describe("inputs2Parameters", () => {
248254
.to.haveOwnProperty("environmentTypeOverride")
249255
.and.to.equal(undefined);
250256
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
257+
expect(test)
258+
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
259+
.and.to.equal(undefined);
251260

252261
// I send everything that starts 'GITHUB_'
253262
expect(test)
@@ -286,6 +295,7 @@ describe("inputs2Parameters", () => {
286295
environmentTypeOverride: "LINUX_CONTAINER",
287296
imageOverride:
288297
"111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo",
298+
imagePullCredentialsTypeOverride: "CODEBUILD",
289299
});
290300
expect(test).to.haveOwnProperty("projectName").and.to.equal(projectName);
291301
expect(test).to.haveOwnProperty("sourceVersion").and.to.equal(sha);
@@ -309,6 +319,9 @@ describe("inputs2Parameters", () => {
309319
.and.to.equal(
310320
`111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo`
311321
);
322+
expect(test)
323+
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
324+
.and.to.equal(`CODEBUILD`);
312325

313326
// I send everything that starts 'GITHUB_'
314327
expect(test)

0 commit comments

Comments
 (0)