Skip to content

Commit

Permalink
fix: remove unused escape sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
patriciocostilla committed Mar 1, 2024
1 parent 158a64e commit 68c6ef4
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions push_repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,55 @@

set -e

AUTH='Authorization: Bearer '$API_KEY
DATA=./modules.zip
# AUTH='Authorization: Bearer '$API_KEY
# DATA=./modules.zip

function log_error {
echo "ERROR: $1"
exit 1
}
# function log_error {
# echo "ERROR: $1"
# exit 1
# }

if [[ ! "$HOSTNAME" =~ ^https://.*[^/]$ ]]; then
log_error "The hostname '$HOSTNAME' is invalid."
fi
# if [[ ! "$HOSTNAME" =~ ^https://.*[^/]$ ]]; then
# log_error "The hostname '$HOSTNAME' is invalid."
# fi

if [ -z "$HOSTNAME" ]; then
log_error "The hostname cannot be empty"
fi
# if [ -z "$HOSTNAME" ]; then
# log_error "The hostname cannot be empty"
# fi

if [ -z "$API_KEY" ]; then
log_error "The API Key cannot be empty"
fi
# if [ -z "$API_KEY" ]; then
# log_error "The API Key cannot be empty"
# fi

if [ -z "$NAMESPACE" ]; then
log_error "The namespace cannot be empty"
fi
# if [ -z "$NAMESPACE" ]; then
# log_error "The namespace cannot be empty"
# fi

if [ -z "$NAME" ]; then
log_error "The name cannot be empty"
fi
# if [ -z "$NAME" ]; then
# log_error "The name cannot be empty"
# fi

VERSION=${VERSION#v}
# VERSION=${VERSION#v}

if [ -z "$VERSION" ]; then
log_error "The version cannot be empty"
fi
# if [ -z "$VERSION" ]; then
# log_error "The version cannot be empty"
# fi

if [ ! -d "$MODULES_PATH" ]; then
log_error "The directory '$MODULES_PATH' does not exists."
fi
# if [ ! -d "$MODULES_PATH" ]; then
# log_error "The directory '$MODULES_PATH' does not exists."
# fi

if [ -n "$LOWER_TERRAFORM_VERSION" ] || [ -n "$HIGHER_TERRAFORM_VERSION" ]; then
python3 /terraform_required_versions.py
echo 'The terraform required versions are compliant with the desired version range.'
fi
# if [ -n "$LOWER_TERRAFORM_VERSION" ] || [ -n "$HIGHER_TERRAFORM_VERSION" ]; then
# python3 /terraform_required_versions.py
# echo 'The terraform required versions are compliant with the desired version range.'
# fi

zip -r modules.zip $MODULES_PATH -x .git\* push_repository.sh terraform_required_versions.py requirements.txt $EXCLUDE
echo ''"$HOSTNAME"'/'"$NAMESPACE"'/'"$NAME"'/'"$SYSTEM"'/'"$VERSION"'/upload'
# zip -r modules.zip $MODULES_PATH -x .git\* push_repository.sh terraform_required_versions.py requirements.txt $EXCLUDE
# echo ''"$HOSTNAME"'/'"$NAMESPACE"'/'"$NAME"'/'"$SYSTEM"'/'"$VERSION"'/upload'

if [ "$DRY_RUN" = "false" ]; then
wget --no-check-certificate -v --method POST --timeout=0 --header "$AUTH" --header 'Content-Type: application/zip' \
--body-file="$DATA" ''"$HOSTNAME"'/'"$NAMESPACE"'/'"$NAME"'/'"$SYSTEM"'/'"$VERSION"'/upload'
else
echo "(DRY-RUN) Won\'t push anything to Terraform Registry"
echo "(DRY-RUN) Won't push anything to Terraform Registry"
fi

0 comments on commit 68c6ef4

Please sign in to comment.