Script blocks


Script blocks

script represents the core steps performed by a job

script is just a YAML string

GitLab also supported YAML herestrings :

job_name:
  script: |
    pwd
    whoami
    printenv

Some jobs require preparation and cleanup to work correctly

job_name:
  before_script: echo before_script
  script: echo core
  after_script: echo after_script

after_script runs even if the job failed (useful for cleanup)


Hands-On

See chapter Scriptblocks