You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
285 lines
9.7 KiB
285 lines
9.7 KiB
|
|
variables:
|
|
DOCKER_REPOSITORY: mendersoftware/mender-convert
|
|
S3_BUCKET_NAME: mender-convert-images
|
|
|
|
# These variables are present elsewhere in the repository too. Make sure to
|
|
# search for and change them too.
|
|
MENDER_ARTIFACT_VERSION: master
|
|
MENDER_CLIENT_VERSION: latest
|
|
MENDER_ADDON_CONNECT_VERSION: latest
|
|
MENDER_ADDON_CONFIGURE_VERSION: latest
|
|
|
|
## Auto-update
|
|
RASPBIAN_URL: "https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2022-01-28/2022-01-28-raspios-bullseye-armhf-lite.zip"
|
|
RASPBIAN_NAME: 2022-01-28-raspios-bullseye-armhf-lite
|
|
|
|
# Which version of mender-convert to use in published image name. Normally
|
|
# empty, in which case the branch or tag name will be used, but this variable
|
|
# is available so that it's possible to make small build fixes on an already
|
|
# tagged version.
|
|
MENDER_CONVERT_PUBLISH_VERSION: ""
|
|
|
|
# Whether to run acceptance tests
|
|
TEST_MENDER_CONVERT: "true"
|
|
# Whether to publish packages automatically - they can always be published manually
|
|
PUBLISH_MENDER_CONVERT_AUTOMATIC: "false"
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
# Docker dind configuration.
|
|
# To use dind, make sure gitlab-runner's configuration
|
|
# has a common mount for /certs (i.e. runners.docker.volumes) directory
|
|
# and that the dind service name is always docker (default hostname).
|
|
DOCKER_HOST: "tcp://docker:2376"
|
|
DOCKER_CERT_PATH: "/certs/client"
|
|
DOCKER_TLS_VERIFY: "1"
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
include:
|
|
- project: 'Northern.tech/Mender/mendertesting'
|
|
file: '.gitlab-ci-check-commits.yml'
|
|
- project: 'Northern.tech/Mender/mendertesting'
|
|
file: '.gitlab-ci-check-license.yml'
|
|
- project: 'Northern.tech/Mender/mendertesting'
|
|
file: '.gitlab-ci-github-status-updates.yml'
|
|
- project: 'Northern.tech/Mender/mendertesting'
|
|
file: '.gitlab-ci-check-shell-format.yml'
|
|
|
|
stages:
|
|
- test
|
|
- build
|
|
- convert
|
|
- test_acceptance
|
|
- publish
|
|
|
|
test:check-commits:
|
|
only:
|
|
variables:
|
|
- '$TEST_MENDER_CONVERT == "true"'
|
|
|
|
test:check-license:
|
|
rules:
|
|
- if: '$TEST_MENDER_CONVERT == "true"'
|
|
|
|
test:check-shell-formatting:
|
|
rules:
|
|
- if: '$TEST_MENDER_CONVERT == "true"'
|
|
before_script:
|
|
- SHELL_SCRIPTS=$(find mender-convert* modules configs scripts
|
|
-type f
|
|
-not -name "*.md"
|
|
-not -path "scripts/linkbot/*"
|
|
-not -wholename "scripts/test/*")
|
|
|
|
build:
|
|
stage: build
|
|
needs: []
|
|
image: docker:git
|
|
services:
|
|
- docker:19.03.5-dind
|
|
script:
|
|
- IMAGE_NAME=$DOCKER_REPOSITORY:pr ./docker-build --build-arg MENDER_ARTIFACT_VERSION=${MENDER_ARTIFACT_VERSION}
|
|
- docker save $DOCKER_REPOSITORY:pr > image.tar
|
|
artifacts:
|
|
expire_in: 2w
|
|
paths:
|
|
- image.tar
|
|
|
|
.template_convert_raspbian: &convert_raspbian
|
|
stage: convert
|
|
needs:
|
|
- job: build
|
|
artifacts: true
|
|
image: ubuntu:18.04
|
|
services:
|
|
- docker:19.03-dind
|
|
tags:
|
|
- mender-qa-slave
|
|
before_script:
|
|
- apt update && apt install -yy bash wget unzip awscli docker.io curl
|
|
|
|
- export IMAGE_NAME=$DOCKER_REPOSITORY:pr
|
|
- docker load -i image.tar
|
|
|
|
- wget -q ${RASPBIAN_URL}
|
|
- unzip ${RASPBIAN_NAME}.zip
|
|
|
|
- eval "$(curl https://raw.githubusercontent.com/mendersoftware/mendertesting/master/mender-ci-common.sh)"
|
|
|
|
script:
|
|
- env MENDER_ARTIFACT_NAME=${RASPBIAN_NAME}-mender
|
|
./docker-mender-convert --disk-image ${RASPBIAN_NAME}.img
|
|
--config configs/${RASPBERRYPI_PLATFORM}_config
|
|
--config configs/images/raspberrypi_raspbian_config
|
|
|
|
# Collect artifacts.
|
|
- mv deploy ${RASPBERRYPI_PLATFORM}
|
|
- tar czf ${RASPBERRYPI_PLATFORM}.tar.gz ${RASPBERRYPI_PLATFORM}
|
|
# Upload to temporary S3 bucket
|
|
- mender_ci_save_tmp_artifact ${RASPBERRYPI_PLATFORM}.tar.gz
|
|
|
|
artifacts:
|
|
paths:
|
|
- checksums
|
|
|
|
convert_raspbian_raspberrypi3:
|
|
<<: *convert_raspbian
|
|
variables:
|
|
RASPBERRYPI_PLATFORM: raspberrypi3
|
|
|
|
convert_raspbian_raspberrypi4:
|
|
<<: *convert_raspbian
|
|
variables:
|
|
RASPBERRYPI_PLATFORM: raspberrypi4
|
|
|
|
.template_test_acceptance: &test_acceptance
|
|
stage: test_acceptance
|
|
needs:
|
|
- job: build
|
|
artifacts: true
|
|
image: ubuntu:18.04
|
|
services:
|
|
- docker:19.03-dind
|
|
tags:
|
|
- mender-qa-slave
|
|
timeout: 2h
|
|
before_script:
|
|
# Install dependencies
|
|
- apt update
|
|
- apt install -qyy bash wget git util-linux mtools python3 python3-pip
|
|
gcc python3-dev libffi-dev liblzo2-dev libc-dev libssl-dev make sudo
|
|
awscli unzip qemu-system-x86 ovmf curl docker.io
|
|
# Python3 dependencies
|
|
- python3 -m pip install -U pip
|
|
- pip3 install --ignore-installed -r https://raw.githubusercontent.com/mendersoftware/meta-mender/master/tests/acceptance/requirements_py3.txt
|
|
# Load image under test
|
|
- export IMAGE_NAME=$DOCKER_REPOSITORY:pr
|
|
- docker load -i image.tar
|
|
# Set mender-image-tests submodule to correct version
|
|
- git submodule update --init --recursive
|
|
# Get mender-artifact for the tests
|
|
- curl -f -O https://mender.s3.amazonaws.com/mender-artifact/$MENDER_ARTIFACT_VERSION/linux/mender-artifact
|
|
- chmod ugo+x mender-artifact
|
|
- mv mender-artifact /usr/bin/
|
|
- echo "MENDER_CLIENT_VERSION=${MENDER_CLIENT_VERSION}" > versions_override_config
|
|
- echo "MENDER_ADDON_CONNECT_VERSION=${MENDER_ADDON_CONNECT_VERSION}" >> versions_override_config
|
|
- echo "MENDER_ADDON_CONFIGURE_VERSION=${MENDER_ADDON_CONFIGURE_VERSION}" >> versions_override_config
|
|
# Get Update Modules Artifact generators for the tests
|
|
- if [ "${MENDER_CLIENT_VERSION}" = "latest" ]; then
|
|
- mender_version=master
|
|
- else
|
|
- mender_version="${MENDER_CLIENT_VERSION}"
|
|
- fi
|
|
- curl -f -O https://raw.githubusercontent.com/mendersoftware/mender/${mender_version}/support/modules-artifact-gen/directory-artifact-gen
|
|
- chmod ugo+x directory-artifact-gen
|
|
- mv directory-artifact-gen /usr/bin/
|
|
- curl -f -O https://raw.githubusercontent.com/mendersoftware/mender/${mender_version}/support/modules-artifact-gen/single-file-artifact-gen
|
|
- chmod ugo+x single-file-artifact-gen
|
|
- mv single-file-artifact-gen /usr/bin/
|
|
artifacts:
|
|
expire_in: 2w
|
|
when: always
|
|
paths:
|
|
- results_*.xml
|
|
- report_*.html
|
|
reports:
|
|
junit: results_*.xml
|
|
rules:
|
|
- if: '$TEST_MENDER_CONVERT == "true"'
|
|
|
|
.template_test_acceptance_prebuilt_raspberrypi: &test_acceptance_prebuilt_raspberrypi
|
|
<<: *test_acceptance
|
|
script:
|
|
- eval "$(curl https://raw.githubusercontent.com/mendersoftware/mendertesting/master/mender-ci-common.sh)"
|
|
# Fetch artifacts from temporary S3 bucket
|
|
- mender_ci_load_tmp_artifact ${RASPBERRYPI_PLATFORM}.tar.gz
|
|
- tar xzf ${RASPBERRYPI_PLATFORM}.tar.gz
|
|
- mv ${RASPBERRYPI_PLATFORM} deploy
|
|
# Extract converted Raspbian artifacts
|
|
- unxz deploy/${RASPBIAN_NAME}-${RASPBERRYPI_PLATFORM}-mender.img.xz
|
|
- ./scripts/test/run-tests.sh --prebuilt-image raspberrypi ${RASPBIAN_NAME}-${RASPBERRYPI_PLATFORM}-mender
|
|
|
|
test_acceptance_prebuilt_raspberrypi3:
|
|
<<: *test_acceptance_prebuilt_raspberrypi
|
|
needs:
|
|
- job: build
|
|
artifacts: true
|
|
- job: convert_raspbian_raspberrypi3
|
|
artifacts: true
|
|
variables:
|
|
RASPBERRYPI_PLATFORM: raspberrypi3
|
|
|
|
test_acceptance_prebuilt_raspberrypi4:
|
|
<<: *test_acceptance_prebuilt_raspberrypi
|
|
needs:
|
|
- job: build
|
|
artifacts: true
|
|
- job: convert_raspbian_raspberrypi4
|
|
artifacts: true
|
|
variables:
|
|
RASPBERRYPI_PLATFORM: raspberrypi4
|
|
|
|
test_acceptance_qemux86_64:
|
|
<<: *test_acceptance
|
|
script:
|
|
- ./scripts/test/run-tests.sh --config versions_override_config --only qemux86_64
|
|
|
|
test_acceptance_debian_qemux86_64:
|
|
<<: *test_acceptance
|
|
script:
|
|
- ./scripts/test/run-tests.sh --config versions_override_config --only debian-qemux86_64
|
|
|
|
test_acceptance_raspberrypi:
|
|
<<: *test_acceptance
|
|
script:
|
|
- ./scripts/test/run-tests.sh --config versions_override_config --only raspberrypi3
|
|
|
|
test_acceptance_beaglebone:
|
|
<<: *test_acceptance
|
|
script:
|
|
- ./scripts/test/run-tests.sh --config versions_override_config --only beaglebone
|
|
|
|
test_acceptance_ubuntu:
|
|
<<: *test_acceptance
|
|
script:
|
|
- ./scripts/test/run-tests.sh --config versions_override_config --only ubuntu
|
|
|
|
.template:publish:s3:
|
|
stage: publish
|
|
image: debian:buster
|
|
before_script:
|
|
- apt update && apt install -yyq awscli curl
|
|
- eval "$(curl https://raw.githubusercontent.com/mendersoftware/mendertesting/master/mender-ci-common.sh)"
|
|
# Fetch artifacts from temporary S3 bucket
|
|
- for RASPBERRYPI_PLATFORM in raspberrypi3 raspberrypi4; do
|
|
- mender_ci_load_tmp_artifact ${RASPBERRYPI_PLATFORM}.tar.gz
|
|
- tar xzf ${RASPBERRYPI_PLATFORM}.tar.gz
|
|
- done
|
|
script:
|
|
- IMAGE_VERSION=${MENDER_CONVERT_PUBLISH_VERSION:-${CI_COMMIT_REF_NAME}}
|
|
|
|
- for RASPBERRYPI_PLATFORM in raspberrypi3 raspberrypi4; do
|
|
- PUBLISH_NAME=${RASPBIAN_NAME}-${RASPBERRYPI_PLATFORM}-mender-convert-${IMAGE_VERSION}.img.xz
|
|
- echo "Publishing ${PUBLISH_NAME} version to S3"
|
|
- aws s3 cp ${RASPBERRYPI_PLATFORM}/${RASPBIAN_NAME}-${RASPBERRYPI_PLATFORM}-mender.img.xz
|
|
s3://$S3_BUCKET_NAME/${RASPBIAN_NAME}/arm/${PUBLISH_NAME}
|
|
- aws s3api put-object-acl --acl public-read --bucket $S3_BUCKET_NAME
|
|
--key ${RASPBIAN_NAME}/arm/${PUBLISH_NAME}
|
|
|
|
- PUBLISH_NAME=${RASPBIAN_NAME}-${RASPBERRYPI_PLATFORM}-mender-convert-${IMAGE_VERSION}.mender
|
|
- echo "Publishing ${PUBLISH_NAME} version to S3"
|
|
- aws s3 cp ${RASPBERRYPI_PLATFORM}/${RASPBIAN_NAME}-${RASPBERRYPI_PLATFORM}-mender.mender
|
|
s3://$S3_BUCKET_NAME/${RASPBIAN_NAME}/arm/${PUBLISH_NAME}
|
|
- aws s3api put-object-acl --acl public-read --bucket $S3_BUCKET_NAME
|
|
--key ${RASPBIAN_NAME}/arm/${PUBLISH_NAME}
|
|
- done
|
|
|
|
publish:s3:manual:
|
|
when: manual
|
|
extends: .template:publish:s3
|
|
|
|
publish:s3:automatic:
|
|
rules:
|
|
- if: '$PUBLISH_MENDER_CONVERT_AUTOMATIC == "true"'
|
|
extends: .template:publish:s3
|
|
|