From 5463396b1d47a122f5aef9a619244fd1777c0b56 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Fri, 5 Jul 2019 17:45:39 +0200 Subject: Reusable meta-updater pipeline suite Squashed: * Oe-selftest GitLab pipeline stage * Use credentials for CI's oe-selftest * Setup kvm trick for docker on CI The gid of the kvm group needs to match the one from the host * Run ci scripts from Docker images * Template out jobs and split .gitlab-ci.yml To be easily reused in other branches and projects Rely on this gitlab feature: https://docs.gitlab.com/ee/ci/yaml/#extends * More flexible checkout script for CI - can work without $CURRENT_PROJECT (checks out everything) - can take a list of pinned versions * Add optional CI jobs ptest and other oe-selftests * Publish bitbaked images as artifacts Signed-off-by: Laurent Bonnans --- scripts/ci/checkout-oe.sh | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'scripts/ci/checkout-oe.sh') diff --git a/scripts/ci/checkout-oe.sh b/scripts/ci/checkout-oe.sh index 8744b2f..a99f235 100755 --- a/scripts/ci/checkout-oe.sh +++ b/scripts/ci/checkout-oe.sh @@ -6,7 +6,11 @@ set -x REMOTE_SOURCE=${REMOTE_SOURCE:-https://github.com/advancedtelematic} MANIFEST=${MANIFEST:-master} -CURRENT_PROJECT=${CURRENT_PROJECT:-meta-updater} +CURRENT_PROJECT=${CURRENT_PROJECT:-} + +# list of projects to pin to one version in the format: +# "project:rev;project2:rev2..." +PIN_LIST=${PIN_LIST:-} #CURRENT_REV=$(git rev-parse HEAD) LOCAL_REPO=$PWD @@ -22,26 +26,48 @@ git -C .repo/manifests reset --hard # patch manifest: # - add a new "ats" remote that points to "$REMOTE_SOURCE" # - change projects that contain "advancedtelematic" to use the ats remote -# - remove the current project from the manifest MANIFEST_FILE=".repo/manifests/${MANIFEST}.xml" xmlstarlet ed --omit-decl -L \ -s "/manifest" -t elem -n "remote" -v "" \ -i "/manifest/remote[last()]" -t attr -n "name" -v "ats" \ -i "/manifest/remote[last()]" -t attr -n "fetch" -v "$REMOTE_SOURCE" \ + -d "/manifest/project[contains(@name, 'advancedtelematic')]/@remote" \ -i "/manifest/project[contains(@name, 'advancedtelematic')]" -t attr -n "remote" -v "ats" \ - -d "/manifest/project[@path=\"$CURRENT_PROJECT\"]" \ "$MANIFEST_FILE" # hack: sed on `advancedtelematic/` names, to remove this unwanted prefix sed -i 's#name="advancedtelematic/#name="#g' "$MANIFEST_FILE" +# pin projects from the list +( +IFS=";" +for pin in $PIN_LIST; do + IFS=":" + read -r project rev <<< "$pin" + xmlstarlet ed --omit-decl -L \ + -i "/manifest/project[@name=\"$project\"]/@revision" -t attr -n "revision" -v "$rev" \ + -i "/manifest/project[@name=\"$project\"]" -t attr -n "revision" -v "$rev" \ + "$MANIFEST_FILE" + IFS=";" +done +) + +# Remove the current project from the manifest if we have it checked out +if [ -n "$CURRENT_PROJECT" ]; then + xmlstarlet ed --omit-decl -L \ + -d "/manifest/project[@name=\"$CURRENT_PROJECT\"]" \ + "$MANIFEST_FILE" +fi + repo manifest repo forall -c 'git reset --hard ; git clean -fdx' repo sync -d --force-sync -rm -f "$CURRENT_PROJECT" -ln -s "$LOCAL_REPO" "$CURRENT_PROJECT" +if [ -n "$CURRENT_PROJECT" ]; then + rm -f "$CURRENT_PROJECT" + ln -s "$LOCAL_REPO" "$CURRENT_PROJECT" +fi repo manifest -r -- cgit v1.2.3-54-g00ecf