ci: use dynamic downstream pipelines
Changes
2 files changed · +28 −2
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| .gitlab-ci.yml | modified | +28 | −2 | View file |
| .gitlab/job-config.yaml | added | +0 | −0 | View file |
.gitlab-ci.yml
View filediff --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 filediff --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