oss-review-toolkit / ort-ci-gitlab

Use ORT in your GitLab pipelines
Apache License 2.0
13 stars 16 forks source link

Ort-scan build failed in Mime types #19

Closed karippery closed 2 years ago

karippery commented 2 years ago

Hello, I trying to include .gitlab-ci.yml into mime types repository.

Here is my .gitlab-ci.yml file

 include:
  - project: Karippery/ort-gitlab-ci
    file: ort-gitlab-ci.yml

image: node:latest

stages:
  - build
  - test
  - lint

cache:
  paths:
    - node_modules/

install-dependencies:
  stage: build
  script:
    - npm install
  artifacts:
    paths:
      - node_modules/

unit-tests:
  stage: test
  script: npm test

lint:
  stage: test
  script: npm run lint

ort-scan:
  stage: test
  retry: 2
  variables:
    SW_NAME: "Mime Types"
    SW_VERSION: "2.1.32"
    VCS_URL: "https://gitlab.com/Karippery/mime-types.git"
    ORT_ALLOW_DYNAMIC_VERSIONS: "true"
  artifacts:
    reports:
      license_scanning: ort-results/gl-license-scanning-report.json

error I get

mimetype

Executing busybox-1.35.0-r13.trigger
Executing ca-certificates-20211220-r0.trigger
OK: 9 MiB in 21 packages
$ ORT_GITLAB_CI_REVISION=${OSS_GITLAB_CI_REVISION:-main} # collapsed multi-line command
curl: (22) The requested URL returned error: 401
section_end:1657101364:step_script
section_start:1657101364:upload_artifacts_on_failure
Uploading artifacts for failed job
Uploading artifacts...
WARNING: ort-results/scan-report-web-app.html: no matching files. Ensure that the artifact path is relative to the working directory 
WARNING: ort-results: no matching files. Ensure that the artifact path is relative to the working directory 
ERROR: No files to upload                          
Uploading artifacts...
WARNING: ort-results/gl-license-scanning-report.json: no matching files. Ensure that the artifact path is relative to the working directory 
ERROR: No files to upload                          
section_end:1657101365:upload_artifacts_on_failure
section_start:1657101365:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1657101366:cleanup_file_variables
ERROR: Job failed: exit code 22

tsteenbe commented 2 years ago

@karippery From the image you shared I see curl is return a 401 which likely means ORT_TRIGGER_API_TOKEN is not setup or it value is incorrect.

You can reproduce this issue yourself by using ORT_TRIGGER_API_TOKEN to call GitLab API using say curl

curl -X POST 'https://gitlab.com/api/v4/projects/<project-id>/pipeline?ref=<ref-name>' \
-H 'PRIVATE-TOKEN: <ORT_TRIGGER_API_TOKEN>'

Alternatively you can also set up the ORT_TRIGGER_API_TOKEN trigger token again following ORT for GitLab README