Commit 3194100e authored by Carlo Landmeter's avatar Carlo Landmeter

ci: dynamic child pipelines

parent e8154f4d
image: alpinelinux/docker-cli
image: alpine
stages:
- build
- push
- manifest
- cleanup
- config
- child
# Build jobs
.build:
stage: build
rules:
- changes:
- Dockerfile.in
- make_images.sh
- entrypoint.sh
build-v3.8:
extends: .build
script:
- ./make_images.sh build v3.8
build-v3.9:
extends: .build
script:
- ./make_images.sh build v3.9
build-v3.10:
extends: .build
script:
- ./make_images.sh build v3.10
build-v.3.11:
extends: .build
script:
- ./make_images.sh build v3.11
build-edge:
extends: .build
script:
- ./make_images.sh build edge
# Push jobs
.push:
stage: push
rules:
- if: '$CI_PROJECT_PATH == "alpine/docker-abuild" && $CI_COMMIT_BRANCH == "master"'
changes:
- Dockerfile.in
- make_images.sh
- entrypoint.sh
push-v3.8:
extends: .push
script:
- ./make_images.sh push v3.8
push-v3.9:
extends: .push
script:
- ./make_images.sh push v3.9
push-v3.10:
extends: .push
script:
- ./make_images.sh push v3.10
push-v.3.11:
extends: .push
script:
- ./make_images.sh push v3.11
push-edge:
extends: .push
script:
- ./make_images.sh push edge
# Manifest jobs
.manifest:
stage: manifest
variables:
DOCKER_CLI_EXPERIMENTAL: enabled
rules:
- if: '$CI_PROJECT_PATH == "alpine/docker-abuild" && $CI_COMMIT_BRANCH == "master"'
changes:
- Dockerfile.in
- make_images.sh
- entrypoint.sh
manifest-v3.8:
extends: .manifest
script:
- ./make_images.sh manifest v3.8
manifest-v3.9:
extends: .manifest
script:
- ./make_images.sh manifest v3.9
manifest-v3.10:
extends: .manifest
script:
- ./make_images.sh manifest v3.10
manifest-v3.11:
extends: .manifest
script:
- ./make_images.sh manifest v3.11
manifest-edge:
extends: .manifest
script:
- ./make_images.sh manifest edge
# cleanup images/layers
cleanup:
stage: cleanup
script:
- docker system prune --force
.default:
rules:
- if: '$CI_PROJECT_PATH == "alpine/docker-abuild" && $CI_COMMIT_BRANCH == "master"'
changes:
......@@ -128,3 +12,20 @@ cleanup:
- make_images.sh
- entrypoint.sh
generate-yml:
stage: config
extends: .default
script:
- apk add --no-cache jq curl
- ./mkyml.sh > child-pipeline.yml
artifacts:
paths:
- child-pipeline.yml
child-pipeline:
stage: child
extends: .default
trigger:
include:
- artifact: child-pipeline.yml
job: generate-yml
#!/bin/sh
set -euo pipefail
readonly RELEASE_URL="https://alpinelinux.org/releases.json"
readonly RELEASES=$(curl -fs "$RELEASE_URL" | jq -r '.release_branches[].rel_branch')
template() {
local release=$1
cat <<- EOF
build-$release:
extends: .build
script:
- ./make_images.sh build $release
push-$release:
extends: .push
script:
- ./make_images.sh push $release
manifest-$release:
extends: .manifest
script:
- ./make_images.sh manifest $release
EOF
}
cat <<- EOF
image: alpinelinux/docker-cli
stages:
- build
- push
- manifest
- cleanup
.build:
stage: build
rules:
- changes:
- Dockerfile.in
- make_images.sh
- entrypoint.sh
.push:
stage: push
.manifest:
stage: manifest
variables:
DOCKER_CLI_EXPERIMENTAL: enabled
cleanup:
stage: cleanup
script:
- docker system prune --force
EOF
for release in $RELEASES; do
template $release
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment