oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.81k stars 215 forks source link

How does this work in gitlab ci? #716

Closed brunomartinspro closed 2 years ago

brunomartinspro commented 2 years ago

So i configured the project using "npx mega-linter-runner --install" for the documentation flavor - I want to lint markdown files.

.gitlab-ci.yml:

mega-linter:
  stage: quality-gate
  image: nvuillam/mega-linter-documentation:v4
  script: ["true"]
  variables:
    DEFAULT_WORKSPACE: $CI_PROJECT_DIR
    DEFAULT_BRANCH: master
  artifacts:
    when: always
    paths:
      - report

.mega-linter.yml:

# Configuration file for Mega-Linter
# See all available variables at https://nvuillam.github.io/mega-linter/configuration/ and in linters documentation

APPLY_FIXES: all # all, none, or list of linter keys
DEFAULT_BRANCH: master # Usually master or main
# ENABLE: # If you use ENABLE variable, all other languages/formats/tooling-formats will be disabled by default
# ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default
DISABLE:
  # - COPYPASTE # Uncomment to enable checks of abusive copy-pastes
  - SPELL # Comment to disable checks of spelling mistakes # - SPELL # Uncomment to disable checks of spelling mistakes
SHOW_ELAPSED_TIME: true
FILEIO_REPORTER: false

However, I get the output:

Executing "step_script" stage of the job script
00:01
$ true         
Uploading artifacts...
WARNING: report: no matching files                 
ERROR: No files to upload                          
Cleaning up file based variables
00:00
Job succeeded

@nvuillam What am I doing wrong?

Thank you

brunomartinspro commented 2 years ago

Was only able to run this with:

.mega-linter.yml:

# Configuration file for Mega-Linter
# See all available variables at https://nvuillam.github.io/mega-linter/configuration/ and in linters documentation

APPLY_FIXES: none 
DEFAULT_BRANCH: master
ENABLE: MARKDOWN
DISABLE:
  - SPELL
SHOW_ELAPSED_TIME: true
FILEIO_REPORTER: false

.gitlab-ci.yml:

mega-linter:
  stage: quality-gate
  image: nvuillam/mega-linter-documentation:v4
  script:
    - python -m megalinter.run
  variables:
    DEFAULT_WORKSPACE: $CI_PROJECT_DIR
    DEFAULT_BRANCH: master
  artifacts:
    when: always
    paths:
      - report
nvuillam commented 2 years ago

This is the exact part of gitlab-ci.yml that I use professionally... and it works very well ^^

check_quality:
  stage: build
  tags:
    - ubuntu
  only:
    - merge_requests
    - web
  except:
    variables:
      - $SCRATCH_ORG_POOL == "true"
  image: nvuillam/mega-linter-salesforce:latest
  script: ["true"]
  variables:
    # All available variables are described in documentation
    # https://nvuillam.github.io/mega-linter/configuration/
    DEFAULT_WORKSPACE: $CI_PROJECT_DIR
    DEFAULT_BRANCH: master
    # ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
  artifacts:
    when: always
    paths:
      - report
    expire_in: 1 week

Please could you share a bigger part of your logs so we could see what happens ?

Thanks !

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.