Skip to content

Commit

Permalink
3.4.0 added feature to skip deployment check (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richi authored Apr 12, 2024
1 parent 710080c commit 175e6d4
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 13 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,15 @@ can`t update production.
bratiska-cli deploy --staging
```
#### Skip deployment check
If you are deploying some cron jobs to kubernetes, there is nothing to check if the deployment was successful, so in
that case, we have this option flag you can use.
```bash
bratiska-cli deploy --skip_deployment_check
```
#### Debug
If you need to debug the deploy process, you can add the `--debug` option. This will save the kustomize manifest to the
Expand Down
13 changes: 7 additions & 6 deletions dist/bratiska-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const tag_1 = require("./tag");
const label_1 = require("./label");
const common_1 = require("./common");
const helpers = __importStar(require("./helpers"));
const version = "3.3.3";
const version = "3.4.0";
const deploy = new deploy_1.Deploy();
const tag = new tag_1.Tag();
const common = new common_1.Common();
Expand All @@ -47,13 +47,13 @@ const build_kustomize = new build_kustomize_1.BuildKustomize();
const label = new label_1.Label();
try {
(0, clear_1.default)();
console.log(chalk_1.default.blue(figlet_1.default.textSync("Bratiska-cli", { horizontalLayout: "full" })));
console.log(chalk_1.default.blue(figlet_1.default.textSync("Bratiska-cli", { horizontalLayout: "full" })));
commander_1.program
.name("bratiska-cli")
.version(version)
.description("Simple Bratiska-cli utility for managing Bratislava Innovation apps")
.action(() => {
console.log(chalk_1.default.green("Please choose from selected commands based on yur needs. My favourite command is `deploy`."));
console.log(chalk_1.default.green("Please choose from selected commands based on yur needs. My favourite command is `deploy`."));
commander_1.program.help();
});
commander_1.program
Expand Down Expand Up @@ -125,6 +125,7 @@ try {
.option("-debug, --debug", "Debugging")
.option("-beta, --beta", "Beta features")
.option("-no_image_repo_check, --no_image_repo_check", "No Image repository check")
.option("-skip_deployment_check, --skip_deployment_check", "Skip checking if the kubernetes deployment was deployed successfully")
.option("-no_pull, --no_pull", "If you dont want to git pull from origin.")
.option("-force, --force <pass>", "Force")
.action((env, options) => {
Expand Down Expand Up @@ -229,7 +230,7 @@ try {
/* step 1 */
build_image.check_build_image_commands(options);
/* step 2 */
common.show_options("build_image", options);
common.show_options("build_image", options);
/* step 3 */
common.get_git_current_branch(options);
/* step 4 */
Expand Down Expand Up @@ -351,7 +352,7 @@ try {
/* step 1 */
label.check_label_commands(options);
/* step 2 */
common.show_options("", options);
common.show_options("", options);
/* step 3 */
label.show_label_info(label_value, options);
/* step 4 */
Expand All @@ -374,6 +375,6 @@ try {
// @ts-ignore
}
catch (e) {
helpers.log("\x1b[31m", `\nISSUE: ${e.message}`);
helpers.log("\x1b[31m", `\nISSUE: ${e.message}`);
process.exit(1);
}
3 changes: 3 additions & 0 deletions dist/common/show_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ function show_options(env, options) {
if (typeof options.no_image_repo_check === "undefined") {
options.no_image_repo_check = false;
}
if (typeof options.skip_deployment_check === "undefined") {
options.skip_deployment_check = false;
}
if (typeof options.namespace === "undefined") {
// ignore namespace when not defined during only image build
options.namespace = "standalone";
Expand Down
3 changes: 2 additions & 1 deletion dist/deploy/check_deployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function check_deployment(options) {
if (options.dry_run ||
options.build_kustomize ||
options.build_image ||
options.build_image_no_registry) {
options.build_image_no_registry ||
options.skip_deployment_check) {
helpers.skipping();
return;
}
Expand Down
3 changes: 3 additions & 0 deletions dist/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@ function print_options(options) {
if (options.no_image_repo_check) {
print_important_info_spacer("--no_image_repo_check");
}
if (options.skip_deployment_check) {
print_important_info_spacer("--skip_deployment_check");
}
if (options.dry_run) {
print_important_info_spacer("--dry_run");
}
Expand Down
3 changes: 0 additions & 3 deletions dist/label.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ class Label {
add_label_to_resources(options) {
(0, add_label_to_resources_1.add_label_to_resources)(options);
}

add_label_to_secrets(options) {
(0, add_label_to_secrets_1.add_label_to_secrets)(options);
}

show_label_info(label_value, options) {
(0, show_label_info_1.show_label_info)(label_value, options);
}

check_label_commands(options) {
(0, check_label_commands_1.check_label_commands)(options);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bratiska-cli",
"version": "3.3.3",
"version": "3.4.0",
"description": "Simple CLI for deploying Bratislava apps to kubernetes",
"preferGlobal": true,
"bin": {
Expand Down
3 changes: 2 additions & 1 deletion src/bratiska-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Label } from './label';
import { Common } from './common';
import * as helpers from './helpers';

const version = "3.3.3";
const version = "3.4.0";
const deploy = new Deploy();
const tag = new Tag();
const common = new Common();
Expand Down Expand Up @@ -140,6 +140,7 @@ try {
'-no_image_repo_check, --no_image_repo_check',
'No Image repository check',
)
.option("-skip_deployment_check, --skip_deployment_check", "Skip checking if the kubernetes deployment was deployed successfully")
.option('-no_pull, --no_pull', 'If you dont want to git pull from origin.')
.option('-force, --force <pass>', 'Force')
.action((env, options) => {
Expand Down
4 changes: 4 additions & 0 deletions src/common/show_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export function show_options(env: string, options: Options) {
options.no_image_repo_check = false;
}

if (typeof options.skip_deployment_check === "undefined") {
options.skip_deployment_check = false;
}

if (typeof options.namespace === 'undefined') {
// ignore namespace when not defined during only image build
options.namespace = 'standalone';
Expand Down
3 changes: 2 additions & 1 deletion src/deploy/check_deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export function check_deployment(options: Options) {
options.dry_run ||
options.build_kustomize ||
options.build_image ||
options.build_image_no_registry
options.build_image_no_registry ||
options.skip_deployment_check
) {
helpers.skipping();
return;
Expand Down
4 changes: 4 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ export function print_options(options: Options) {
print_important_info_spacer('--no_image_repo_check');
}

if (options.skip_deployment_check) {
print_important_info_spacer("--skip_deployment_check");
}

if (options.dry_run) {
print_important_info_spacer('--dry_run');
}
Expand Down

0 comments on commit 175e6d4

Please sign in to comment.