1. Example Inline Job
Below is a simple.gitlab-ci.yml that installs the cowsay gem and runs commands directly:
Extract repetitive or lengthy command sequences into versioned scripts to keep your pipeline definitions clean and reusable.
2. Create a Dedicated Shell Script
- Open the GitLab Web IDE.
- Add a file named
ascii-script.shat your repository root:

ascii-script.sh so it’s tracked by Git.
3. Update Your CI Configuration
Modify.gitlab-ci.yml to invoke the script instead of inline commands:
4. Monitor Pipeline Status
Navigate to CI/CD > Pipelines in the GitLab UI to view your job status in real time.
ascii_job running under the “Generate ASCII Artwork” pipeline.
5. Handling Permission Errors
If your script isn’t executable, GitLab will report a permission denied error:
Always ensure your shell scripts have execute permissions. Without
chmod +x, GitLab runners cannot run them.6. Grant Execute Permissions
Add achmod step in before_script to make the script executable:
7. Confirm Successful Execution
Once fixed, your job logs should show:.gitlab-ci.yml stays concise, and complex logic lives in maintainable, version-controlled scripts.