Maven / GitLab CI Basics Interview Questions
What are GitLab CI/CD scheduled pipelines and how do you set them up?
Scheduled pipelines run on a defined timetable (like a cron job) without requiring a code push. They are useful for nightly builds, weekly security scans, database backups, and performance benchmarks.
# In .gitlab-ci.yml - detect schedule trigger: nightly-test: stage: test script: - run-full-test-suite.sh rules: - if: $CI_PIPELINE_SOURCE == "schedule" # only runs when scheduled regular-test: stage: test script: - run-quick-tests.sh rules: - if: $CI_PIPELINE_SOURCE != "schedule" # skip during scheduled runs # Variables defined in the schedule are available as CI/CD variables: nightly-deploy: script: - echo "Running type: $PIPELINE_TYPE" # set in schedule config - echo "Env: $DEPLOY_ENV"
Setting up a schedule in the UI:
- Go to Build > Pipeline schedules > New schedule
- Enter a cron expression (e.g.
0 2 * * *for 2am daily) - Select the target branch or tag
- Optionally add custom CI/CD variables for this schedule
- Enable/disable the schedule without deleting it
The $CI_PIPELINE_SOURCE predefined variable equals 'schedule' for scheduled pipelines, allowing you to run different jobs for scheduled vs push-triggered pipelines.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
