Job artifact expire_in does not accept integers as a duration

Summary

When using a raw integer value for a job artifact's expire_in setting, the YAML is not valid and it gives an error:

This GitLab CI configuration is invalid: jobs:<job name>:artifacts expire in should be a duration

Steps to reproduce

  • Create a new project with a single job like this:
create_artifact:
  script:
    - mkdir build
    - date | md5sum > build/artifact.txt
  artifacts:
    paths:
      - build/artifact.txt
    expire_in: 42
  • Check the pipeline status and find the error above.

Example Project

https://gitlab.com/philbz/artifact_expiration_bug_repro

Specifically, these two pipelines:

Runs: https://gitlab.com/philbz/artifact_expiration_bug_repro/pipelines/148818980 Does not run: https://gitlab.com/philbz/artifact_expiration_bug_repro/pipelines/148819163

What is the current bug behavior?

The first example of a valid value from our documentation is not properly parsed, causing the pipeline to break.

What is the expected correct behavior?

The pipeline should run and the artifact should expire in the correct number of seconds.

Relevant logs and/or screenshots

Screen_Shot_2020-05-22_at_4.20.29_PM

Screen_Shot_2020-05-22_at_4.21.29_PM

Output of checks

This happens on GitLab.com

Possible fixes

I'm not sure where the code lives that is responsible for this error, but I think there are two possible fixes:

  1. Update the documentation to indicate that a unit of time must be specified in addition to a number
  2. Resolve the behavior so that 42 and other integers are valid