gstreamer/.gitlab-ci.yml
Jordan Petridis c731fab0ca image_builds: simplify the tags
We can use docker labels to pass the metadata we want
and make the tag simpoler.

also small fixup, make it so buildah it uses chroot isolation
and update the base image

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-ci/-/merge_requests/308>
2020-06-26 12:14:28 +00:00

206 lines
5.6 KiB
YAML

include: "gitlab/ci_template.yml"
stages:
- "build docker"
- "preparation"
- "pre-build"
- "build"
- "test"
# use the binaries in some way
- "integrate"
test manifest:
variables:
GIT_STRATEGY: fetch
rules:
- when: 'always'
image: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/test-manifest:2019-10-23-793476'
stage: "preparation"
script:
- pytest-3 --junitxml=junit.xml --cov=build_manifest gitlab/build_manifest.py
coverage: '/TOTAL.*\s+(\d+%)$/'
artifacts:
reports:
junit:
- "junit.xml"
.base:
image: 'registry.fedoraproject.org/fedora:32'
extends:
- '.global_ci_policy'
tags: ['gstreamer']
rules:
- when: 'manual'
allow_failure: true
variables:
STORAGE_DRIVER: 'vfs'
BUILDAH_FORMAT: 'docker'
BUILDAH_ISOLATION: 'chroot'
GIT_STRATEGY: fetch
script:
- export DATE=$(date +"%Y-%m-%d")
- export IMAGE="$CI_REGISTRY_IMAGE/${ARCH:=amd64}/$TAG"
- export _UID="$IMAGE:$DATE-$GST_UPSTREAM_BRANCH"
- export LATEST="$IMAGE:latest"
- dnf install -y buildah runc
# Newer versions of podman/buildah try to set overlayfs mount options when
# using the vfs driver, and this causes errors.
- sed -i '/^mountopt =.*/d' /etc/containers/storage.conf
- echo "Building image $_UID"
- >
buildah bud
--build-arg DEFAULT_BRANCH=$GST_UPSTREAM_BRANCH
--arch=${ARCH:=amd64}
--label ci.job_id=$CI_JOB_ID
--label pipeline.url=$CI_PIPELINE_URL
--label git.ref_name=$CI_COMMIT_REF_NAME
--label git.sha=$CI_COMMIT_SHA
--label gitlab.project_path=$CI_PROJECT_PATH
--label gitlab.project_url=$CI_PROJECT_URL
-f $DOCKERFILE
-t $IMAGE
$CONTEXT_DIR
- buildah login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# If we are in a fork, push the image to the reigstry regardless the branch
- |
if [ "$CI_PROJECT_NAMESPACE" != "gstreamer" ]; then
# Tag the image with the git ref
buildah tag $_UID $LATEST
# Only push the :latest so with each push the previous
# image in the forked registry gets overrwritten
# to avoid bloating the registry and making
# pruning easier for the gitlab admins
buildah push $LATEST
fi
# Push the images to the upstream registry
- |
if [ "$CI_PROJECT_NAMESPACE" = "gstreamer" ]; then
buildah push $_UID
fi
alpine amd64 manifest builder docker:
stage: "build docker"
variables:
TAG: "build-manifest"
CONTEXT_DIR: "docker/build_manifest/"
DOCKERFILE: "docker/build_manifest/Dockerfile"
extends: .base
test manifest amd64 docker:
stage: "build docker"
variables:
TAG: "test-manifest"
CONTEXT_DIR: "docker/test_manifest/"
DOCKERFILE: "docker/test_manifest/Dockerfile"
extends: .base
gst-indent amd64 docker:
stage: "build docker"
variables:
TAG: "gst-indent"
CONTEXT_DIR: "docker/indent/"
DOCKERFILE: "docker/indent/Dockerfile"
extends: .base
fedora amd64 docker:
stage: "build docker"
variables:
TAG: "fedora"
CONTEXT_DIR: "docker/fedora/"
DOCKERFILE: "docker/fedora/Dockerfile"
extends: .base
cerbero fedora amd64 docker:
stage: "build docker"
variables:
TAG: "cerbero-fedora"
CONTEXT_DIR: "docker/cerbero/"
DOCKERFILE: "docker/cerbero/Dockerfile-fedora"
extends: .base
android docker:
stage: "build docker"
variables:
TAG: "android"
CONTEXT_DIR: "docker/android/"
DOCKERFILE: "docker/android/Dockerfile"
extends: .base
.local_rules: &local_rules
rules:
- if: '$CI_COMMIT_REF_NAME == "master" && $CI_PROJECT_PATH == "gstreamer/gst-ci"'
when: 'never'
- when: 'manual'
allow_failure: true
.local_template: &local_template
<<: *local_rules
needs:
- 'manifest'
# Test the build job against the latest build image tag and the local manifest
build fedora x86_64 local:
extends: '.build'
stage: 'build'
image: "${CI_REGISTRY_IMAGE}/amd64/fedora:latest"
artifacts:
expire_in: '5 days'
when: always
paths:
- "manifest.xml"
- "gst-build/"
<<: *local_template
build cerbero fedora x86_64 local:
extends: 'build cerbero fedora x86_64'
image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
<<: *local_template
build cerbero cross-android universal local:
extends: 'build cerbero cross-android universal'
image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
<<: *local_template
build cerbero cross win32 local:
extends: 'build cerbero cross win32'
image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
<<: *local_template
build cerbero cross win64 local:
extends: 'build cerbero cross win64'
image: "${CI_REGISTRY_IMAGE}/amd64/cerbero-fedora:latest"
<<: *local_template
# Note: dependencies: will be deprecated in the future, but current manual
# jobs with needs: (even if they are allowed to fail) will leave the pipeline
# pending.
.test fedora x86_64 local:
image: '${CI_REGISTRY_IMAGE}/amd64/fedora:latest'
extends: '.test'
<<: *local_rules
check fedora local:
extends: '.test fedora x86_64 local'
variables:
TEST_SUITE: 'check.gst*'
cross-android universal examples local:
extends: '.cross-android universal examples'
image: "${CI_REGISTRY_IMAGE}/amd64/android:latest"
<<: *local_rules
dependencies:
- 'build cerbero cross-android universal local'
integration testsuites fedora local:
extends: '.test fedora x86_64 local'
before_script:
- rm -f gst-build/build/subprojects/gstreamer-vaapi/gst/vaapi/libgstvaapi.so
variables:
EXTRA_VALIDATE_ARGS: "--timeout-factor=2 --retry-on-failures"
TEST_SUITE: "validate ges"