projects/aports·commit 08d03b91

ci: use dynamic downstream pipelines

08d03b91 · Kevin Daudt <[email protected]> · 2024-11-26 19:39:30 +00:00

This gives us more flexibiity with regards to the job configuration. One
job generates the job configuration which then triggers a downstream
pipeline.
Commit
08d03b91a8680f30c23cff24f6f4be43d326636f
Parents
7256870f

Changes

2 files changed · +28 −2

FileStatusAddDelContent
.gitlab-ci.ymlmodified+28−2View file
.gitlab/job-config.yamladded+0−0View file

.gitlab-ci.yml

View file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 00d9f88..3f7d0fb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,10 +7,10 @@ variables:
GIT_DEPTH: "500"
REGISTRY: registry.alpinelinux.org
-# only rune pipelines for merge requests or when tags are pushed (for triggers)
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_PIPELINE_SOURCE == "pipeline" || $CI_PIPELINE_SOURCE == "parent_pipeline"
- if: $CI_COMMIT_TAG
lint:
@@ -26,6 +26,32 @@ lint:
- docker-alpine
- x86_64
+generate-build-jobs:
+ stage: verify
+ image:
+ name: $REGISTRY/alpine/infra/docker/alpine-gitlab-ci:latest
+ script:
+ - pipeline generate .gitlab-ci.yml .gitlab/job-config.yaml >.gitlab/build-jobs.yaml
+ artifacts:
+ paths:
+ - .gitlab/build-jobs.yaml
+ tags:
+ - docker-alpine
+ - x86_64
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+
+build-jobs:
+ stage: verify
+ needs:
+ - generate-build-jobs
+ trigger:
+ include:
+ - artifact: .gitlab/build-jobs.yaml
+ job: generate-build-jobs
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+
.build:
stage: verify
image:
@@ -41,7 +67,7 @@ lint:
expire_in: 1 day
when: always
rules:
- - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_PIPELINE_SOURCE == "parent_pipeline"
build-x86_64:
extends: .build

.gitlab/job-config.yaml

View file
diff --git a/.gitlab/job-config.yaml b/.gitlab/job-config.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.gitlab/job-config.yaml