Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gitlab-runner gitlab-runner
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,438
    • Issues 2,438
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 120
    • Merge requests 120
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • gitlab-runnergitlab-runner
  • Issues
  • #4240
Closed (duplicated) (duplicated)
Open
Created May 09, 2019 by Sebastian Breuers@sebastian.breuers.elfin

gitlab-runner artifacts-uploader does not fail if artifact file to upload does not exist

Summary

gitlab-runner artifacts-uploader does not fail if artifact file to upload does not exist.

This leads to pipeline working and lets subsequent pipelines fail or worse lets falsy data get to production.

This relates to gitlab#22711 as well

Steps to reproduce

Version of gitlab-runner: 11.8.0

Issue the following command:

/usr/bin/gitlab-runner artifacts-uploader \
   --url <url to gitlab ci> \
   --token <access token> \
   --id <id> \
   --path <path to NON existing file> \
   --artifact-format zip \
   --artifact-type archive

The return value will be 0

echo $?
0

What is the current bug behavior?

The output of the command is:

Runtime platform                                    arch=amd64 os=linux pid=21534 revision=4745a6f3 version=11.8.0
WARNING: <path to NON existing file>: no matching files               
ERROR: No files to upload 

But the exit code is 0.

What is the expected correct behavior?

The output should remain but the exit code should become 1.

Possible fixes

The problem exists in line 94 of commands/helpers/artifacts_uploader.go.

return nil

should be probably changed to

return errors.New("No files to upload")

or createReadStream should return an error.

Edited Jul 20, 2021 by James Heimbuck
Assignee
Assign to
Time tracking