Skip to content

Commit c03bc2c

Browse files
chore (samples) Warn user about fails on user_import_data_to_catalog.sh (#489)
* Added error message on creating gcs bucket. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 2ca8240 commit c03bc2c

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

java-retail/samples/interactive-tutorials/user_import_data_to_catalog.sh

+28-15
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,36 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# set the key as GOOGLE_APPLICATION_CREDENTIALS
18-
export GOOGLE_APPLICATION_CREDENTIALS=~/key.json
17+
{
18+
# set the key as GOOGLE_APPLICATION_CREDENTIALS
19+
export GOOGLE_APPLICATION_CREDENTIALS=~/key.json
1920

20-
# Change the working directory
21-
cd ~/cloudshell_open/java-retail/samples/interactive-tutorials/ || exit
21+
# Change the working directory
22+
cd ~/cloudshell_open/java-retail/samples/interactive-tutorials/ || exit
2223

23-
# Run the sample for creating the GCS bucket and extract the output of that execution
24-
output=$(mvn compile exec:java -Dexec.mainClass="product.setup.ProductsCreateGcsBucket")
24+
# Run the sample for creating the GCS bucket and extract the output of that execution
25+
output=$(mvn compile exec:java -Dexec.mainClass="product.setup.ProductsCreateGcsBucket")
2526

26-
# Get the bucket name and store it in the env variable BUCKET_NAME
27-
temp="${output#*gcs bucket }"
28-
bucket_name="${temp% was created*}"
29-
export BUCKET_NAME=$bucket_name
27+
# Get the bucket name and store it in the env variable BUCKET_NAME
28+
temp="${output#*gcs bucket }"
29+
bucket_name="${temp% was created*}"
30+
export BUCKET_NAME=$bucket_name
3031

31-
# Import products to the Retail catalog
32-
mvn compile exec:java -Dexec.mainClass="product.ImportProductsGcs"
32+
# Import products to the Retail catalog
33+
mvn compile exec:java -Dexec.mainClass="product.ImportProductsGcs"
3334

34-
echo "====================================="
35-
echo "Your Retail catalog is ready to use!"
36-
echo "====================================="
35+
} && {
36+
37+
# Print success message
38+
echo "====================================="
39+
echo "Your Retail catalog is ready to use!"
40+
echo "====================================="
41+
42+
} || {
43+
44+
# Print error message
45+
echo "====================================="
46+
echo "Your Retail catalog wasn't created! Please fix the errors above!"
47+
echo "====================================="
48+
49+
}

0 commit comments

Comments
 (0)