super-linter / super-linter

Combination of multiple linters to run as a GitHub Action or standalone
https://github.com/super-linter/super-linter
MIT License
9.5k stars 971 forks source link

Super-linter failed to get the root commit #6114

Closed jplanckeel-ep closed 1 month ago

jplanckeel-ep commented 2 months ago

Is there an existing issue for this?

Are you using the latest Super-linter version available?

Are you resonably sure that it's a Super-linter issue, and not an issue related to a tool that Super-linter runs?

Current Behavior

When we upgrade Super-linter with a version > 6.4 with goreleaser the action failed

We have test to disable Goreleaser with env var

VALIDATE_GO_RELEASER: false

Expected Behavior

Pipeline failed whit goreleaser.

Super-Linter version

v6.4.x
v7

Super-linter configuration

- name: Checkout code
        uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.ref }}
          # Full git history is needed to get a proper list of changed files within `super-linter`
          fetch-depth: 0

      - name: Lint Code Base
        uses: super-linter/super-linter@v7
        env:
          VALIDATE_ALL_CODEBASE: false
          VALIDATE_CHECKOV: false
          VALIDATE_TERRAFORM_TERRASCAN: false
          VALIDATE_GO_RELEASER: false
          DEFAULT_BRANCH: ${{ inputs.default_branch }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          KUBERNETES_KUBECONFORM_OPTIONS: "-schema-location default -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' -ignore-filename-pattern '.*/helm/.*.yaml' -ignore-filename-pattern 'charts/.*.yaml'"

Relevant log output

Super-Linter initialization
  2024-09-03 08:19:09 [INFO]   --------------------------------------------------------------------------------
                                /@@#///////@@/(@//@%/(@.@(       @@
                            @@//////////////////////////////#*  @@@
                          @////@//(///////////@@@@@///@//@/@**//@@(
                        @///////@///////////////@@@@    (           @,
                       @/(&/@////////////////////                     @
                      @////////////////////////@@                      @
                    @%////////(//////////%/////&@            @@       *,@           ______________
               @@@@@/@/#/////(&//////////////////                       .@         /              \
          *@@@@@.    .%///(//@//////////////////&.   .@@,                 @%      / Don't mind me  \
        @@%           .&@&&/@.@//&/////(//////////    @@@@@@@@@         .. &@    / I'm just looking \
      @@%               @@@@@   @&/////////////////#   @/       V  @@/ ,@@@ @   <  for some trash... |
  @@@%                   @@@@        .%@@@@//////#@ @   @@         @     .,.     \__________________/
                                            @@@/@(  (@@@@% @/\      %
                                             @@@@(    .     .@@/\   #
                                               @                  %@%
  --------------------------------------------------------------------------------
  2024-09-03 08:19:09 [INFO]   ---------------------------------------------
  2024-09-03 08:19:09 [INFO]   --- GitHub Actions Multi Language Linter ----
  2024-09-03 08:19:09 [INFO]    - Image Creation Date: 2024-08-28T09:30:09Z
  2024-09-03 08:19:09 [INFO]    - Image Revision: b92721f792f381cedc002ecdbb9847a15ece5bb8
  2024-09-03 08:19:09 [INFO]    - Image Version: 7.1.0
  2024-09-03 08:19:09 [INFO]   ---------------------------------------------
  2024-09-03 08:19:09 [INFO]   ---------------------------------------------
  2024-09-03 08:19:09 [INFO]   The Super-Linter source code can be found at:
  2024-09-03 08:19:09 [INFO]    - https://github.com/super-linter/super-linter
  2024-09-03 08:19:09 [INFO]   ---------------------------------------------
  2024-09-03 08:19:09 [INFO]   - Validating changed files in code base...
  2024-09-03 08:19:09 [INFO]   dotnet: 8.0.401
  chktex: chktex: WARNING -- Could not find global resource file.
  ChkTeX v1.7.9 - Copyright 1995-96 Jens T. Berger Thielemann.
  Compiled with POSIX extended regex support.
  rubocop: 1.65.1
  perl: 
  This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-thread-multi
  Copyright 1987-2023, Larry Wall
  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5 source kit.
  Complete documentation for Perl, including FAQ lists, should be found on
  this system using "man perl" or "perldoc perl".  If you have access to the
  Internet, point your browser at https://www.perl.org/, the Perl Home Page.
  xmllint: xmllint: using libxml version 21207
     compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 HTTP DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Schemas Schematron Modules Debug Zlib Lzma 
  ansible-lint: ansible-lint 24.7.0 using ansible-core:2.17.3 ansible-compat:24.8.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  eslint: v8.57.0
  markdownlint: 0.41.0
  snakefmt: snakefmt, version 0.10.2
  cpplint: Cpplint fork (https://github.com/cpplint/cpplint)
  cpplint 1.6.1
  Python 3.12.5 (main, Aug  7 2024, 19:15:55) [GCC 13.2.1 20240309]
  editorconfig-checker: v3.0.3
  gitleaks: v8.18.4
  phpstan: PHPStan - PHP Static Analysis Tool 1.11.2
  dotenv-linter: dotenv-linter 3.3.0
  asl-validator: 3.8.3
  actionlint: 1.7.1
  installed by building from source
  built with go1.22.3 compiler for linux/amd64
  tekton-lint: 1.1.0
  terrascan: version: v1.19.1
  terraform: Terraform v1.9.5
  on linux_amd64
  2024/08/27 16:15:42 traces export: Post "http:///dev/otel-grpc.sock": http: no Host in request URL
  2024/08/27 16:15:42 traces export: Post "http:///dev/otel-grpc.sock": http: no Host in request URL
  clippy: clippy 0.1.78
  R: R version 4.4.0 (2024-04-24) -- "Puppy Cup"
  Copyright (C) 2024 The R Foundation for Statistical Computing
  Platform: x86_64-pc-linux-musl
  R is free software and comes with ABSOLUTELY NO WARRANTY.
  You are welcome to redistribute it under the terms of the
  GNU General Public License versions 2 or 3.
  For more information about these matters see
  https://www.gnu.org/licenses/.
  rustfmt: rustfmt 1.7.0-stable ( )
  shellcheck: ShellCheck - shell script analysis tool
  version: 0.10.0
  license: GNU General Public License, version 3
  website: https://www.shellcheck.net
  jscpd: 4.0.5
  black: black, 24.8.0 (compiled: no)
  Python (CPython) 3.12.5
  prettier: 3.3.3
  php: PHP 8.3.10 (cli) (built: Aug  1 2024 20:18:40) (NTS)
  Copyright (c) The PHP Group
  Zend Engine v4.3.10, Copyright (c) Zend Technologies
  textlint: v14.2.0
  npm-groovy-lint: GroovyLint: Successfully processed CodeNarc: 
  CodeNarc version 3.3.0
  npm-groovy-lint version 14.6.0
  Embeds:
  CodeNarc version 3.3.0
  - Groovy version 3.0.9 (superlite)
  renovate-config-validator: (node:226) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  (Use `node --trace-deprecation ...` to show where the warning was created)
  38.55.1
  golangci-lint: golangci-lint has version 1.60.3 built with go1.23.0 from c2e095c0 on 2024-08-22T21:51:56Z
  ruff: ruff 0.6.2
  kubeconform: v0.6.7
  golangci-lint: golangci-lint has version 1.60.3 built with go1.23.0 from c2e095c0 on 2024-08-22T21:51:56Z
  gherkin-lint: Version command not supported
  eslint: v8.57.0
  scalafmt: scalafmt 3.8.3
  stylelint: 15.11.0
  sqlfluff: sqlfluff, version 3.1.1
  bash-exec: Version command not supported
  google-java-format: google-java-format: Version 1.23.0
  phpcs: PHP_CodeSniffer version 3.10.1 (stable) by Squiz and PHPCSStandards
  terragrunt: terragrunt version v0.66.9
  psalm: Psalm 5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e
  pylint: pylint 3.2.6
  astroid 3.2.4
  Python 3.12.5 (main, Aug  7 2024, 19:15:55) [GCC 13.2.1 20240309]
  shfmt: v3.9.0
  snakemake: 8.18.2
  arm-ttk: ModuleVersion = 0.25
  pwsh: PowerShell 7.4.2
  mypy: mypy 1.11.2 (compiled: yes)
  eslint: v8.57.0
  coffeelint: 5.2.11
  tflint: TFLint version 0.53.0
  + ruleset.terraform (0.9.1-bundled)
  cfn-lint: cfn-lint 1.10.3
  flake8: 7.1.1 (mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0) CPython 3.12.5 on
  Linux
  spectral: 6.11.1
  clj-kondo: clj-kondo v2024.08.01
  eslint: v8.57.0
  ts-standard: 12.0.2
  eslint: v8.57.0
  protolint: protolint version 0.50.5(6cc254e)
  pyink: pyink, 24.3.0 (compiled: no)
  Python (CPython) 3.12.5
  raku: Welcome to Rakudo™ v2024.04.
  Implementing the Raku® Programming Language v6.d.
  Built on MoarVM version 2024.04.
  prettier: 3.3.3
  hadolint: Haskell Dockerfile Linter 2.12.0
  checkstyle: Checkstyle version: 10.18.0
  clang-format: clang-format version 17.0.6 (https://github.com/llvm/llvm-project.git 6009708b4367171ccdbf4b5905cb6a803753fe18)
  ktlint: ktlint version 1.3.1
  yamllint: yamllint 1.35.1
  dart: Dart SDK version: 3.5.1 (stable) (Tue Aug 13 21:02:17 2024 +0000) on "linux_x64"
  isort: 
                   _                 _
                  (_) ___  ___  _ __| |_
                  | |/ _/ / _ \/ '__  _/
                  | |\__ \/\_\/| |  | |_
                  |_|\___/\___/\_/   \_/
        isort your imports, so you don't have to.
                      VERSION 5.13.2
  dotnet: 8.0.401
  eslint: v8.57.0
  dotnet: 8.0.401
  dotnet: 8.0.401
  rustfmt: rustfmt 1.7.0-stable ( )
  htmlhint: 1.1.4
  rustfmt: rustfmt 1.7.0-stable ( )
  goreleaser:   ____       ____      _
   / ___| ___ |  _ \ ___| | ___  __ _ ___  ___ _ __
  | |  _ / _ \| |_) / _ \ |/ _ \/ _` / __|/ _ \ '__|
  | |_| | (_) |  _ <  __/ |  __/ (_| \__ \  __/ |
   \____|\___/|_| \_\___|_|\___|\__,_|___/\___|_|
  goreleaser: Deliver Go Binaries as fast and easily as possible
  https://goreleaser.com
  GitVersion:    2.2.0
  GitCommit:     111121bbd98df17cc5d81888aa94a8d3694bc157
  GitTreeState:  false
  BuildDate:     2024-08-15T01:56:53Z
  BuiltBy:       goreleaser
  GoVersion:     go1.23.0
  Compiler:      gc
  ModuleSum:     h1:IKWOpyx4A9gG/8o2AEN46PlV3qR/HqXVTHT6W+G8Qi0=
  Platform:      linux/amd64
  checkov: 3.2.236
  lua: Lua 5.4.6  Copyright (C) 1994-2023 Lua.org, PUC-Rio
  standard: 17.1.0
  2024-09-03 08:19:09 [INFO]   --------------------------------------------
  2024-09-03 08:19:09 [INFO]   Gathering GitHub information...
  2024-09-03 08:19:09 [INFO]   Successfully validated GITHUB_WORKSPACE: /github/workspace
  2024-09-03 08:19:09 [INFO]   Successfully found GITHUB_EVENT_PATH: /github/workflow/event.json]
  2024-09-03 08:19:09 [INFO]   Successfully found GITHUB_SHA: 2592f4c4edfcfe1e1f9010b82cc0316bbb6f8081
  fatal: bad object 2592f4c4edfcfe1e1f9010b82cc0316bbb6f8081
  2024-09-03 08:19:09 [FATAL]   Failed to get the root commit:

Steps To Reproduce

Add config in workflow with v7

Anything else?

No response

ferrarimarco commented 2 months ago

Hi! This is not about Goreleaser. It just happens to be the last linters that emits its version information, but has nothing to do with the issue you're facing.

The issue is that Git is not able to trace back the root (initial) commit starting from the 2592f4c4edfcfe1e1f9010b82cc0316bbb6f8081 commit in your repository. This command failed on your repository:

https://github.com/super-linter/super-linter/blob/94920ffcc743ebba42205db26cc4bad16f309498/lib/linter.sh#L274-L278

ferrarimarco commented 2 months ago

I think what's likely happening here depends on how you're checking out the repository in the Checkout code step.

This is probably a configuration issue, rather than a Super-linter issue.

ferrarimarco commented 2 months ago

I think the change that is impacting you is #5534, which landed in v6.4.1, so it matches with your statement about versions < v6.4 working fine.

@jplanckeel-ep In order to understand what's happening here, we need to reproduce the issue first. Can you please provide a link to a workflow with debug logging enabled if this is a public repository? If it's a private repository, we need more help from your side to try to reproduce the issue, so we probably need that that you collect the logs yourself, taking care of redacting private information. We probably need both the actions/checkout log, and the super-linter debug log.

ferrarimarco commented 1 month ago

No replies. Closing this. We can reopen later if we get more data points. Thanks for taking the time to file this issue in the first place!

nartb commented 1 month ago

I've also run into the issue described here by @jplanckeel-ep.

I'm currently on v6.4.0 and have had multiple dependabot PRs trying to upgrade super-linter from that version fail with the same output given above.

The commit SHA for "Successfully found GITHUB_SHA" and a "fatal: bad object" seems to be the merge commit resulting from merging the dependabot update commit to the original branch's head.

I definitely might be missing an obvious issue with what I'm doing but I'm not very well versed in this side of things so nothing is sticking out to me.

I also have pretty much the exact same way of checking out code as @jplanckeel-ep so that's definitely a likely culprit.

This is my workflow step for checking out the code:

- name: Checkout code
        uses: actions/checkout@v4
        with:
          # Full git history is needed to get a proper list of changed files within `super-linter`
          fetch-depth: 0

          # Checkout the code from the pull request instead of the merge commit
          ref: ${{ github.event.pull_request.head.sha }}

This is my configuration for super-linter:

- name: Run super-linter
        uses: super-linter/super-linter/slim@v6.4.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

          # Only run on changed files
          VALIDATE_ALL_CODEBASE: false
          LINTER_RULES_PATH: .

          LOG_LEVEL: INFO

          JAVASCRIPT_DEFAULT_STYLE: prettier
          JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json

          TYPESCRIPT_DEFAULT_STYLE: prettier
          TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.json

          # Explicitly state filetypes to validate (those not included will not be linted)
          VALIDATE_BASH: true
          VALIDATE_DOCKERFILE_HADOLINT: true
          VALIDATE_GITHUB_ACTIONS: true
          VALIDATE_GITLEAKS: true
          VALIDATE_HTML: true
          VALIDATE_JAVASCRIPT_ES: true
          VALIDATE_JSX: true
          VALIDATE_TSX: true
          VALIDATE_TYPESCRIPT_ES: true
          VALIDATE_YAML: true

I'll also try to provide the debug log if I can't figure it out.