Skip to content

Fixes #140 #141

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

Merged
merged 3 commits into from
Sep 26, 2023
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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ The only required input is `project-name`.
The location (in this repository) of the [buildspec file][codebuild buildspec]
that CodeBuild requires.
By default, the action uses the buildspec file location
that you configured in the CodeBuild project.
that you configured in the CodeBuild project.

Alternatively, you can pass in an inline buildspec definition like so:

```
Expand Down Expand Up @@ -50,13 +50,14 @@ The only required input is `project-name`.
- npm prune --production
post_build:
commands:
- echo Build completed on `date`
- echo Build completed on `date`
artifacts:
type: zip
files:
- package.json
- package-lock.json
```

1. **compute-type-override** (optional) :
The name of a compute type for this build that overrides the one specified
in the build project.
Expand All @@ -66,6 +67,8 @@ The only required input is `project-name`.
1. **image-override** (optional) :
The name of an image for this build that overrides the one specified
in the build project.
1. **image-pull-credentials-type-override** (optional) :
The type of credentials CodeBuild uses to pull images in your build.
1. **disable-source-override** (optional) :
Set to `true` if you want to disable providing `sourceVersion`,
`sourceTypeOverride` and `sourceLocationOverride` to CodeBuild.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ inputs:
image-override:
description: 'The name of an image for this build that overrides the one specified in the build project.'
required: false
image-pull-credentials-type-override:
description: 'The type of credentials CodeBuild uses to pull images in your build.'
required: false
env-vars-for-codebuild:
description: 'Comma separated list of environment variables to send to CodeBuild'
required: false
Expand Down
9 changes: 9 additions & 0 deletions code-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,15 @@ function githubInputs() {
const environmentTypeOverride =
core.getInput("environment-type-override", { required: false }) ||
undefined;

const imageOverride =
core.getInput("image-override", { required: false }) || undefined;

const imagePullCredentialsTypeOverride =
core.getInput("image-pull-credentials-type-override", {
required: false,
}) || undefined;

const envPassthrough = core
.getInput("env-vars-for-codebuild", { required: false })
.split(",")
Expand Down Expand Up @@ -225,6 +231,7 @@ function githubInputs() {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
envPassthrough,
updateInterval,
updateBackOff,
Expand All @@ -244,6 +251,7 @@ function inputs2Parameters(inputs) {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
envPassthrough = [],
disableSourceOverride,
disableGithubEnvVars,
Expand Down Expand Up @@ -274,6 +282,7 @@ function inputs2Parameters(inputs) {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
environmentVariablesOverride,
};
}
Expand Down
9 changes: 9 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,15 @@ function githubInputs() {
const environmentTypeOverride =
core.getInput("environment-type-override", { required: false }) ||
undefined;

const imageOverride =
core.getInput("image-override", { required: false }) || undefined;

const imagePullCredentialsTypeOverride =
core.getInput("image-pull-credentials-type-override", {
required: false,
}) || undefined;

const envPassthrough = core
.getInput("env-vars-for-codebuild", { required: false })
.split(",")
Expand Down Expand Up @@ -231,6 +237,7 @@ function githubInputs() {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
envPassthrough,
updateInterval,
updateBackOff,
Expand All @@ -250,6 +257,7 @@ function inputs2Parameters(inputs) {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
envPassthrough = [],
disableSourceOverride,
disableGithubEnvVars,
Expand Down Expand Up @@ -280,6 +288,7 @@ function inputs2Parameters(inputs) {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
environmentVariablesOverride,
};
}
Expand Down
10 changes: 9 additions & 1 deletion local.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
envPassthrough,
remote,
updateInterval,
Expand Down Expand Up @@ -45,9 +46,15 @@ const {
.option("image-override", {
alias: "i",
describe:
"The name of an image for this build that overrides the one specified in the build project.",
"The type of credentials CodeBuild uses to pull images in your build.",
type: "string",
})
.option("image-pull-credentials-type-override", {
alias: "it",
describe:
"The name of an image for this build that overrides the one specified in the build project.",
choices: ["CODEBUILD", "SERVICE_ROLE"],
})
.option("env-vars-for-codebuild", {
alias: "e",
describe: "List of environment variables to send to CodeBuild",
Expand Down Expand Up @@ -81,6 +88,7 @@ const params = cb.inputs2Parameters({
computeTypeOverride,
environmentTypeOverride,
imageOverride,
imagePullCredentialsTypeOverride,
envPassthrough,
});

Expand Down
13 changes: 13 additions & 0 deletions test/code-build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ describe("githubInputs", () => {
.to.haveOwnProperty("environmentTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
expect(test).to.haveOwnProperty("hideCloudWatchLogs").and.to.equal(false);
expect(test).to.haveOwnProperty("disableGithubEnvVars").and.to.equal(false);
Expand Down Expand Up @@ -156,6 +159,9 @@ describe("githubInputs", () => {
.to.haveOwnProperty("environmentTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
});

Expand Down Expand Up @@ -248,6 +254,9 @@ describe("inputs2Parameters", () => {
.to.haveOwnProperty("environmentTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
.and.to.equal(undefined);

// I send everything that starts 'GITHUB_'
expect(test)
Expand Down Expand Up @@ -286,6 +295,7 @@ describe("inputs2Parameters", () => {
environmentTypeOverride: "LINUX_CONTAINER",
imageOverride:
"111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo",
imagePullCredentialsTypeOverride: "CODEBUILD",
});
expect(test).to.haveOwnProperty("projectName").and.to.equal(projectName);
expect(test).to.haveOwnProperty("sourceVersion").and.to.equal(sha);
Expand All @@ -309,6 +319,9 @@ describe("inputs2Parameters", () => {
.and.to.equal(
`111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo`
);
expect(test)
.to.haveOwnProperty("imagePullCredentialsTypeOverride")
.and.to.equal(`CODEBUILD`);

// I send everything that starts 'GITHUB_'
expect(test)
Expand Down