-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized bash scripts #119
base: master
Are you sure you want to change the base?
Conversation
scripts/generate-certs.sh
Outdated
# 📍 Setting default values for CA certificate | ||
COUNTRY="US" | ||
STATE="YourState" | ||
CITY="YourCity" | ||
ORG="YourOrganization" | ||
ORG_UNIT="YourOrganizationalUnit" | ||
COMMON_NAME="adcs-issuer Test CA" | ||
KEY_SIZE=4096 | ||
DAYS_VALID=3650 # 10 years |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 📍 Setting default values for CA certificate | |
COUNTRY="US" | |
STATE="YourState" | |
CITY="YourCity" | |
ORG="YourOrganization" | |
ORG_UNIT="YourOrganizationalUnit" | |
COMMON_NAME="adcs-issuer Test CA" | |
KEY_SIZE=4096 | |
DAYS_VALID=3650 # 10 years | |
# 📍 Setting default values for CA certificate | |
COUNTRY='US' | |
STATE='YourState' | |
CITY='YourCity' | |
ORG='YourOrganization' | |
ORG_UNIT='YourOrganizationalUnit' | |
COMMON_NAME='adcs-issuer Test CA' | |
KEY_SIZE='4096' | |
DAYS_VALID='3650' # 10 years |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggests using doubles everywhere. @djkormo
|
||
mkdir -pv "${OUTPUT_DIR}/ca" | ||
echo "🔧 Creating directories..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "🔧 Creating directories..." | |
echo '🔧 Creating directories...' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change without impact. Doesn't understand why it changed to single.
-config "${CA_DIR}/ca.cnf" | ||
|
||
# 📍 Copying certificates to test files | ||
echo "📂 Copying certificates..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "📂 Copying certificates..." | |
echo '📂 Copying certificates...' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change without impact. Doesn't understand why it changed to single,
cp -v "${CA_DIR}/ca.pem" "${OUTPUT_DIR}/pkcs7.pem" | ||
cp -v "${CA_DIR}/ca.pem" "${OUTPUT_DIR}/x509.pem" | ||
|
||
echo "✅ Certificates successfully generated!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "✅ Certificates successfully generated!" | |
echo '✅ Certificates successfully generated!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change without impact. Doesn't understand why it changed to single.
Description
In common_utils.sh script:
Key Improvements
✅ Uses kubectl wait instead of an inefficient polling loop with sleep.
✅ Removes redundant kubectl get pods calls, reducing API requests.
✅ Adds set -e to exit immediately on failure, improving script safety.
✅ Uses standard exit codes (1 instead of -1) for better compatibility.
✅ Uses local for variables to avoid polluting the global namespace.
In generate-certs.sh script:
The improvements include:
✅ Better error handling – added error messages.
✅ Variability and flexibility – option to change parameters without editing the code.
✅ Consistency and readability – structured code with clear messages.
Motivation and Context
Closes #
Screenshots (if appropriate):
How Has This Been Tested?
Tested localy.
Checklist:
make generate
and checked in the results.make manifests
and checked in the results.For new code releases:
appVersion
in the Helm chart.For new Helm chart releases: