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

Add Hadolint - Haskell Dockerfile Linter #1095

Open
PeterDaveHello opened this issue Jun 19, 2021 · 0 comments
Open

Add Hadolint - Haskell Dockerfile Linter #1095

PeterDaveHello opened this issue Jun 19, 2021 · 0 comments

Comments

@PeterDaveHello
Copy link
Contributor

Hello, I'd like to know if we can add the most popular Dockerfile linter on Travis CI?

So that we can easily lint Dockerfile without any additional works but just focus on the lint result!

Here's its GitHub repository 👉 https://github.com/hadolint/hadolint/

I've prepared a simple patch for it as below and ready to send a pull request if you'd like to accept it!

Please let me know what do you think, thanks!

diff --git a/cookbooks/travis_build_environment/attributes/default.rb b/cookbooks/travis_build_environment/attributes/default.rb
index 895f2a2..48405f4 100644
--- a/cookbooks/travis_build_environment/attributes/default.rb
+++ b/cookbooks/travis_build_environment/attributes/default.rb
@@ -225,6 +225,9 @@ default['travis_build_environment']['gimme']['install_user'] = 'travis'
 default['travis_build_environment']['gimme']['install_user_home'] = '/home/travis'
 default['travis_build_environment']['gimme']['debug'] = false
 
+default['travis_build_environment']['hadolint_url'] = 'https://github.com/hadolint/hadolint/releases/download/v2.5.0/hadolint-Linux-x86_64'
+default['travis_build_environment']['hadolint_checksum'] = '6666cb1a002d71652c9972bcd3e5e100f65ea019c68c1a05b9428a8444d6f8f3'
+
 default['travis_build_environment']['haskell']['ghc_versions'] = %w[
   8.6.1
 ]
diff --git a/cookbooks/travis_build_environment/recipes/basic.rb b/cookbooks/travis_build_environment/recipes/basic.rb
index d38f10c..e0bac9d 100644
--- a/cookbooks/travis_build_environment/recipes/basic.rb
+++ b/cookbooks/travis_build_environment/recipes/basic.rb
@@ -76,6 +76,7 @@ end
 include_recipe 'travis_build_environment::yarn'
 include_recipe 'travis_build_environment::shellcheck'
 include_recipe 'travis_build_environment::shfmt'
+include_recipe 'travis_build_environment::hadolint'
 include_recipe 'travis_build_environment::mercurial'
 include_recipe 'travis_build_environment::locale'
 include_recipe 'travis_build_environment::hostname'
diff --git a/cookbooks/travis_build_environment/recipes/hadolint.rb b/cookbooks/travis_build_environment/recipes/hadolint.rb
new file mode 100644
index 0000000..79eae75
--- /dev/null
+++ b/cookbooks/travis_build_environment/recipes/hadolint.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+remote_file '/usr/local/bin/hadolint' do
+  source node['travis_build_environment']['hadolint_url']
+  checksum node['travis_build_environment']['hadolint_checksum']
+  owner node['travis_build_environment']['user']
+  group node['travis_build_environment']['group']
+  mode 0o755
+  not_if { node['kernel']['machine'] == 'ppc64le' }
+end
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

No branches or pull requests

1 participant