Skip to content
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

Add jar/zip support #2280

Merged
merged 6 commits into from
Dec 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,29 @@ if [ -n "$CORRELATION_ID" ]; then
echo "$CORRELATION_ID" > "$build_env_dir/CORRELATION_ID"
fi

while [[ ! -f "$temp_app_source_path" || ! "$(file $temp_app_source_path)" =~ "compressed data" ]]
file_type=""
while [[ ! -f "$temp_app_source_path" ]] ||
[[ ! $file_type =~ "compressed data" ]] &&
[[ ! $file_type =~ "Zip archive data" ]] &&
[[ ! $file_type =~ "Java archive data" ]]
do
echo "Waiting for app source to be uploaded. Please upload the app source to the endpoint specified in the Build resource's 'uploadEndpoint' property."
curl -H "$auth_header" -H "$version_header" -H "$date_header" -X GET "$file_upload_endpoint" -o "$temp_app_source_path" -s
sleep 5
showpune marked this conversation as resolved.
Show resolved Hide resolved
file_type=$(file $temp_app_source_path)
done

# Extract app code to CNB_APP_DIR directory.
echo "Found app source at '$temp_app_source_path'. Extracting to $CNB_APP_DIR"
mkdir -p $CNB_APP_DIR
cd $CNB_APP_DIR
tar -xzf "$temp_app_source_path"

if [[ $file_type =~ "Zip archive data" || $file_type =~ "Java archive data" ]]; then
unzip -qq "$temp_app_source_path"
else
# Keep compatibility with old logic
tar -xzf "$temp_app_source_path"
fi

fileCount=$(ls | wc -l)
if [ "$fileCount" = "1" ]; then
Expand Down