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

GS-8481/TTO-178: Fix missing indicators in MARC records in OAI; update dependencies & actions #27

Merged
merged 5 commits into from
Feb 7, 2024

Conversation

aelkiss
Copy link
Member

@aelkiss aelkiss commented Feb 5, 2024

This PR addresses the bug reported at https://hathitrust.atlassian.net/browse/GS-8481 - we were not correctly transferring the "indicator" field from the input MARC record to the version we output. I added a test to address this. This is covered in the first commit. @moseshll I think this part is the main thing you need to look at.

I took the opportunity to update dependencies, Dockerfile, docker-compose, and github actions to something I believe is closer to our current "state of the art". In particular this:

  • Updates to ruby 3.3 and Sinatra 4 (no changes to code or tests required for this). @moseshll you may want to take a look at this as well.

Along with this, there are a bunch of containerization & CI updates:

  • Removes the separate Dockerfile.prod and uses a multi-stage build to achieve the same thing
  • Uses the latest build action from Action updates otis#209
  • Uses health checks in docker compose rather than relying on wait-for.

solr-sdr-catalog:
condition: service_healthy
mariadb:
condition: service_healthy

test:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ronster2018 Note that the test service here is almost entirely duplicative of the web one except for the command. Do you have any suggestions for reducing that duplication? One option would be to just remove the test service entirely and specify docker compose run web bundle exec rspec in .github/workflows/tests.yml, but we don't really have any consistency/standards around this...

Copy link
Contributor

@Ronster2018 Ronster2018 Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aelkiss This could be a good spot to use Aliases and Anchors. Fortunately it's something built into YAML and I found some documentation about it on the official docker website. https://docs.docker.com/compose/compose-file/10-fragments/. It's not something I have used extensively but it's a solid method for reducing repetition in the same file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I'll take a look and give it a try here. I've seen this YAML construct in Rails configuration before for example https://github.com/hathitrust/otis/blob/main/config/database.yml but not written any YAML that uses it. It's good to know this is a supported feature of the compose specification rather than just something part of YAML that may or may not really be supported as part of compose.

Copy link
Member Author

@aelkiss aelkiss Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ronster2018 I gave this a try with fragments and extensions; see what you think. I'm also curious @moseshll what you think of this (see https://docs.docker.com/compose/compose-file/10-fragments/, also https://docs.docker.com/compose/compose-file/11-extension/)


solr-sdr-catalog:
image: ghcr.io/hathitrust/catalog-solr-sample
ports:
- "9033:9033"
healthcheck:
test: [ "CMD", "/usr/bin/curl", "-s", "-f", "http://localhost:9033/solr/catalog/admin/ping"]
interval: 5s
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ronster2018 I think the healthcheck built-in option is preferable to using wait-for (https://github.com/eficode/wait-for) everywhere, but including all the timing parameters does make the docker-compose.yml harder to read. Any thoughts there?

@@ -60,7 +60,7 @@ def field974_to_field856(field974)
# @param [Array]
def add_field(full_marc, tag, subfield_codes)
full_marc.each_by_tag(tag) do |field|
new_field = MARC::DataField.new(field.tag, field["ind1"], field["ind2"])
new_field = MARC::DataField.new(field.tag, field.indicator1, field.indicator2)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moseshll This is the only substantive change; note the test below

@aelkiss aelkiss force-pushed the GS-8481-missing-indicators branch 3 times, most recently from 938c8ce to b5e68d8 Compare February 5, 2024 22:09
@coveralls
Copy link

coveralls commented Feb 5, 2024

Coverage Status

coverage: 100.0%. remained the same
when pulling 645c760 on GS-8481-missing-indicators
into 39d5aa0 on main.

@aelkiss
Copy link
Member Author

aelkiss commented Feb 5, 2024

Unfortunately because I renamed the action and there is no build.yaml on main, I will need to wait to test the action until we merge to main, at which point I can manually deploy to staging.

* Use build workflow from hathitrust/otis#209
* Use multi-stage docker build rather than Dockerfile.prod
* Remove deployment workflows
* Update to ruby 3.3, sinatra 4
* Remove wait-for and use health checks via docker compose
* Change path for validate-cache (see
  hathitrust/feed@22bfa8c)
@aelkiss aelkiss force-pushed the GS-8481-missing-indicators branch from b5e68d8 to b09c840 Compare February 5, 2024 22:23
@aelkiss aelkiss requested a review from Ronster2018 February 6, 2024 14:32
@aelkiss
Copy link
Member Author

aelkiss commented Feb 6, 2024

Also @moseshll I did at least give this a try in development and verify that it started correctly and that MARC fields that were previously missing indicators have them now.

netcat I think was only for wait-for and libxerces is only for
validate-cached which we use only in tests
@aelkiss aelkiss changed the title GS-8481: Fix missing indicators in MARC records in OAI; update dependencies & actions GS-8481/TTO-178: Fix missing indicators in MARC records in OAI; update dependencies & actions Feb 6, 2024
Copy link
Contributor

@Ronster2018 Ronster2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the changes to the Dockerfile, docker-compose.yml, and the actions look good to me and the necessary changes have been made. I believe we are just waiting on @moseshll to review a few things. Adding my stamp of approval.

Copy link
Contributor

@moseshll moseshll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of fiddling around until I found the right combination of DOCKER_DEFAULT_PLATFORM=linux/amd64 incantations. (For some reason I had to run the amd64 version of feed from a separate repo -- or at least I was able to make things work after trying that.)

I'd like to try getting feed a little more tractable on ARM if it will remain a dependency in the medium to long term.

Edit: I should have said, I am happy with the changes that were made for this PR.

@aelkiss aelkiss merged commit be40441 into main Feb 7, 2024
1 check passed
@aelkiss aelkiss deleted the GS-8481-missing-indicators branch February 7, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants