From be6a6da4176a8529a3240efa245f5545d144acb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Fri, 6 Jun 2025 16:13:39 +0200 Subject: [PATCH] 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 --- .gitlab-ci.yml | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5f2ee24..8880cc9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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}" stages: - - lint - build - vendor - release -# defaults for "only" -# We need to run the CI jobs in a "merge request specific context", if CI is -# running in a merge request. Otherwise the environment variable that holds the -# merge request ID is not available. This means, we must set the "only" -# variable accordingly - and if we only do it for one job, all other jobs will -# 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 +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH == 'master' + - if: '$CI_COMMIT_TAG != null' build: stage: build - <<: *only-default before_script: - apk -q add go staticcheck make scdoc script: @@ -41,8 +31,8 @@ build: vendor: stage: vendor image: alpine:latest - only: - - tags + rules: + - if: '$CI_COMMIT_TAG != null' before_script: - apk -q add curl go make script: @@ -54,8 +44,8 @@ vendor: release: stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest - only: - - tags + rules: + - if: '$CI_COMMIT_TAG != null' script: - | release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \