Skip to content

Commit

Permalink
Update dist file
Browse files Browse the repository at this point in the history
  • Loading branch information
tmshkr committed Mar 5, 2024
1 parent 7757e7f commit 085e62b
Showing 1 changed file with 102 additions and 94 deletions.
196 changes: 102 additions & 94 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233942,6 +233942,98 @@ function createApplicationVersion(inputs) {
});
}

;// CONCATENATED MODULE: ./src/inputs.ts

const inputs_fs = __nccwpck_require__(57147);
function getInputs() {
const inputs = {
appName: core.getInput("app_name", { required: true }),
awsRegion: core.getInput("aws_region") ||
process.env.AWS_REGION ||
process.env.AWS_DEFAULT_REGION,
blueEnv: core.getInput("blue_env", { required: true }),
createEnvironment: core.getBooleanInput("create_environment", {
required: true,
}),
deploy: core.getBooleanInput("deploy", { required: true }),
disableTerminationProtection: core.getBooleanInput("disable_termination_protection"),
enableTerminationProtection: core.getBooleanInput("enable_termination_protection"),
greenEnv: core.getInput("green_env", { required: true }),
minimumHealthColor: mapHealthColorToInt(core.getInput("minimum_health_color", {
required: true,
})),
optionSettings: core.getInput("option_settings")
? JSON.parse(inputs_fs.readFileSync(core.getInput("option_settings")))
: undefined,
platformBranchName: core.getInput("platform_branch_name"),
productionCNAME: core.getInput("production_cname", { required: true }),
sourceBundle: core.getInput("source_bundle") || undefined,
stagingCNAME: core.getInput("staging_cname", { required: true }),
swapCNAMEs: core.getBooleanInput("swap_cnames", { required: true }),
templateName: core.getInput("template_name") || undefined,
terminateUnhealthyEnvironment: core.getBooleanInput("terminate_unhealthy_environment", { required: true }),
updateEnvironment: core.getBooleanInput("update_environment", {
required: true,
}),
updateListenerRules: core.getBooleanInput("update_listener_rules", {
required: true,
}),
versionDescription: core.getInput("version_description") || undefined,
versionLabel: core.getInput("version_label") || undefined,
waitForDeployment: core.getBooleanInput("wait_for_deployment", {
required: true,
}),
waitForEnvironment: core.getBooleanInput("wait_for_environment", {
required: true,
}),
waitForTermination: core.getBooleanInput("wait_for_termination", {
required: true,
}),
useDefaultOptionSettings: core.getBooleanInput("use_default_option_settings", {
required: true,
}),
};
try {
checkInputs(inputs);
}
catch (err) {
core.setFailed(err.message);
throw err;
}
return inputs;
}
function checkInputs(inputs) {
if (!inputs.awsRegion) {
throw new Error("aws_region must be provided");
}
if (inputs.blueEnv === inputs.greenEnv) {
throw new Error("blue_env and green_env must be different");
}
if (!inputs.versionLabel && inputs.sourceBundle) {
throw new Error("source_bundle must be provided with a version_label");
}
if (inputs.productionCNAME === inputs.stagingCNAME) {
throw new Error("production_cname and staging_cname must be different");
}
if (inputs.optionSettings && !Array.isArray(inputs.optionSettings)) {
throw new Error("option_settings must be an array");
}
}
function mapHealthColorToInt(healthColor) {
switch (healthColor.toUpperCase()) {
case "GREEN":
return 3;
case "YELLOW":
return 2;
case "RED":
return 1;
case "GREY":
return 0;
default:
throw new Error("Invalid health color");
}
}

;// CONCATENATED MODULE: ./src/getEnvironments.ts
var getEnvironments_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
Expand Down Expand Up @@ -234309,6 +234401,7 @@ var getTargetEnv_awaiter = (undefined && undefined.__awaiter) || function (thisA




function getTargetEnv(inputs) {
return getTargetEnv_awaiter(this, void 0, void 0, function* () {
const { prodEnv, stagingEnv } = yield getEnvironments(inputs);
Expand Down Expand Up @@ -234339,24 +234432,13 @@ function getTargetEnv(inputs) {
else
throw new Error("Target environment is not ready and wait_for_environment is false. Exiting...");
}
switch (targetEnv.Health) {
case "Green":
console.log("Target environment's health is Green.");
return targetEnv;
case "Yellow":
console.log("Target environment's health is Yellow.");
yield terminateEnvironment(inputs, targetEnv);
return null;
case "Red":
console.log("Target environment's health is Red.");
yield terminateEnvironment(inputs, targetEnv);
return null;
case "Grey":
console.log("Target environment's health is Grey.");
yield terminateEnvironment(inputs, targetEnv);
return null;
default:
throw new Error("Target environment is unknown.");
console.log(`Target environment's health is ${targetEnv.Health}.`);
if (mapHealthColorToInt(targetEnv.Health) < inputs.minimumHealthColor) {
yield terminateEnvironment(inputs, targetEnv);
return null;
}
else {
return targetEnv;
}
});
}
Expand Down Expand Up @@ -234490,6 +234572,7 @@ var swapCNAMEs_awaiter = (undefined && undefined.__awaiter) || function (thisArg




const swapCNAMEs_core = __nccwpck_require__(42186);
function swapCNAMEs(inputs) {
return swapCNAMEs_awaiter(this, void 0, void 0, function* () {
Expand All @@ -234498,7 +234581,7 @@ function swapCNAMEs(inputs) {
swapCNAMEs_core.warning("Cannot swap CNAMEs without both environments...");
return;
}
if (stagingEnv.Health !== "Green") {
if (mapHealthColorToInt(stagingEnv.Health) < inputs.minimumHealthColor) {
throw new Error(`Target environment is not healthy. Cannot swap CNAMEs.`);
}
if (stagingEnv.Status !== "Ready" || prodEnv.Status !== "Ready") {
Expand Down Expand Up @@ -234584,81 +234667,6 @@ function setOutputs(targetEnv) {
});
}

;// CONCATENATED MODULE: ./src/inputs.ts

const inputs_fs = __nccwpck_require__(57147);
function getInputs() {
const inputs = {
appName: core.getInput("app_name", { required: true }),
awsRegion: core.getInput("aws_region") ||
process.env.AWS_REGION ||
process.env.AWS_DEFAULT_REGION,
blueEnv: core.getInput("blue_env", { required: true }),
createEnvironment: core.getBooleanInput("create_environment", {
required: true,
}),
deploy: core.getBooleanInput("deploy", { required: true }),
disableTerminationProtection: core.getBooleanInput("disable_termination_protection"),
enableTerminationProtection: core.getBooleanInput("enable_termination_protection"),
greenEnv: core.getInput("green_env", { required: true }),
optionSettings: core.getInput("option_settings")
? JSON.parse(inputs_fs.readFileSync(core.getInput("option_settings")))
: undefined,
platformBranchName: core.getInput("platform_branch_name"),
productionCNAME: core.getInput("production_cname", { required: true }),
sourceBundle: core.getInput("source_bundle") || undefined,
stagingCNAME: core.getInput("staging_cname", { required: true }),
swapCNAMEs: core.getBooleanInput("swap_cnames", { required: true }),
templateName: core.getInput("template_name") || undefined,
terminateUnhealthyEnvironment: core.getBooleanInput("terminate_unhealthy_environment", { required: true }),
updateEnvironment: core.getBooleanInput("update_environment", {
required: true,
}),
updateListenerRules: core.getBooleanInput("update_listener_rules", {
required: true,
}),
versionDescription: core.getInput("version_description") || undefined,
versionLabel: core.getInput("version_label") || undefined,
waitForDeployment: core.getBooleanInput("wait_for_deployment", {
required: true,
}),
waitForEnvironment: core.getBooleanInput("wait_for_environment", {
required: true,
}),
waitForTermination: core.getBooleanInput("wait_for_termination", {
required: true,
}),
useDefaultOptionSettings: core.getBooleanInput("use_default_option_settings", {
required: true,
}),
};
try {
checkInputs(inputs);
}
catch (err) {
core.setFailed(err.message);
throw err;
}
return inputs;
}
function checkInputs(inputs) {
if (!inputs.awsRegion) {
throw new Error("aws_region must be provided");
}
if (inputs.blueEnv === inputs.greenEnv) {
throw new Error("blue_env and green_env must be different");
}
if (!inputs.versionLabel && inputs.sourceBundle) {
throw new Error("source_bundle must be provided with a version_label");
}
if (inputs.productionCNAME === inputs.stagingCNAME) {
throw new Error("production_cname and staging_cname must be different");
}
if (inputs.optionSettings && !Array.isArray(inputs.optionSettings)) {
throw new Error("option_settings must be an array");
}
}

;// CONCATENATED MODULE: ./src/run.ts
if (!process.env.GITHUB_ACTIONS) {
(__nccwpck_require__(12437).config)();
Expand Down

0 comments on commit 085e62b

Please sign in to comment.