I have a problem with GitLab CI (maybe I try to use it in the wrong way).
I have templates with artifacts and jobs that are used templates with artifacts but the value expire_in should be used only on a specific branch e.g.
template:
.build_template: &artifactsTMP
artifacts:
paths:
- test.py
expire_in: 3 minutes
jobs
firstJob:
stage: build
<<: *artifactsTMP
script:
- echo "sth"
rules:
- If: $CI_COMMIT_BRANCH == "dev"
secondJob:
stage: build
<<: *artifactsTMP
script:
- echo "sth"
What I want to do is that expire_in should be run only on branch "dev".
I tried to use the IF statement inside artifacts and rules but it was not working.
Is there any option to add the expire_in during job execution?
For example:
template:
.build_template: &artifactsTMP
artifacts:
paths:
- test.py
jobs:
firstJob:
stage: build
<<: *artifactsTMP
script:
- echo "sth"
rules:
- If: $CI_COMMIT_BRANCH == "dev"
secondJob:
stage: build
<<: *artifactsTMP
>>ADD HERE expire_in: 5 minutes<<
script:
- echo "sth"
Is there any change to do that or just simply I should create two templates, one without expire_in second with expire_in