Skip to content

Commit

Permalink
set artifactsOverride.type to NO_ARTIFACTS
Browse files Browse the repository at this point in the history
  • Loading branch information
benconnito committed Jan 20, 2023
1 parent 3821a17 commit 868b0a8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 12 deletions.
7 changes: 5 additions & 2 deletions code-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ function githubInputs() {
core.getInput("compute-type-override", { required: false }) || undefined;

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

const envPassthrough = core
Expand Down Expand Up @@ -211,6 +212,7 @@ function inputs2Parameters(inputs) {

const sourceTypeOverride = "GITHUB";
const sourceLocationOverride = `https://github.com/${owner}/${repo}.git`;
const artifactsOverride = { type: "NO_ARTIFACTS" };

const environmentVariablesOverride = Object.entries(process.env)
.filter(
Expand All @@ -225,6 +227,7 @@ function inputs2Parameters(inputs) {
sourceVersion,
sourceTypeOverride,
sourceLocationOverride,
artifactsOverride,
buildspecOverride,
computeTypeOverride,
environmentTypeOverride,
Expand Down
43 changes: 33 additions & 10 deletions test/code-build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ describe("githubInputs", () => {
expect(test)
.to.haveOwnProperty("buildspecOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("computeTypeOverride")
.and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("environmentTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
});
Expand All @@ -88,7 +92,7 @@ describe("githubInputs", () => {
process.env[`GITHUB_REPOSITORY`] = repoInfo;
process.env[`GITHUB_SHA`] = sha;

process.env[`INPUT_ENV-VARS-FOR-CODEBUILD`] = `one, two
process.env[`INPUT_ENV-VARS-FOR-CODEBUILD`] = `one, two
, three,
four `;

Expand Down Expand Up @@ -123,8 +127,12 @@ describe("githubInputs", () => {
expect(test)
.to.haveOwnProperty("buildspecOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("computeTypeOverride")
.and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("environmentTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);
expect(test).to.haveOwnProperty("envPassthrough").and.to.deep.equal([]);
});
Expand Down Expand Up @@ -176,11 +184,19 @@ describe("inputs2Parameters", () => {
expect(test)
.to.haveOwnProperty("sourceLocationOverride")
.and.to.equal(`https://github.com/owner/repo.git`);
expect(test)
.to.haveOwnProperty("artifactsOverride")
.that.has.property("type")
.that.equals("NO_ARTIFACTS");
expect(test)
.to.haveOwnProperty("buildspecOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("computeTypeOverride").and.to.equal(undefined);
expect(test).to.haveOwnProperty("environmentTypeOverride").and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("computeTypeOverride")
.and.to.equal(undefined);
expect(test)
.to.haveOwnProperty("environmentTypeOverride")
.and.to.equal(undefined);
expect(test).to.haveOwnProperty("imageOverride").and.to.equal(undefined);

// I send everything that starts 'GITHUB_'
Expand Down Expand Up @@ -218,7 +234,8 @@ describe("inputs2Parameters", () => {
repo: "repo",
computeTypeOverride: "BUILD_GENERAL1_LARGE",
environmentTypeOverride: "LINUX_CONTAINER",
imageOverride: "111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo"
imageOverride:
"111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo",
});
expect(test).to.haveOwnProperty("projectName").and.to.equal(projectName);
expect(test).to.haveOwnProperty("sourceVersion").and.to.equal(sha);
Expand All @@ -228,6 +245,10 @@ describe("inputs2Parameters", () => {
expect(test)
.to.haveOwnProperty("sourceLocationOverride")
.and.to.equal(`https://github.com/owner/repo.git`);
expect(test)
.to.haveOwnProperty("artifactsOverride")
.that.has.property("type")
.that.equals("NO_ARTIFACTS");
expect(test)
.to.haveOwnProperty("buildspecOverride")
.and.to.equal(undefined);
Expand All @@ -239,7 +260,9 @@ describe("inputs2Parameters", () => {
.and.to.equal(`LINUX_CONTAINER`);
expect(test)
.to.haveOwnProperty("imageOverride")
.and.to.equal(`111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo`);
.and.to.equal(
`111122223333.dkr.ecr.us-west-2.amazonaws.com/codebuild-docker-repo`
);

// I send everything that starts 'GITHUB_'
expect(test)
Expand Down Expand Up @@ -270,7 +293,7 @@ describe("inputs2Parameters", () => {
process.env[`GITHUB_REPOSITORY`] = repoInfo;
process.env[`GITHUB_SHA`] = sha;

process.env[`INPUT_ENV-VARS-FOR-CODEBUILD`] = `one, two
process.env[`INPUT_ENV-VARS-FOR-CODEBUILD`] = `one, two
, three,
four `;

Expand Down

0 comments on commit 868b0a8

Please sign in to comment.