Files
glint/testdata/keywords_valid.yml
k3nny 4ce7f86d4d feat(linter): glint explain, GL042 rules:if: reachability, GL043 inherit completeness
- `glint explain <RULE>`: new subcommand printing rule description,
  rationale, bad-YAML example and fix for every GL001–GL043 rule.
  `glint explain` (no arg) lists all rules with ID, severity, title.
  Rule IDs are case-insensitive.

- GL042 (rules:if: evaluated reachability): warns when every rules:if:
  condition evaluates to false given the values of variables declared in
  the pipeline YAML, making the job statically unreachable. Conservative:
  only fires when all referenced variables are declared in YAML; predefined
  CI_* / GITLAB_* variables are skipped to avoid false positives.

- GL043 (inherit: completeness): warns when inherit: default: is declared
  but there is no default: block in the pipeline (dead declaration), or
  when the list form names fields not set in the default: block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 11:02:23 +02:00

84 lines
1.3 KiB
YAML

stages:
- build
- test
- release
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- when: never
default:
tags:
- docker
variables:
GO_VERSION: "1.26"
build-job:
stage: build
image:
name: golang:1.26
entrypoint: [""]
script:
- go build ./...
artifacts:
paths:
- bin/
when: on_success
expire_in: 1 week
cache:
key: go-modules
paths:
- .go/pkg/mod
policy: pull-push
when: on_success
retry: 2
interruptible: true
resource_group: build-group
test-job:
stage: test
script:
- go test ./...
coverage: '/coverage: \d+\.\d+%/'
allow_failure:
exit_codes: [1, 2]
parallel: 4
needs:
- build-job
dependencies:
- build-job
retry:
max: 2
when:
- script_failure
- runner_system_failure
release-job:
stage: release
script:
- echo "creating release"
release:
tag_name: $CI_COMMIT_TAG
description: "Release $CI_COMMIT_TAG"
rules:
- if: '$CI_COMMIT_TAG'
when: on_success
environment:
name: production
url: https://example.com
action: start
when: on_success
.template:
before_script:
- echo "before"
tags:
- docker
inherit:
default: false
variables:
- GO_VERSION