ci: migrate from deprecated "only" keyword to "rules"

In the process, removed the unused "lint" stage and a massive comment
that is no longer useful. The rules should be self-explanatory

Part-of: https://gitlab.postmarketos.org/postmarketOS/postmarketos-mkinitfs/-/merge_requests/63
This commit is contained in:
Pablo Correa Gómez
2025-06-06 16:13:39 +02:00
parent 4e771ab96f
commit be6a6da417

View File

@@ -8,28 +8,18 @@ variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mkinitfs-vendor-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}" PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mkinitfs-vendor-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}"
stages: stages:
- lint
- build - build
- vendor - vendor
- release - release
# defaults for "only" workflow:
# We need to run the CI jobs in a "merge request specific context", if CI is rules:
# running in a merge request. Otherwise the environment variable that holds the - if: $CI_PIPELINE_SOURCE == "merge_request_event"
# merge request ID is not available. This means, we must set the "only" - if: $CI_COMMIT_BRANCH == 'master'
# variable accordingly - and if we only do it for one job, all other jobs will - if: '$CI_COMMIT_TAG != null'
# not get executed. So have the defaults here, and use them in all jobs that
# should run on both the master branch, and in merge requests.
# https://docs.gitlab.com/ee/ci/merge_request_pipelines/index.html#excluding-certain-jobs
.only-default: &only-default
only:
- master
- merge_requests
- tags
build: build:
stage: build stage: build
<<: *only-default
before_script: before_script:
- apk -q add go staticcheck make scdoc - apk -q add go staticcheck make scdoc
script: script:
@@ -41,8 +31,8 @@ build:
vendor: vendor:
stage: vendor stage: vendor
image: alpine:latest image: alpine:latest
only: rules:
- tags - if: '$CI_COMMIT_TAG != null'
before_script: before_script:
- apk -q add curl go make - apk -q add curl go make
script: script:
@@ -54,8 +44,8 @@ vendor:
release: release:
stage: release stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
only: rules:
- tags - if: '$CI_COMMIT_TAG != null'
script: script:
- | - |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \