0
0
Gitdevops~10 mins

GitLab CI basics - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a basic GitLab CI job named test_job.

Git
test_job:
  stage: test
  script:
    - [1]
Drag options to blanks, or click blank then click option'
Aecho "Running tests"
Brun tests
Cexecute tests
Dstart test
Attempts:
3 left
💡 Hint
Common Mistakes
Using phrases that are not shell commands.
Forgetting to use quotes around text.
2fill in blank
medium

Complete the code to specify the build stage in the GitLab CI configuration.

Git
stages:
  - [1]
  - test
  - deploy
Drag options to blanks, or click blank then click option'
Abuild
Bdeploy
Crelease
Dcompile
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-standard stage names.
Mixing up the order of stages.
3fill in blank
hard

Fix the error in the job definition by completing the missing keyword for the job name.

Git
[1]:
  stage: build
  script:
    - echo "Building project"
Drag options to blanks, or click blank then click option'
Abuild_job
Bbuild
Cstage
Djob
Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved keywords like job or stage as job names.
Adding spaces or invalid characters.
4fill in blank
hard

Fill both blanks to create a job that runs only on the main branch and uses the deploy stage.

Git
deploy_job:
  stage: [1]
  script:
    - echo "Deploying application"
  only:
    - [2]
Drag options to blanks, or click blank then click option'
Adeploy
Bmain
Ctest
Dfeature
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong stage name.
Specifying a branch name that does not exist.
5fill in blank
hard

Fill all three blanks to define a job named lint that runs in the test stage, executes npm run lint, and runs only on merge requests.

Git
lint:
  stage: [1]
  script:
    - [2]
  only:
    - [3]
Drag options to blanks, or click blank then click option'
Atest
Bnpm run lint
Cmerge_requests
Ddeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong stage name.
Writing the script command incorrectly.
Specifying the wrong condition in only.