Skip to content

Commit 9aaa55a

Browse files
committed
version 0.0.4 better envs, handle artifacts
1 parent c81069e commit 9aaa55a

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed

bitrise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ app:
55
envs:
66
# If you want to share this step into a StepLib
77
- BITRISE_STEP_ID: device-cloud-for-maestro
8-
- BITRISE_STEP_VERSION: "0.0.3"
8+
- BITRISE_STEP_VERSION: "0.0.4"
99
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/devicecloud-dev/bitrise-integration.git
1010
- MY_STEPLIB_REPO_FORK_GIT_URL: [email protected]:devicecloud-dev/bitrise-integration.git
1111

step.sh

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/bin/sh
22

33
# Parse env variables
4-
env_list=""
5-
if [ -n "$env" ]; then
6-
# Convert Bitrise key-value format to -e KEY=VALUE format
7-
while IFS='|' read -r key value || [ -n "$key" ]; do
4+
env_list_parsed=""
5+
if [ -n "$env_list" ]; then
6+
# Convert newline-separated key-value pairs to -e KEY=VALUE format
7+
while IFS='=' read -r key value; do
88
if [ -n "$key" ]; then
99
# Append each env var with -e prefix
10-
env_list="$env_list -e $key=$value"
10+
env_list_parsed="$env_list_parsed -e $key=$value"
1111
fi
12-
done <<< "$env"
12+
done <<< "$env_list"
1313
fi
1414

1515
# Refine variables
@@ -22,31 +22,30 @@ cd $BITRISE_SOURCE_DIR
2222
EXIT_CODE=0
2323

2424
# Log all variables for debugging
25-
echo "Environment variables:"
26-
echo "api_key: $api_key"
27-
echo "api_url: $api_url"
28-
echo "app_binary_id: $app_binary_id"
25+
echo "DCD variables:"
2926
echo "additional_app_binary_ids: $additional_app_binary_ids"
3027
echo "additional_app_files: $additional_app_files"
3128
echo "android_api_level: $android_api_level"
3229
echo "android_device: $android_device"
30+
echo "api_key: $api_key"
31+
echo "api_url: $api_url"
32+
echo "app_binary_id: $app_binary_id"
33+
echo "app_file: $app_file"
3334
echo "async: $async"
3435
echo "device_locale: $device_locale"
3536
echo "download_artifacts: $download_artifacts"
37+
echo "env_list: $env_list"
3638
echo "exclude_flows: $exclude_flows"
3739
echo "exclude_tags: $exclude_tags"
3840
echo "google_play: $google_play"
3941
echo "include_tags: $include_tags"
40-
echo "ios_version: $ios_version"
4142
echo "ios_device: $ios_device"
43+
echo "ios_version: $ios_version"
44+
echo "is_async: $is_async"
4245
echo "name: $name"
4346
echo "orientation: $orientation"
4447
echo "retry: $retry"
45-
echo "env: $env"
46-
echo "app_file: $app_file"
4748
echo "workspace: $workspace"
48-
echo "env_list: $env_list"
49-
echo "is_async: $is_async"
5049

5150

5251
echo "Running command: npx --yes @devicecloud.dev/dcd cloud --quiet \
@@ -69,7 +68,7 @@ ${ios_device:+--ios-device \"$ios_device\"} \
6968
${name:+--name \"$name\"} \
7069
${orientation:+--orientation \"$orientation\"} \
7170
${retry:+--retry \"$retry\"} \
72-
${env:+ $env} \
71+
${env_list_parsed} \
7372
\"$app_file\" \"$workspace\""
7473

7574
npx --yes @devicecloud.dev/dcd cloud --quiet \
@@ -92,9 +91,26 @@ ${ios_device:+--ios-device "$ios_device"} \
9291
${name:+--name "$name"} \
9392
${orientation:+--orientation "$orientation"} \
9493
${retry:+--retry "$retry"} \
95-
${env:+ $env} \
94+
${env_list_parsed} \
9695
"$app_file" "$workspace" || EXIT_CODE=$?
9796

98-
# to do: handle download artifacts
97+
# Handle artifacts download
98+
if [ -n "$download_artifacts" ] && [ -f "artifacts.zip" ]; then
99+
case "$download_artifacts" in
100+
"ALL"|"FAILED")
101+
echo "Extracting artifacts.zip (mode: $download_artifacts)..."
102+
unzip -o artifacts.zip -d "$BITRISE_DEPLOY_DIR"
103+
if [ $? -eq 0 ]; then
104+
echo "Artifacts successfully extracted to $BITRISE_DEPLOY_DIR"
105+
else
106+
echo "Warning: Failed to extract artifacts.zip"
107+
EXIT_CODE=1
108+
fi
109+
;;
110+
*)
111+
echo "Warning: Invalid download_artifacts value: $download_artifacts. Expected 'ALL' or 'FAILED'"
112+
;;
113+
esac
114+
fi
99115

100116
exit $EXIT_CODE

step.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,12 @@ inputs:
101101
is_expand: true
102102
is_required: false
103103

104-
- env: ""
104+
- env_list: ""
105105
opts:
106106
title: "Environment Variables"
107-
summary: "List of environment variables to pass to the test"
107+
summary: "List of environment variables to pass to the test seperated by newlines (e.g. MY_VAR=my_value <newline> MY_OTHER_VAR=other_value)"
108108
is_expand: true
109109
is_required: false
110-
category: keyvalue
111110

112111
- async: "false"
113112
opts:

0 commit comments

Comments
 (0)