summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2017-10-13 11:45:17 +0100
committerBen Brown <ben.brown@codethink.co.uk>2017-10-13 12:21:09 +0100
commit76983b07e8e4f60761d929f02f0a95671b6c983e (patch)
tree9a43320567f097981895f8a798bdde5f9d7b17c0
parent2f051c93b708ff01a333f560995fa32b2ffde4fb (diff)
downloaddefinitions-76983b07e8e4f60761d929f02f0a95671b6c983e.tar.gz
Use templates for setup scripts
Allows us to only perform the tasks required for each tool.
-rw-r--r--.gitlab-ci.yml127
1 files changed, 79 insertions, 48 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7588d628..52cf8b5e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,54 +17,56 @@ cache:
- cache/ybd_base/gits
- cache/buildstream/sources/
-before_script:
- # Update to latest BuildStream
- - |
- cd ~/buildstream
- git pull origin master
- dnf install -y python3-pip
- 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
-
- # Enable push and pull for Baserock artifact cache (default config is pull only)
- - |
- mkdir -p ~/.config
- echo "projects:" > ~/.config/buildstream.conf
- echo " baserock:" > ~/.config/buildstream.conf
- echo " artifacts:" > ~/.config/buildstream.conf
- echo " pull-url: https://ostree.baserock.org/cache/" >> ~/.config/buildstream.conf
- if [ -n "$baserock_ostree_cache_private_key" ]; then
- echo " push-url: ostree@ostree.baserock.org:cache" >> ~/.config/buildstream.conf
- echo " push-port: 22200" >> ~/.config/buildstream.conf
- fi
- cat ~/.config/buildstream.conf
-
- # Install and configure YBD
- - |
- export LC_ALL="C.UTF-8"
- export CI_YBD_BRANCH=`[[ "$CI_BUILD_REF_NAME" =~ ^staging/fromybd/ ]] && echo -b ${CI_BUILD_REF_NAME#staging/fromybd/}`
- git clone https://gitlab.com/baserock/spec.git
- git clone https://gitlab.com/baserock/ybd.git $CI_YBD_BRANCH
- cd ybd && ./install_dependencies.sh && cd ..
- pip install -r spec/requirements.txt
-
+.ybd_before_script: &ybd_before_script
+ before_script:
+ # Install and configure YBD
+ - |
+ export LC_ALL="C.UTF-8"
+ export CI_YBD_BRANCH=`[[ "$CI_BUILD_REF_NAME" =~ ^staging/fromybd/ ]] && echo -b ${CI_BUILD_REF_NAME#staging/fromybd/}`
+ git clone https://gitlab.com/baserock/spec.git
+ git clone https://gitlab.com/baserock/ybd.git $CI_YBD_BRANCH
+ cd ybd && ./install_dependencies.sh && cd ..
+ pip install -r spec/requirements.txt
+
+.bst_before_script: &bst_before_script
+ before_script:
+ # Update to latest BuildStream
+ - |
+ cd ~/buildstream
+ git pull origin master
+ dnf install -y python3-pip
+ 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
+
+ # Enable push and pull for Baserock artifact cache (default config is pull only)
+ - |
+ mkdir -p ~/.config
+ echo "projects:" > ~/.config/buildstream.conf
+ echo " baserock:" > ~/.config/buildstream.conf
+ echo " artifacts:" > ~/.config/buildstream.conf
+ echo " pull-url: https://ostree.baserock.org/cache/" >> ~/.config/buildstream.conf
+ if [ -n "$baserock_ostree_cache_private_key" ]; then
+ echo " push-url: ostree@ostree.baserock.org:cache" >> ~/.config/buildstream.conf
+ echo " push-port: 22200" >> ~/.config/buildstream.conf
+ fi
+ cat ~/.config/buildstream.conf
stages:
- preprocess
@@ -75,11 +77,13 @@ stages:
ybd-validate-all-definitions:
stage: preprocess
+ <<: *ybd_before_script
script:
- python spec/quick_check.py .
ybd-build-system-x86_64-chroot-build:
stage: build-1
+ <<: *ybd_before_script
script:
- ybd/ybd.py systems/build-system-x86_64-chroot.morph x86_64
@@ -87,6 +91,7 @@ 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
artifacts:
@@ -106,35 +111,41 @@ ybd-build-system-x86_64-chroot-deploy:
ybd-devel-build-64:
stage: build-2
+ <<: *ybd_before_script
script:
- ybd/ybd.py systems/devel-system-x86_64-generic.morph x86_64
ybd-genivi-baseline-build-64:
stage: build-2
+ <<: *ybd_before_script
script:
- ybd/ybd.py genivi/systems/genivi-baseline-system-x86_64-generic.morph x86_64
- ybd/ybd.py systems/initramfs-x86_64.morph x86_64
ybd-genivi-demo-platform-build-64:
stage: build-3
+ <<: *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-ivi-build-64:
stage: build-3
+ <<: *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-gnome-build-64:
stage: build-3
+ <<: *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-minimal-build-64:
stage: build-1
+ <<: *ybd_before_script
script:
- ybd/ybd.py systems/minimal-system-x86_64-chroot.morph x86_64
@@ -142,6 +153,7 @@ 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
artifacts:
@@ -151,17 +163,20 @@ ybd-minimal-system-x86_64-chroot-deploy:
ybd-trove-build-64:
stage: build-2
+ <<: *ybd_before_script
script:
- ybd/ybd.py trove/systems/trove-system-x86_64.morph x86_64
ybd-weston-build-64:
stage: build-2
+ <<: *ybd_before_script
script:
- ybd/ybd.py weston/systems/weston-system-x86_64-generic.morph x86_64
- ybd/ybd.py systems/initramfs-x86_64.morph x86_64
ybd-weston-qt-build-64:
stage: build-3
+ <<: *ybd_before_script
script:
- ybd/ybd.py weston/systems/weston-qt5-system-x86_64.morph x86_64
- ybd/ybd.py systems/initramfs-x86_64.morph x86_64
@@ -174,6 +189,7 @@ ybd-weston-qt-build-64:
# Convert the Baserock definitions to BuildStream format
bst-convert:
stage: preprocess
+ <<: *bst_before_script
script:
# Install YBD and defs2bst
- |
@@ -191,57 +207,68 @@ bst-convert:
# Test building a common Baserock system
bst-build-build-system:
stage: build-1
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/build-system-content.bst
# Test building all converted Baserock systems
bst-build-base-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/base-system-content.bst
bst-build-devel-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/devel-system-content.bst
bst-build-genivi-demo-platform-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/genivi-demo-platform-content.bst
bst-build-gnome-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/gnome-system-content.bst
bst-build-ivi-demo-platform-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/ivi-system-content.bst
bst-build-minimal-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/minimal-system-content.bst
bst-build-openstack-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/openstack-system-content.bst
bst-build-trove-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/trove-system-content.bst
bst-build-weston-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/weston-system-content.bst
bst-build-weston-qt5-system:
stage: build-2
+ <<: *bst_before_script
script:
- scripts/bst-build-or-show systems/weston-qt5-system-content.bst
@@ -249,20 +276,24 @@ bst-build-weston-qt5-system:
# architecture.
bst-build-sysroot-armv8b64:
stage: build-3
+ <<: *bst_before_script
script:
- scripts/bst-cross-build-or-show armv8b64 gnu-toolchain/stage2.bst
bst-build-sysroot-armv8l64:
stage: build-3
+ <<: *bst_before_script
script:
- scripts/bst-cross-build-or-show armv8l64 gnu-toolchain/stage2.bst
bst-build-sysroot-ppc64b:
stage: build-3
+ <<: *bst_before_script
script:
- scripts/bst-cross-build-or-show ppc64b gnu-toolchain/stage2.bst
bst-build-sysroot-ppc64l:
stage: build-3
+ <<: *bst_before_script
script:
- scripts/bst-cross-build-or-show ppc64l gnu-toolchain/stage2.bst