Skip to content

Commit 89fc566

Browse files
Bump yq to use v4.44.1 (#241)
* bump yq to v1.44.1 Signed-off-by: Michael Valdron <mvaldron@redhat.com> * skip creation of cached sample directory if exists Signed-off-by: Michael Valdron <mvaldron@redhat.com> --------- Signed-off-by: Michael Valdron <mvaldron@redhat.com>
1 parent 6694f0a commit 89fc566

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.ci/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ FROM golang:1.19-alpine@sha256:276692412aea6f9dd6cdc5725b2f1c05bef8df7223811afbc
1818
RUN apk add --no-cache git bash curl zip
1919

2020
# Install yq
21-
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
21+
ENV YQ_VERSION=v4.44.1
22+
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
2223
RUN yq
2324

2425
# Copy the registry build tools

build-tools/cache_samples.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ function cache_sample() {
4747
sampleDir=$tempDir/$sampleName
4848

4949
# Git clone the sample project
50-
gitRepository="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.remotes.origin)' -)"
51-
revision="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.revision)' -)"
50+
gitRepository="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.remotes.origin)' -)"
51+
revision="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.git.revision)' -)"
5252
if [[ $gitRepository == "null" ]]; then
53-
for version in $(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[].version)' -); do
54-
gitRepository="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[] | select(.version == "'${version}'")' -| yq e '.git.remotes.origin' -)"
55-
revision="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[] | select(.version == "'${version}'")' -| yq e '.git.revision' -)"
53+
for version in $(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.versions[].version)' -); do
54+
gitRepository="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '.versions[] | select(.version == "'${version}'")' -| yq e '.git.remotes.origin' -)"
55+
revision="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '.versions[] | select(.version == "'${version}'")' -| yq e '.git.revision' -)"
5656
clone_sample_repo $gitRepository $sampleDir/$version $revision
57-
mkdir $outputDir/$version
57+
if [ ! -d $outputDir/$version ]; then
58+
mkdir $outputDir/$version
59+
fi
5860
cache_devfile $sampleDir/$version $outputDir/$version $sampleName
5961
done
6062
else
@@ -63,7 +65,7 @@ function cache_sample() {
6365
fi
6466

6567
# Cache the icon for the sample
66-
local iconPath="$(yq e '(.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.icon)' -)"
68+
local iconPath="$(yq e '.samples[] | select(.name == "'${sampleName}'")' $devfileEntriesFile | yq e '(.icon)' -)"
6769
if [[ $iconPath != "null" ]]; then
6870
urlRegex='(https?)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
6971
if [[ $iconPath =~ $urlRegex ]]; then

build-tools/dl_starter_projects.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# limitations under the License.
1717

1818
# Path of stacks directory in the registry
19-
STACKS_DIR=/registry/stacks
19+
STACKS_DIR=${STACKS_DIR:-/registry/stacks}
2020
# List of starter projects to use offline
2121
offline_starter_projects=( "$@" )
2222
# When no starter projects are specifed,

0 commit comments

Comments
 (0)