image: buildstream/buildstream-fedora:latest variables: # Store everything under the /builds directory. This is a separate Docker # volume. Note that GitLab CI will only cache stuff inside the build # directory. Note also that YBD recursively scans the current directory # to find what definitions to build -- that's why we put the cache in a # hidden directory. XDG_CACHE_HOME: "${CI_PROJECT_DIR}/.cache" YBD_base: "/cache/ybd_base" YBD_gits: "${CI_PROJECT_DIR}/.cache/ybd_base/gits" DEFS2BST_SHA: '1dc5c0719de9357470b29ad4adc9b63f7012db86' GET_SOURCES_ATTEMPTS: 3 .ybd_before_script: &ybd_before_script before_script: # Install and configure YBD - | export SPEC_SHA='715023f3cf6e714839fb56236ade20de40855bd4' export YBD_SHA='157986cb2f7c0b95e0e4e0bf3a39547f548a298d' export LC_ALL="C.UTF-8" git clone https://gitlab.com/baserock/spec.git # Use specific version of spec.git git -C spec checkout $SPEC_SHA git clone https://gitlab.com/baserock/ybd.git # Use specific version of ybd.git git -C ybd checkout $YBD_SHA cd ybd && ./install_dependencies.sh && cd .. pip install -r spec/requirements.txt .bst_before_script: &bst_before_script before_script: - | export BST_SHA='3fd7fe1fd3406fc9c35d0d2719085809c48247c7' git clone https://gitlab.com/BuildStream/buildstream.git # Use specific version of BuildStream cd buildstream && git checkout $BST_SHA pip3 install . cd - # Create ~/.ssh for storing keys - mkdir -p ~/.ssh # Private key stored as a protected variable that allows pushing to # ostree@ostree.baserock.org - | if [ -z "$baserock_ostree_cache_private_key" ]; then echo >&2 "Private key for ostree.baserock.org is not available." else echo "$baserock_ostree_cache_private_key" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub fi # Trust the host key of the cache server. - ssh-keyscan -p 22200 ostree.baserock.org >> ~/.ssh/known_hosts # If we can push, then enable push and pull for Baserock artifact cache # (default config is pull only) - | if [ -n "$baserock_ostree_cache_private_key" ]; then mkdir -p ~/.config echo "projects:" > ~/.config/buildstream.conf echo " baserock:" >> ~/.config/buildstream.conf echo " artifacts:" >> ~/.config/buildstream.conf echo " url: ssh://ostree@ostree.baserock.org:22200/cache" >> ~/.config/buildstream.conf fi cat ~/.config/buildstream.conf # Nuke ybd cache to ensure buildstream tasks have enough disk space. - rm -rf "${YBD_base}" # Store all the downloaded git and ostree repos in the distributed cache. # This saves us fetching them from git.baserock.org and further afield # on every build. .ybd_cache: &ybd_cache cache: # GitLab defined default key is "default". Reuse this for ybd. key: default paths: - "${YBD_gits}/" .bst_cache: &bst_cache cache: key: bst paths: - "${XDG_CACHE_HOME}/buildstream/sources/" stages: - preprocess - build-1 - deploy-1 - build-2 ybd-validate-all-definitions: stage: preprocess <<: *ybd_before_script script: - python spec/quick_check.py . <<: *ybd_cache ybd-build-system-x86_64-chroot-build: stage: build-1 dependencies: [] <<: *ybd_before_script script: - ybd/ybd.py systems/build-system-x86_64-chroot.morph x86_64 <<: *ybd_cache ybd-build-system-x86_64-chroot-deploy: stage: deploy-1 dependencies: - ybd-build-system-x86_64-chroot-build <<: *ybd_before_script script: - ybd/ybd.py clusters/build-system-x86_64-chroot-deploy.morph x86_64 cache: # GitLab defined default key is "default". Reuse this for ybd. key: default policy: pull paths: - .cache/ybd_base/gits artifacts: name: "${CI_BUILD_NAME}-${CI_BUILD_REF}" paths: - build-system-x86_64-chroot.tar #build-system-armv7lhf-rootfs-build: # stage: build-1 # script: # - sudo ybd/ybd.py systems/build-system-armv7lhf-rootfs.morph armv7lhf # tags: # - armv7l # only: # - master # - /^staging\/.*$/ ybd-genivi-demo-platform-build-64: stage: build-2 dependencies: [] <<: *ybd_before_script script: - ybd/ybd.py genivi/systems/genivi-demo-platform-x86_64-generic.morph x86_64 - ybd/ybd.py systems/initramfs-x86_64.morph x86_64 <<: *ybd_cache ybd-ivi-build-64: stage: build-2 dependencies: [] <<: *ybd_before_script script: - ybd/ybd.py ivi/systems/ivi-system-x86_64.morph x86_64 - ybd/ybd.py systems/initramfs-x86_64.morph x86_64 <<: *ybd_cache ybd-gnome-build-64: stage: build-2 dependencies: [] <<: *ybd_before_script script: - ybd/ybd.py gnome/systems/gnome-system-x86_64.morph x86_64 - ybd/ybd.py systems/initramfs-x86_64.morph x86_64 <<: *ybd_cache ybd-minimal-build-64: stage: build-1 dependencies: [] <<: *ybd_before_script script: - ybd/ybd.py systems/minimal-system-x86_64-chroot.morph x86_64 <<: *ybd_cache ybd-minimal-system-x86_64-chroot-deploy: stage: deploy-1 dependencies: - ybd-minimal-build-64 <<: *ybd_before_script script: - ybd/ybd.py clusters/minimal-system-x86_64-chroot-deploy.morph x86_64 cache: # GitLab defined default key is "default". Reuse this for ybd. key: default policy: pull paths: - .cache/ybd_base/gits artifacts: name: "${CI_BUILD_NAME}-${CI_BUILD_REF}" paths: - minimal-system-x86_64-chroot.tar ybd-trove-build-64: stage: build-2 dependencies: [] <<: *ybd_before_script script: - ybd/ybd.py trove/systems/trove-system-x86_64.morph x86_64 <<: *ybd_cache ########################################## # BuildStream conversions and tests # ########################################## # Convert the Baserock definitions to BuildStream format bst-convert: stage: preprocess <<: *bst_before_script script: # Install YBD and defs2bst - | if [ ! -d ./ybd ]; then git clone https://gitlab.com/baserock/ybd.git git -C ybd checkout $YBD_SHA cd ybd && ./install_dependencies.sh && cd - fi git clone https://gitlab.com/BuildStream/defs2bst.git git -C defs2bst checkout $DEFS2BST_SHA echo "defs2bst version: $(git -C ./defs2bst rev-parse HEAD)" - ./convert artifacts: paths: - elements/ <<: *ybd_cache # Test building a common Baserock system bst-build-build-system: stage: build-1 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/build-system-content.bst <<: *bst_cache # Test building all converted Baserock systems bst-build-base-system: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/base-system-content.bst <<: *bst_cache bst-build-genivi-demo-platform-system: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/genivi-demo-platform-content.bst <<: *bst_cache bst-build-gnome-system: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/gnome-system-content.bst <<: *bst_cache bst-build-ivi-demo-platform-system: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/ivi-system-content.bst <<: *bst_cache bst-build-minimal-system: stage: build-1 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/minimal-system-content.bst <<: *bst_cache bst-build-openstack-system: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/openstack-system-content.bst <<: *bst_cache bst-build-trove-system: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-build-or-show systems/trove-system-content.bst <<: *bst_cache # Test cross building a toolchain and sysroot for each supported non-x86_64 # architecture. bst-build-sysroot-armv8b64: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-cross-build-or-show armv8b64 gnu-toolchain/stage2.bst <<: *bst_cache bst-build-sysroot-armv8l64: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-cross-build-or-show armv8l64 gnu-toolchain/stage2.bst <<: *bst_cache bst-build-sysroot-ppc64b: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-cross-build-or-show ppc64b gnu-toolchain/stage2.bst <<: *bst_cache bst-build-sysroot-ppc64l: stage: build-2 dependencies: - bst-convert <<: *bst_before_script script: - scripts/bst-cross-build-or-show ppc64l gnu-toolchain/stage2.bst <<: *bst_cache