diff --git a/scripts/shell/job/artifactory-rebuild-maven-metadata-xml-massively-for-cdk-version.sh b/scripts/shell/job/artifactory-rebuild-maven-metadata-xml-massively-for-cdk-version.sh new file mode 100755 index 0000000..8ed8815 --- /dev/null +++ b/scripts/shell/job/artifactory-rebuild-maven-metadata-xml-massively-for-cdk-version.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +cdk_version=$1 + +cdk_paths_unfiltered=$(jf rt search --recursive=false 'cpqd-snapshot/br/com/cpqd/**/13.30.132-SNAPSHOT/' | jq -r '.[].path') +cdk_paths=$(for p in ${cdk_paths_unfiltered[@]}; do dirname $p; done | uniq) + +# needs pwd to be in PATH +for p in ${cdk_paths[@]}; do artifactory-rebuild-maven-metadata-xml.sh $p; done diff --git a/scripts/shell/job/artifactory-rebuild-maven-metadata-xml.sh b/scripts/shell/job/artifactory-rebuild-maven-metadata-xml.sh new file mode 100755 index 0000000..098a031 --- /dev/null +++ b/scripts/shell/job/artifactory-rebuild-maven-metadata-xml.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +metadata_path=$1 + +curl -v -X POST https://artifactory.cpqd.com.br/artifactory/api/maven/calculateMetadata/$metadata_path diff --git a/scripts/shell/job/git-commit-with-jira.sh b/scripts/shell/job/git-commit-with-jira.sh new file mode 100755 index 0000000..37ac54a --- /dev/null +++ b/scripts/shell/job/git-commit-with-jira.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Array of prefixes to look for +prefixes=("ETICS" "CDK" "IM") # Add your prefixes here + +# Get the current working directory +current_dir=$(pwd) + +# Find the first occurrence of a folder containing any of the specified prefixes +for prefix in "${prefixes[@]}"; do + found_string=$(find "$current_dir" -type d -path "*${prefix}*" | head -n 1) + if [ -n "$found_string" ]; then + break + fi +done + +# Check if a matching folder is found +if [ -z "$found_string" ]; then + echo "Error: No folder containing the specified prefixes found in the current directory or its subdirectories." +else + # Extract the prefix and number from the folder name + regex="${prefixes[0]}-[0-9]+" # Assuming the first prefix for simplicity + etics_number=$(echo "$found_string" | grep -oE "$regex" | tail -n 1) + + # Get the commit message parameter + commit_message=$1 + + # Run the git commit command + git commit -m "[$etics_number] $commit_message" +fi diff --git a/scripts/shell/job/jira-get-packages-with-closed-issues.sh b/scripts/shell/job/jira-get-packages-with-closed-issues.sh new file mode 100755 index 0000000..299b86e --- /dev/null +++ b/scripts/shell/job/jira-get-packages-with-closed-issues.sh @@ -0,0 +1,33 @@ +# !/bin/bash + +GP_REPOS=(oss-package-dev/gp oss-package-rel/gp cpqd-snapshot/br/com/cpqd/etics/cpqd-etics cpqd-release/br/com/cpqd/etics/cpqd-etics) + +echo -n Password for user "$USER": +read -s password + +for gp_repo in ${GP_REPOS[@]}; do + packages_path=`jf rt search --include-dirs=true --recursive=false "$gp_repo/*" | jq -r '.[].path' | grep 'ETICS-'` + + for package in ${packages_path[@]}; do + package_jira=`grep -Eo 'ETICS-[[:digit:]]*' <<< "$package"` + + jira_json=`curl --silent --user $USER:$password https://jira.cpqd.com.br/rest/api/2/issue/$package_jira` + + jira_fields=`jq '.fields' <<< $jira_json` + jira_status=`jq '.status.name' <<< $jira_fields` + + if [[ $jira_status == *"Closed"* ]]; then + jira_assignee=`jq '.assignee.name' <<< $jira_fields` + jira_reporter=`jq '.reporter.name' <<< $jira_fields` + + echo -e "\n" + + echo "Pacote: \"$package\"" + echo "Jira fechado: \"$package_jira\" (https://jira.cpqd.com.br/browse/$package_jira)" + echo "Responsável: $jira_assignee" + echo "Reportador: $jira_reporter" + + echo -e "\n\n\n" + fi + done +done diff --git a/scripts/shell/job/k8s-ssh-control-plane.sh b/scripts/shell/job/k8s-ssh-control-plane.sh new file mode 100755 index 0000000..b148ab6 --- /dev/null +++ b/scripts/shell/job/k8s-ssh-control-plane.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +control_plane_ip=`kubectl get nodes --no-headers --selector 'node-role.kubernetes.io/control-plane' -o wide | awk '{print $6}'` +ssh k8s@$control_plane_ip diff --git a/scripts/shell/klogs.sh b/scripts/shell/job/klogs.sh similarity index 100% rename from scripts/shell/klogs.sh rename to scripts/shell/job/klogs.sh diff --git a/job/rcloneSyncObsidian.sh b/scripts/shell/job/rclone-sync-obsidian.sh old mode 100644 new mode 100755 similarity index 100% rename from job/rcloneSyncObsidian.sh rename to scripts/shell/job/rclone-sync-obsidian.sh diff --git a/scripts/shell/job/svn-get-folder-size.sh b/scripts/shell/job/svn-get-folder-size.sh new file mode 100755 index 0000000..fe2c821 --- /dev/null +++ b/scripts/shell/job/svn-get-folder-size.sh @@ -0,0 +1 @@ +svn list -vR $1 | awk '{tmp=match($3,/[0-9]/);if(tmp){sum+=$3; i++}} END {print "\ntotal size= " sum/1024000" MB" "\nnumber of files= " i/1000 " K"}' diff --git a/scripts/shell/job/svn-log-stop-on-copy.sh b/scripts/shell/job/svn-log-stop-on-copy.sh new file mode 100755 index 0000000..06239f0 --- /dev/null +++ b/scripts/shell/job/svn-log-stop-on-copy.sh @@ -0,0 +1,4 @@ +# !/bin/bash + +SVN_DIR=$1 +svn log -v --stop-on-copy $SVN_DIR | less