I work on multiple projects that use Gitlab pipelines for building, linting, sonar analysis, jira check and deployment, etc. Sometimes, the stage related to sonar check fails whenever that 3rd party system (SonarQube) has got a version upgrade which means project GitLab pipelines also fail and failure is impactful, especially during the release period and so on. I'm thinking of testing my GitLab pipeline every weekend (as a scheduled pipeline against dummy projects)to ensure all the stages are running smoothly because any 3rd party system version upgrade happens during the weekend only. And if something is breaking then I will come to know upfront before the start of a working day (Monday) itself.
Is there any way that I can run my scheduled pipeline in a combination i.e. by mocking some of the services (say build, test, lint, etc.) and some real stage test against 3rd party systems like Jira or SonarQube server which will ensure that my GitLab pipeline is working end to end?
You can create specific jobs for your scheduled pipeline with your mock environment and add the keyword:
only:
- schedules
And to your real job add the keyword:
except:
- schedules
only
and except
are not actively developed, you can use rules:if
instead:
To execute job only in schedule:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
To execute job not in schedule but in push pipelines (to branches or tags):
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_PIPELINE_SOURCE == "push"