devfile / api

Kube-native API for cloud development workspaces specification
Apache License 2.0
257 stars 61 forks source link

`cache_samples.sh` should create cache directory if does not exist #1553

Closed michael-valdron closed 4 months ago

michael-valdron commented 4 months ago

/kind bug

Which area is this bug related to?

/area registry

Bug Summary

Describe the bug:

The cache_samples.sh helper script fails if the given cache directory path does not exist.

To Reproduce:

Under cloned registry-support, run bash build-tools/cache_samples.sh <path_to_extraDevfileEntries.yaml> <non_existent_caching_path>

Expected behavior

The cache_samples.sh helper script should allow the creation of the cache directory if it does not exist.

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable

mkdir: cannot create directory ‘samples/.cache/nodejs-basic’: No such file or directory

Additional context

Blocking #1142

Any workaround?

Create the cache directory before running this script. This expects the creation of the cache directory to be handled by all consumers of this helper script.

Suggestion on how to fix the bug

Change mkdir $samplesDir/$sample to mkdir -p $samplesDir/$sample: https://github.com/devfile/registry-support/blob/f77b0bf0fc614951a199fb049db07832d833f4da/build-tools/cache_samples.sh#L106

michael-valdron commented 4 months ago

Sized to 1 to match time spent to create PR: https://github.com/devfile/registry-support/pull/239

PR is ready for review.