Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generation script to handle non-versioned items #460

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions .ci/generate_last_mod_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,38 @@ grab_samples(){
version=$(echo "$line" | cut -d ' ' -f 2)
revision=$(echo "$line" | cut -d ' ' -f 3)
git_origin=$(echo "$line" | cut -d ' ' -f 4)
repo_name="$name"-"$revision"

git clone -q -b $revision $git_origin $repo_name
if [[ $revision == "null" ]]; then
repo_name="$name"
git clone -q $git_origin $repo_name
else
repo_name="$name"-"$revision"
git clone -q -b $revision $git_origin $repo_name
fi

cd $repo_name
last_commit=$(git log -1 --format="%aI")
cd $TEMP_DIR
sample_data+=("{\"name\": \"${name}\",\"version\": \"${version}\",\"lastModified\": \"${last_commit}\"}")
done < <(jq -r '.samples[] | "\(.name) \(.versions[] | "\(.version) \(.git.revision) \(.git.remotes.origin)")"' $PARENT_DIR/data.json)
done < <(jq -r '
.samples[] |
if has("versions")
then
"\(.name) \(.versions[] | "\(.version) \(.git.revision) \(.git.remotes.origin)")"
elif .git.revision != null
then
"\(.name) null \(.git.revision) \(.git.remotes.origin)"
else
"\(.name) null null \(.git.remotes.origin)"
end
' $PARENT_DIR/data.json)

cd $PARENT_DIR

# cleanup of temp files and temp data store
echo "Cleaning up temp files"
rm -rf $PARENT_DIR/temp
rm $PARENT_DIR/data.json

}

create_last_modified_file() {
Expand Down
Loading