Loading...
Loading...
Use when defining GitLab CI jobs, configuring scripts, setting up environments, or managing job dependencies. Covers job structure and execution options.
npx skill4agent add thebushidocollective/han gitlab-ci-job-configurationjob_name:
stage: test
image: node:20-alpine
before_script:
- npm ci
script:
- npm test
after_script:
- echo "Cleanup tasks"
rules:
- if: $CI_COMMIT_BRANCH == "main"build:
script:
- echo "Building application..."
- npm run build
- echo "Build complete"test:
script:
- npm test || exit 1
- npm run lint
allow_failure: falsedeploy:production:
stage: deploy
script:
- ./deploy.sh
environment:
name: production
url: https://example.com
on_stop: stop:production
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: manual
stop:production:
stage: deploy
script:
- ./teardown.sh
environment:
name: production
action: stop
when: manualjob:
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: always
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: on_success
- when: nevertest:frontend:
rules:
- changes:
- "src/frontend/**/*"
- "package.json"docker:build:
rules:
- exists:
- Dockerfilebuild:
stage: build
script: npm run build
artifacts:
paths:
- dist/
test:
stage: test
dependencies:
- build
script: npm testtest:unit:
needs:
- job: build
artifacts: true
script: npm run test:unittest:
parallel:
matrix:
- NODE_VERSION: ["18", "20", "22"]
OS: ["alpine", "bullseye"]
image: node:${NODE_VERSION}-${OS}
script: npm testtest:
parallel: 5
script: npm run test:shardheavy_job:
tags:
- high-memory
resource_group: deploy
timeout: 2h
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure