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

Docker Image does not contain files stored in git LFS: v2.0.6 #197

Closed
deric4 opened this issue Jul 2, 2020 · 4 comments
Closed

Docker Image does not contain files stored in git LFS: v2.0.6 #197

deric4 opened this issue Jul 2, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@deric4
Copy link

deric4 commented Jul 2, 2020

I don't think the xlsx files stored in git lfs are getting pulled correctly by whatever CI is being used to build/push the image to docker hub. It looks like only the refs are being added (note file size of xlsx files):

$ docker run -it -v$(pwd):/share --entrypoint="" mitre/inspec_tools:2.0.6  /bin/sh -c 'ls -la $(dirname $(gem which inspec_tools))/data'
total 2428
drwxr-xr-x    2 root     root          4096 Jul  1 16:21 .
drwxr-xr-x    8 root     root          4096 Jul  1 16:21 ..
-rw-r--r--    1 root     root           131 Jul  1 16:21 NIST_Map_02052020_CIS_Controls_Version_7.1_Implementation_Groups_1.2.xlsx
-rw-r--r--    1 root     root           130 Jul  1 16:21 NIST_Map_09212017B_CSC-CIS_Critical_Security_Controls_VER_6.1_Excel_9.1.2016.xlsx
-rw-r--r--    1 root     root          1039 Jul  1 16:21 README.TXT
-rw-r--r--    1 root     root       2376821 Jul  1 16:21 U_CCI_List.xml
-rw-r--r--    1 root     root          1081 Jul  1 16:21 attributes.yml
-rw-r--r--    1 root     root          5936 Jul  1 16:21 cci2html.xsl
-rw-r--r--    1 root     root           320 Jul  1 16:21 mapping.yml
-rw-r--r--    1 root     root            73 Jul  1 16:21 rubocop.yml
-rw-r--r--    1 root     root         57349 Jul  1 16:21 stig.csv
-rw-r--r--    1 root     root           904 Jul  1 16:21 threshold.yaml

This is causing the xlsx2inspec command to fail in the following way:

$ docker run -it -v$(pwd):/share  mitre/inspec_tools xlsx2inspec  -m <mappings> -p <prefix>l -x <benchmark>.xlsx
Traceback (most recent call last):
        25: from /usr/local/bundle/bin/inspec_tools:23:in `<main>'
        24: from /usr/local/bundle/bin/inspec_tools:23:in `load'
        23: from /usr/local/bundle/gems/inspec_tools-2.0.6/exe/inspec_tools:14:in `<top (required)>'
        22: from /usr/local/bundle/gems/inspec-core-4.21.1/lib/inspec/base_cli.rb:35:in `start'
        21: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
        20: from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
        19: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
        18: from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
        17: from /usr/local/bundle/gems/inspec_tools-2.0.6/lib/inspec_tools/plugin_cli.rb:95:in `xlsx2inspec'
        16: from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        15: from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
        14: from /usr/local/bundle/gems/inspec_tools-2.0.6/lib/inspec_tools/xlsx_tool.rb:14:in `<top (required)>'
        13: from /usr/local/bundle/gems/inspec_tools-2.0.6/lib/inspec_tools/xlsx_tool.rb:16:in `<module:InspecTools>'
        12: from /usr/local/bundle/gems/inspec_tools-2.0.6/lib/inspec_tools/xlsx_tool.rb:17:in `<class:XLSXTool>'
        11: from /usr/local/bundle/gems/roo-2.8.3/lib/roo/spreadsheet.rb:11:in `open'
        10: from /usr/local/bundle/gems/roo-2.8.3/lib/roo/spreadsheet.rb:11:in `new'
         9: from /usr/local/bundle/gems/roo-2.8.3/lib/roo/excelx.rb:61:in `initialize'
         8: from /usr/local/bundle/gems/roo-2.8.3/lib/roo/excelx.rb:398:in `process_zipfile'
         7: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/file.rb:111:in `open'
         6: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/file.rb:111:in `new'
         5: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/file.rb:81:in `initialize'
         4: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/file.rb:81:in `open'
         3: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/file.rb:82:in `block in initialize'
         2: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/central_directory.rb:136:in `read_from_stream'
         1: from /usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/central_directory.rb:103:in `read_e_o_c_d'
/usr/local/bundle/gems/rubyzip-1.3.0/lib/zip/central_directory.rb:143:in `get_e_o_c_d': Zip end of central directory signature not found (Zip::Error)

Downloading the NIST_Map_02052020_CIS_Controls_Version_7.1_Implementation_Groups_1.2.xlsx file and copying into the container works, but def a big speed bump in figuring out how to use a new project correctly 🙃

I'm guessing this is the same problem causing #180

Thanks!

@Bialogs Bialogs added the bug Something isn't working label Jul 15, 2020
@Bialogs
Copy link
Contributor

Bialogs commented Jul 15, 2020

Instead of implementing a hack in the build process to get this file I say we just push up the delivery of #134

Related docker/hub-feedback#500

@Bialogs
Copy link
Contributor

Bialogs commented Jul 21, 2020

Can you please check out 2.0.7 on https://hub.docker.com/r/mitre/inspec_tools/tags and let me know if you have any issues?

@deric4
Copy link
Author

deric4 commented Jul 21, 2020

@Bialogs its working! Thanks! I'm getting a correction to stdout for each control now though, which I don't think was happening before 🤔

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols

@Bialogs
Copy link
Contributor

Bialogs commented Jul 21, 2020

Great I will close this issue.

The correction you are describing is a new feature that runs the output Ruby through Rubocop so that you start with a linted profile (mostly to replace double quote strings with single quote strings) which is the preferred style.

@Bialogs Bialogs closed this as completed Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants