diff --git a/.ci/Dockerfile b/.ci/Dockerfile index c655a2d64..6aef70ac2 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -18,7 +18,8 @@ FROM golang:1.19-alpine@sha256:276692412aea6f9dd6cdc5725b2f1c05bef8df7223811afbc RUN apk add --no-cache git bash curl zip # Install yq -RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/v4.9.5/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq +ENV YQ_VERSION=v4.44.1 +RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq RUN yq # Copy the registry build tools diff --git a/build-tools/cache_samples.sh b/build-tools/cache_samples.sh index f3d0fb384..1d532572b 100755 --- a/build-tools/cache_samples.sh +++ b/build-tools/cache_samples.sh @@ -47,14 +47,16 @@ function cache_sample() { sampleDir=$tempDir/$sampleName # Git clone the sample project - gitRepository="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.remotes.origin)' -)" - revision="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.revision)' -)" + gitRepository="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.remotes.origin)' -)" + revision="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.revision)' -)" if [[ $gitRepository == "null" ]]; then - for version in $(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[].version)' -); do - gitRepository="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[] | select(.version == "'${version}'")' -| yq e '.git.remotes.origin' -)" - revision="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[] | select(.version == "'${version}'")' -| yq e '.git.revision' -)" + for version in $(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[].version)' -); do + gitRepository="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '.versions[] | select(.version == "'${version}'")' -| yq e '.git.remotes.origin' -)" + revision="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '.versions[] | select(.version == "'${version}'")' -| yq e '.git.revision' -)" clone_sample_repo $gitRepository $sampleDir/$version $revision - mkdir $outputDir/$version + if [ ! -d $outputDir/$version ]; then + mkdir $outputDir/$version + fi cache_devfile $sampleDir/$version $outputDir/$version $sampleName done else @@ -63,7 +65,7 @@ function cache_sample() { fi # Cache the icon for the sample - local iconPath="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.icon)' -)" + local iconPath="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.icon)' -)" if [[ $iconPath != "null" ]]; then urlRegex='(https?)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' if [[ $iconPath =~ $urlRegex ]]; then diff --git a/build-tools/dl_starter_projects.sh b/build-tools/dl_starter_projects.sh index 83b0553b0..f23b1e0ec 100755 --- a/build-tools/dl_starter_projects.sh +++ b/build-tools/dl_starter_projects.sh @@ -16,7 +16,7 @@ # limitations under the License. # Path of stacks directory in the registry -STACKS_DIR=/registry/stacks +STACKS_DIR=${STACKS_DIR:-/registry/stacks} # List of starter projects to use offline offline_starter_projects=( "$@" ) # When no starter projects are specifed,