- Issue created by @fjgarlin
- πͺπΈSpain fjgarlin
I added a rule in a place that is used by multiple jobs, but I think it might actually be ok, as I'm not sure if we need these jobs to run on tags.
I'd say this is ready for review. - πΊπΈUnited States smustgrave
Think we should merge and see if it works.
- π¬π§United Kingdom longwave UK
If we don't want CI to run on tag, should this just be in
workflow:rules
somewhere?Alternatively, we could figure out why
composer validate
fails when run on a tag, because that seems a bit strange. - π¬π§United Kingdom longwave UK
So the issue is
COMPOSER_ROOT_VERSION: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev"
For tags neither of those variables are set and this results in the error:
$ COMPOSER_ROOT_VERSION=-dev composer validate In VersionParser.php line 191: Invalid version string "-dev"
I think any job that uses composer is going to fail in the same way. The suggested fix skips any of the lint jobs, but I think the default test job will now try to run? But that will presumably also fail.
- π¬π§United Kingdom longwave UK
Looking at the table at https://docs.gitlab.com/ee/ci/jobs/job_rules.html#run-jobs-only-in-speci...
Maybe if we want to only run on branches we should change
# Run on commits. - if: $CI_PIPELINE_SOURCE == "push" && $CI_PROJECT_ROOT_NAMESPACE == "project" # The last rule above blocks manual and scheduled pipelines on non-default branch. The rule below allows them: - if: $CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_ROOT_NAMESPACE == "project"
to
# Run on push to branch or scheduled branches. - if: $CI_COMMIT_BRANCH && $CI_PROJECT_ROOT_NAMESPACE == "project"
- π¬π§United Kingdom longwave UK
Alternatively if we do want CI to run on tags then maybe we should set COMPOSER_ROOT_VERSION in the rules section, where we can use different variables to construct it depending on the pipeline source? This is allowed according to docs: https://docs.gitlab.com/ee/ci/yaml/#rulesvariables - this also feels a bit more neat than relying on one or the other to be set in
${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}-dev"
.