-
Notifications
You must be signed in to change notification settings - Fork 1
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 ABL scripts to use CORGI #2235
Changes from 4 commits
6fc8934
aca375e
1e4bb05
65454d7
57966b0
03e584a
a5de2e8
485af50
ce42f43
0eee5fb
4367131
e3ac1df
025c7df
ba7aab9
bd0f689
ca1e50c
898a747
461bde3
d000cff
f31d3fe
1e31114
6b45b67
4120791
72e6ab4
9c0251c
3d0bcb9
993fee0
9124b5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
data="$1" | ||
data="${data:?}" | ||
configured_books="$2" | ||
configured_books="${configured_books:?}" | ||
|
||
# shellcheck disable=SC2016 | ||
new_version_filter='[ | ||
# Get the newest version of each book | ||
$corgi_abl | group_by(.uuid) | .[] | sort_by(.commited_at) | .[-1] | | ||
|
||
# Store information about the entry (uuid and short sha) | ||
.uuid as $uuid | | ||
(.commit_sha | .[0:7]) as $commit_sha | | ||
|
||
# Select entries that do not match configured books | ||
select($configured_books | .[$uuid] | .defaultVersion != $commit_sha) | | ||
{ key: .uuid, value: $commit_sha } | ||
] | from_entries' | ||
|
||
jq \ | ||
--null-input \ | ||
--compact-output \ | ||
--argjson configured_books "$configured_books" \ | ||
--argjson corgi_abl "$data" \ | ||
"$new_version_filter" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,10 @@ for input_file in "$my_dir"/*.input.json; do | |
# Actual test goes here | ||
# ------------------------- | ||
json=$(cat "$input_file") | ||
node "$my_dir/../entry.js" transform-approved-books-data --data "$json" > "$output_file" | ||
configured_books="{}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't there be tests that exercise the logic of diffing the books against the existing config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the quick review! Yes, that completely slipped my mind. I added some additional test data for this. The smaller of the new data sets demonstrates what occurs when new versions are present, the other uses some real data to demonstrate that there are no new entries when all ABL versions are already present. |
||
|
||
bash "$my_dir/../transform-approved-books-data.bash" \ | ||
"$json" "$configured_books" > "$output_file" | ||
|
||
diff "$snapshot_file" "$output_file" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure it really matters, but this seems like a lot to be putting in the arguments. maybe it could read
data
from stdin andconfigured_books
from a given file path?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point. I originally used inputs like this to separate fetching from transformation and the errors that could occur in each process. I updated the transformation script to read input from 2 files and do some additional checks on the input.