Skip to content

Commit

Permalink
feat: add git, eks addons (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
serdigital64 authored Aug 18, 2024
1 parent f20de64 commit 5d56740
Show file tree
Hide file tree
Showing 8 changed files with 372 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.0]

### Added

- Module
- GIT

- AWS-EKS
- Show addons

## [0.8.0]

### Added
Expand Down
92 changes: 92 additions & 0 deletions src/aws-eks/aws-eks-addons-show
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/usr/bin/env bash
# template: 1.0.0
# template-import: 1.0.0
#######################################
# AWS / EKS / AddOns / Show
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

# template-import: 1.0.0
declare SYSOP64_CORE_PATH_ROOT="${SYSOP64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-aws.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/aws/aws-lib" || { echo "Error: unable to load module library" && exit 1; }

#
# Functions
#

function aws_eks_addons_list() {
local cluster_name="$1"
# shellchedk disable=SC2086
bl64_aws_run_aws \
eks \
list-addons \
$BL64_AWS_SET_FORMAT_JSON \
--cluster-name "$cluster_name" |
"$SYSOP64_CORE_PATH_JQ" \
-r '.addons[]'

}

function aws_eks_addons_show() {
local cluster_name="$1"
local addon_name=''
bl64_aws_run_aws
for addon_name in $(aws_eks_addons_list "$cluster_name"); do
bl64_aws_run_aws \
eks \
describe-addon \
--cluster-name "$cluster_name" \
--addon-name "$addon_name"
done
}

function initialize() {
bl64_dbg_app_show_function
bl64_check_export 'cluster_name' &&
bl64_check_command_search_path "$SYSOP64_CORE_PATH_JQ" &&
aws_lib_setup
}

#
# Main
#

declare cluster_name="${1:-}"
declare command='aws-eks-addons-show'

bl64_dbg_set_level "$SYSOP64_CORE_SET_DEBUG" && bl64_msg_set_level "$SYSOP64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_msg_show_batch_start "$command"
aws_eks_addons_show "$cluster_name"
bl64_msg_show_batch_finish $? "$command"
8 changes: 3 additions & 5 deletions src/aws-eks/aws-eks-ami-show
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# AWS EKS / AMI / Show
#
# Version: 1.0.1
# Version: 1.0.2
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand Down Expand Up @@ -90,9 +90,7 @@ function help() {
#

declare command="$BL64_VAR_NULL"
declare debug="$BL64_DBG_TARGET_NONE"
declare option=''
declare verbose="$BL64_MSG_VERBOSE_ALL"
declare ami_family='AL2023'
declare k8s_version='1.29'

Expand All @@ -102,8 +100,8 @@ while getopts ':la:r:V:D:h' option; do
l) command='show_recommended' ;;
a) ami_family="$OPTARG" ;;
r) k8s_version="$OPTARG" ;;
V) verbose="$OPTARG" ;;
D) debug="$OPTARG" ;;
V) SYSOP64_CORE_SET_VERBOSE="$OPTARG" ;;
D) SYSOP64_CORE_SET_DEBUG="$OPTARG" ;;
h) help && exit 0 ;;
*) help && exit 1 ;;
esac
Expand Down
10 changes: 9 additions & 1 deletion src/core/core-lib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#######################################
# Core / Lib
#
# Version: 1.1.0
# Version: 1.2.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
Expand All @@ -27,8 +27,16 @@

# shellcheck disable=SC2034
{
# Default SysOp64 install path
declare SYSOP64_CORE_PATH_ROOT="${SYSOP64_CORE_PATH_ROOT:-/opt/sysop64}"
# Default BL64 install path
declare SYSOP64_CORE_PATH_BL64="${SYSOP64_CORE_PATH_BL64:-/opt/bl64}"

# Default debut level
declare SYSOP64_CORE_SET_DEBUG="${SYSOP64_CORE_SET_DEBUG:-NONE}"
# Default verbose level
declare SYSOP64_CORE_SET_VERBOSE="${SYSOP64_CORE_SET_VERBOSE:-ALL}"

# Default JQuery tool path
declare SYSOP64_CORE_PATH_JQ="${SYSOP64_CORE_PATH_JQ:-/usr/bin/jq}"
}
72 changes: 72 additions & 0 deletions src/git/git-commit-history-show-tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
# template: 1.0.0
# template-import: 1.0.0
#######################################
# GIT / Commit / History / Show tree
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

