diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de577b6578e4f75a9e0d4aa9d26bc4e890cfb9b6..0ba7d54fe05748d7723e0aa9f77d8766f2e939b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,18 @@ -build: +variables: + DRV_DIR: 'broadcom' + DRV_VERSION: '07.706.03.00' + KERNEL_MAJOR_VERSION: '4.9' + IS_BPO: 'false' + +stages: + - build + - deploy + +build-debian-packages: + stage: build tags: - docker image: debian:stretch - variables: - DRV_NAME: 'megaraid_sas' - DRV_DIR: 'broadcom' - DRV_VERSION: '07.706.03.00' - PKG_NAME_PREFIX: 'megaraid-sas' - KERNEL_VERSION_FILTER: "[[:digit:]]\\+\\.[[:digit:]]\\+\\.[[:digit:]]\\+-[[:digit:]]-amd64" script: - set -x - echo -n > /etc/apt/sources.list @@ -20,8 +25,7 @@ build: - echo "deb http://ftp.fr.debian.org/debian/ stretch-updates main" >> /etc/apt/sources.list - echo "deb http://ftp.fr.debian.org/debian/ stretch-backports main" >> /etc/apt/sources.list - apt-get update - - apt-cache search "linux-image" | grep -o -e "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+-[[:digit:]]\(\.bpo\.[[:digit:]]\+\)\?-amd64" | sort -V - - KERNEL_VERSION=$(apt-cache search "linux-image" | grep -o -e "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+-[[:digit:]]\(\.bpo\.[[:digit:]]\+\)\?-amd64" | sort -V | grep -e ${KERNEL_VERSION_FILTER} | tail -n1) + - KERNEL_VERSION=$(apt-cache search "^linux-image-${KERNEL_MAJOR_VERSION}\.[[:digit:]]+-[[:digit:]]+(\.bpo\.[[:digit:]]+)?-amd64$" | awk ' {print $1 | "sort"}' | ([[ $IS_BPO = true ]] && grep 'bpo' || grep -v 'bpo') | tail -n1 | grep -o -E "[[:digit:]]\.[[:digit:]]+\.[[:digit:]]+-[[:digit:]]+(\.bpo\.[[:digit:]]+)?-amd64") - echo "Building ${DRV_NAME} from ${DRV_DIR} version ${DRV_VERSION} for kernel ${KERNEL_VERSION}..." - apt-get -y --no-install-recommends install linux-image-${KERNEL_VERSION} linux-headers-${KERNEL_VERSION} dkms dpkg-dev debhelper fakeroot - cd ${DRV_DIR}-${DRV_VERSION} @@ -35,6 +39,14 @@ build: - cp -v /var/lib/dkms/${DRV_NAME}/${DRV_VERSION}/bmdeb/${PKG_NAME_PREFIX}-modules-${KERNEL_VERSION}_${DRV_VERSION}_amd64.deb ../deb/ artifacts: paths: - - deb/${PKG_NAME_PREFIX}-modules-${KERNEL_VERSION}_${DRV_VERSION}_amd64.deb - - deb/${PKG_NAME_PREFIX}-dkms_${DRV_VERSION}_all.deb + - "deb/${PKG_NAME_PREFIX}-modules-${KERNEL_MAJOR_VERSION}*_${DRV_VERSION}_amd64.deb" + - "deb/${PKG_NAME_PREFIX}-dkms_${DRV_VERSION}_all.deb" expire_in: '1 day' + +deploy: + stage: deploy + tags: + - packages + script: + - g5k-deploy-files --files "deb/${PKG_NAME_PREFIX}-modules-${KERNEL_MAJOR_VERSION}*_${DRV_VERSION}_amd64.deb" --directory deb/megaraid-sas + - g5k-deploy-files --files "deb/${PKG_NAME_PREFIX}-dkms_${DRV_VERSION}_all.deb" --directory deb/megaraid-sas