# template-import: 1.0.0
declare SYSOP64_CORE_PATH_ROOT="${SYSOP64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-xsv.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-rxtx.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-api.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-vcs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/git/git-lib" || { echo "Error: unable to load module library" && exit 1; }

#
# Functions
#

function initialize() {
bl64_dbg_app_show_function
}

#
# Main
#

declare command='git-commit-history-show-tree'

bl64_dbg_set_level "$SYSOP64_CORE_SET_DEBUG" && bl64_msg_set_level "$SYSOP64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_msg_show_batch_start "$command"
bl64_vcs_run_git \
log \
--graph \
--all \
--decorate=short \
--topo-order \
--pretty=format:'%C(auto)%h%d%Creset %C(cyan)(%ci)%Creset %C(green)%cn <%ce>%Creset %s%n'
bl64_msg_show_batch_finish $? "$command"
75 changes: 75 additions & 0 deletions src/git/git-file-history-show-commits
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
# template: 1.0.0
# template-import: 1.0.0
#######################################
# GIT / File / History / Show Commits
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

# template-import: 1.0.0
declare SYSOP64_CORE_PATH_ROOT="${SYSOP64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-xsv.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-rxtx.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-api.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-vcs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/git/git-lib" || { echo "Error: unable to load module library" && exit 1; }

#
# Functions
#

function initialize() {
bl64_dbg_app_show_function
bl64_check_parameter 'file_path'
}

#
# Main
#

declare file_path="${1:-}"
declare command='git-file-history-show-commits'

bl64_dbg_set_level "$SYSOP64_CORE_SET_DEBUG" && bl64_msg_set_level "$SYSOP64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_msg_show_batch_start "$command"
bl64_vcs_run_git \
log \
--all \
--follow \
--oneline \
--decorate=short \
--full-history \
"$file_path"
bl64_msg_show_batch_finish $? "$command"
76 changes: 76 additions & 0 deletions src/git/git-file-history-show-diffs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/usr/bin/env bash
# template: 1.0.0
# template-import: 1.0.0
#######################################
# GIT / File / History / Show Diffs
#
# Version: 1.0.0
#
#######################################
# Copyright [2024] [serdigital64@gmail.com]
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#######################################

#
# Imports
#

# template-import: 1.0.0
declare SYSOP64_CORE_PATH_ROOT="${SYSOP64_CORE_PATH_ROOT:-/opt/sysop64}"
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/core/core-lib" || { echo "Error: unable to load module library" && exit 1; }
# shellcheck disable=SC2015 source-path=SCRIPTDIR/../../lib/bl64
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-xsv.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-bsh.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fmt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-fs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-rxtx.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-txt.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-api.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-module-vcs.bash" &&
source "${SYSOP64_CORE_PATH_BL64}/bashlib64-core.bash" ||
{ echo "Error: unable to load bashlib64" && exit 1; }
# shellcheck source-path=SCRIPTDIR/..
source "${SYSOP64_CORE_PATH_ROOT}/git/git-lib" || { echo "Error: unable to load module library" && exit 1; }

#
# Functions
#

function initialize() {
bl64_dbg_app_show_function
bl64_check_parameter 'file_path'
}

#
# Main
#

declare file_path="${1:-}"
declare command='git-file-history-show-diffs'

bl64_dbg_set_level "$SYSOP64_CORE_SET_DEBUG" && bl64_msg_set_level "$SYSOP64_CORE_SET_VERBOSE" || exit $?
initialize || exit $?

bl64_msg_show_batch_start "$command"
bl64_vcs_run_git \
log \
--pretty=format:"======[start diff for commit]===[%ai]===[%h(%s)]==========================================" \
--patch \
--all \
--follow \
--decorate=short \
--full-history \
"$file_path"
bl64_msg_show_batch_finish $? "$command"
Loading

0 comments on commit 5d56740

Please sign in to comment.