<?xml version='1.1' encoding='UTF-8'?>
<matrix-project plugin="matrix-project@1.16">
  <actions/>
  <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
  <displayName>Schneider OpenEmbedded (warrior 4.19) RFS</displayName>
  <logRotator class="hudson.tasks.LogRotator">
    <daysToKeep>30</daysToKeep>
    <numToKeep>30</numToKeep>
    <artifactDaysToKeep>-1</artifactDaysToKeep>
    <artifactNumToKeep>1</artifactNumToKeep>
  </logRotator>
  <keepDependencies>false</keepDependencies>
  <properties>
    <hudson.security.AuthorizationMatrixProperty>
      <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.InheritParentStrategy"/>
      <permission>hudson.model.Item.Build:ralph.siemsen@linaro.org</permission>
      <permission>hudson.model.Item.Build:ryan.harkin@linaro.org</permission>
      <permission>hudson.model.Item.Build:schneider-linaro-git@linaro.org</permission>
      <permission>hudson.model.Item.Cancel:ralph.siemsen@linaro.org</permission>
      <permission>hudson.model.Item.Cancel:ryan.harkin@linaro.org</permission>
      <permission>hudson.model.Item.Cancel:schneider-linaro-git@linaro.org</permission>
      <permission>hudson.model.Item.ExtendedRead:anonymous</permission>
      <permission>hudson.model.Item.ExtendedRead:ralph.siemsen@linaro.org</permission>
      <permission>hudson.model.Item.ExtendedRead:ryan.harkin@linaro.org</permission>
      <permission>hudson.model.Item.ExtendedRead:schneider-linaro-git@linaro.org</permission>
      <permission>hudson.model.Item.Read:anonymous</permission>
      <permission>hudson.model.Item.Read:ralph.siemsen@linaro.org</permission>
      <permission>hudson.model.Item.Read:ryan.harkin@linaro.org</permission>
      <permission>hudson.model.Item.Read:schneider-linaro-git@linaro.org</permission>
      <permission>hudson.model.Item.Workspace:anonymous</permission>
    </hudson.security.AuthorizationMatrixProperty>
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <hudson.model.StringParameterDefinition>
          <name>IMAGES</name>
          <description></description>
          <defaultValue>dip-image dip-image-dev dip-image-edge</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>SUBMODULES</name>
          <description></description>
          <defaultValue>all</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>IMAGES_RPB</name>
          <description></description>
          <defaultValue></defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>IMAGES_RPB_WAYLAND</name>
          <description></description>
          <defaultValue></defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>DISTRO_URL_BASE</name>
          <description></description>
          <defaultValue>ssh://git@dev-private-git.linaro.org/schneider</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>DISTRO_DIR</name>
          <description></description>
          <defaultValue>DIP-Yocto-Linux-Distro</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>MANIFEST_BRANCH</name>
          <description></description>
          <defaultValue>linaro-warrior</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>BASE_URL</name>
          <description></description>
          <defaultValue>https://snapshots.linaro.org/</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>LAVA_SERVER</name>
          <description></description>
          <defaultValue>https://validation.linaro.org/RPC2/</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>STAGING_LAVA_SERVER</name>
          <description></description>
          <defaultValue>https://staging.validation.linaro.org/RPC2/</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>QA_SERVER</name>
          <description></description>
          <defaultValue>https://qa-reports.linaro.org</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>QA_SERVER_TEAM</name>
          <description></description>
          <defaultValue>schneider</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>QA_SERVER_PROJECT</name>
          <description></description>
          <defaultValue>warrior-4.19</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>AUTH_GROUPS</name>
          <description></description>
          <defaultValue>linaro, sse-team, schneider-team, schneider-linaro-git</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>KERNEL_VERSION</name>
          <description></description>
          <defaultValue>4.19</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
        <hudson.model.StringParameterDefinition>
          <name>TEST_LEVEL</name>
          <description></description>
          <defaultValue>normal</defaultValue>
          <trim>false</trim>
        </hudson.model.StringParameterDefinition>
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
  </properties>
  <scm class="hudson.scm.NullSCM"/>
  <assignedNode>master</assignedNode>
  <canRoam>false</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <axes>
    <hudson.matrix.TextAxis>
      <name>MACHINE</name>
      <values>
        <string>rzn1d</string>
        <string>soca9</string>
      </values>
    </hudson.matrix.TextAxis>
    <hudson.matrix.TextAxis>
      <name>DISTRO</name>
      <values>
        <string>dip</string>
      </values>
    </hudson.matrix.TextAxis>
    <hudson.matrix.LabelAxis>
      <name>label</name>
      <values>
        <string>docker-stretch-amd64</string>
      </values>
    </hudson.matrix.LabelAxis>
  </axes>
  <combinationFilter></combinationFilter>
  <builders>
    <hudson.tasks.Shell>
      <command>#!/bin/bash

echo &quot;PUB_DEST=openembedded/schneider/${MANIFEST_BRANCH}-${KERNEL_VERSION}/${MACHINE}/${BUILD_NUMBER}/${DISTRO}&quot; &gt; pub_dest_parameters
</command>
    </hudson.tasks.Shell>
    <EnvInjectBuilder plugin="envinject@2.3.0">
      <info>
        <propertiesFilePath>pub_dest_parameters</propertiesFilePath>
      </info>
    </EnvInjectBuilder>
    <hudson.tasks.Shell>
      <command>#!/bin/bash

set -e

# workaround EDK2 is confused by the long path used during the build
# and truncate files name expected by VfrCompile
sudo mkdir -p /srv/oe
sudo chown buildslave:buildslave /srv/oe
cd /srv/oe

trap cleanup_exit INT TERM EXIT

cleanup_exit()
{
    echo &quot;Running cleanup_exit...&quot;
}

if ! sudo DEBIAN_FRONTEND=noninteractive apt-get -q=2 update; then
  echo &quot;INFO: apt update error - try again in a moment&quot;
  sleep 15
  sudo DEBIAN_FRONTEND=noninteractive apt-get -q=2 update || true
fi
pkg_list=&quot;python-pip android-tools-fsutils chrpath cpio diffstat gawk libmagickwand-dev libmath-prime-util-perl libsdl1.2-dev libssl-dev python-requests texinfo vim-tiny whiptail&quot;
if ! sudo DEBIAN_FRONTEND=noninteractive apt-get -q=2 install -y ${pkg_list}; then
  echo &quot;INFO: apt install error - try again in a moment&quot;
  sleep 15
  sudo DEBIAN_FRONTEND=noninteractive apt-get -q=2 install -y ${pkg_list}
fi

# Install ruamel.yaml
pip install --user --force-reinstall ruamel.yaml

set -ex

#DEL mkdir -p ${HOME}/bin
#DEL curl https://storage.googleapis.com/git-repo-downloads/repo &gt; ${HOME}/bin/repo
#DEL chmod a+x ${HOME}/bin/repo
#DEL export PATH=${HOME}/bin:${PATH}

# initialize repo if not done already
if [ ! -e &quot;.repo/manifest.xml&quot; ]; then
   #DEL repo init -u ${MANIFEST_URL} -b ${MANIFEST_BRANCH_PREFIX}${MANIFEST_BRANCH}

   # link to shared downloads on persistent disk
   # our builds config is expecting downloads and sstate-cache, here.
   # DL_DIR = &quot;${OEROOT}/sources/downloads&quot;
   # SSTATE_DIR = &quot;${OEROOT}/build/sstate-cache&quot;
   sstatecache=${HOME}/srv/oe/sstate-cache-${DISTRO}-${MACHINE}-${MANIFEST_BRANCH}-${KERNEL_VERSION}
   mkdir -p ${HOME}/srv/oe/downloads ${sstatecache}
   #DEL mkdir -p build
   #DEL ln -s ${HOME}/srv/oe/downloads
   #DEL ln -s ${HOME}/srv/oe/sstate-cache-${DISTRO}-${MANIFEST_BRANCH} sstate-cache
fi


#DEL if [ &quot;${ghprbPullId}&quot; ]; then
#DEL     echo &quot;Applying Github pull-request #${ghprbPullId} from ${ghprbGhRepository}&quot;
#DEL     sed -i -e &quot;s|name=\&quot;${ghprbGhRepository}\&quot;|name=\&quot;${ghprbGhRepository}\&quot; revision=\&quot;refs/pull/${ghprbPullId}/head\&quot;|&quot; .repo/manifest.xml
#DEL fi

#DEL repo sync
#DEL cp .repo/manifest.xml source-manifest.xml
#DEL repo manifest -r -o pinned-manifest.xml
#DEL MANIFEST_COMMIT=$(cd .repo/manifests &amp;&amp; git rev-parse --short HEAD)

#DEL  record changes since last build, if available
#DEL if wget -q ${BASE_URL}${PUB_DEST/\/${BUILD_NUMBER}\//\/latest\/}/pinned-manifest.xml -O pinned-manifest-latest.xml; then
#DEL     repo diffmanifests ${PWD}/pinned-manifest-latest.xml ${PWD}/pinned-manifest.xml &gt; manifest-changes.txt
#DEL else
#DEL     echo &quot;latest build published does not have pinned-manifest.xml, skipping diff report&quot;
#DEL fi

#DEL if [ -n &quot;$GERRIT_PROJECT&quot; ] &amp;&amp; [ $GERRIT_EVENT_TYPE == &quot;patchset-created&quot; ]; then
#DEL     GERRIT_URL=&quot;http://${GERRIT_HOST}/${GERRIT_PROJECT}&quot;
#DEL     cd `grep -rni $GERRIT_PROJECT\&quot; .repo/manifest.xml | grep -Po &apos;path=&quot;\K[^&quot;]*&apos;`
#DEL     if git pull ${GERRIT_URL} ${GERRIT_REFSPEC} | grep -q &quot;Automatic merge failed&quot;; then
#DEL         git reset --hard
#DEL         echo &quot;Error: *** Error patch merge failed&quot;
#DEL         exit 1
#DEL     fi
#DEL     cd -
#DEL fi

git clone ${DISTRO_URL_BASE}/${DISTRO_DIR} -b ${MANIFEST_BRANCH}
cd ${DISTRO_DIR}
git log -1
git submodule init
git submodule update

# the setup-environment will create auto.conf and site.conf
# make sure we get rid of old config.
# let&apos;s remove the previous TMPDIR as well.
# we want to preserve build/buildhistory though.
#DEL rm -rf conf build/conf build/tmp/

# Accept EULA if/when needed
#DEL export EULA_dragonboard410c=1
#DEL export EULA_stih410b2260=1
#DEL source setup-environment build

# Set the machine to the value expected by the Yocto environment
# We set it back again later
machine_orig=${MACHINE}
case &quot;${MACHINE}&quot; in
  *rzn1*)
    MACHINE=rzn1-snarc
    ;;
  *soca9*)
    MACHINE=snarc-soca9
    ;;
esac

# SUBMODULES is set to:
#	none		no update
#	&apos;&apos;		update default set in setup-env...
#	all		tell setup-env... to update all submodules
#	&apos;&lt;something&gt;&apos;	pass the variable to submodule update
if [[ ${MANIFEST_BRANCH} == linaro-* ]];
then
	if [[ &quot;${SUBMODULES}&quot; != &quot;none&quot; ]]; then
	  ./setup-environment -s build-${machine_orig}/
	fi
fi

source ./setup-environment build-${machine_orig}/

ln -s ${HOME}/srv/oe/downloads
ln -s ${sstatecache} sstate-cache

# Add job BUILD_NUMBER to output files names
cat &lt;&lt; EOF &gt;&gt; conf/auto.conf
IMAGE_NAME_append = &quot;-${BUILD_NUMBER}&quot;
KERNEL_IMAGE_BASE_NAME_append = &quot;-${BUILD_NUMBER}&quot;
MODULE_IMAGE_BASE_NAME_append = &quot;-${BUILD_NUMBER}&quot;
DT_IMAGE_BASE_NAME_append = &quot;-${BUILD_NUMBER}&quot;
BOOT_IMAGE_BASE_NAME_append = &quot;-${BUILD_NUMBER}&quot;
EOF

# get build stats to make sure that we use sstate properly
cat &lt;&lt; EOF &gt;&gt; conf/auto.conf
INHERIT += &quot;buildstats buildstats-summary&quot;
EOF

# allow the top level job to append to auto.conf
if [ -f ${WORKSPACE}/auto.conf ]; then
    cat ${WORKSPACE}/auto.conf &gt;&gt; conf/auto.conf
fi

# add useful debug info
cat conf/auto.conf

[ &quot;${DISTRO}&quot; = &quot;rpb&quot; ] &amp;&amp; IMAGES+=&quot; ${IMAGES_RPB}&quot;
[ &quot;${DISTRO}&quot; = &quot;rpb-wayland&quot; ] &amp;&amp; IMAGES+=&quot; ${IMAGES_RPB_WAYLAND}&quot;

# These machines only build the basic rpb-console-image
case &quot;${MACHINE}&quot; in
  am57xx-evm|intel-core2-32|intel-corei7-64)
     IMAGES=&quot;rpb-console-image&quot;
     ;;
  *rzn1*)
    # Temporary sstate cleanup to force binaries to be re-generated each time
    set +e
    clean_packages=&quot;\
        base-files \
        fsbl \
        optee-os \
        optee-test \
        u-boot-rzn1 \
        u-boot-rzn1-spkg \
        linux-rzn1 \
        mbedtls \
        &quot;
    set -e
    ;;
  *soca9*)
    clean_packages=&quot;\
        base-files \
        u-boot-socfpga \
        linux-socfpga \
        &quot;
    IMAGES=&quot;$(echo $IMAGES | sed -e &apos;s/dip-image-edge//&apos;)&quot;
    ;;
esac

postfile=$(mktemp /tmp/postfile.XXXXX.conf)
echo PREFERRED_VERSION_linux-rzn1 = \&quot;${KERNEL_VERSION}.%\&quot; &gt; ${postfile}
echo PREFERRED_VERSION_linux-socfpga = \&quot;${KERNEL_VERSION}.%\&quot; &gt;&gt; ${postfile}
cat ${postfile}
bbopt=&quot;-R ${postfile}&quot;

#if [ &quot;${clean_packages}&quot; != &quot;&quot; ]; then
#    bitbake ${bbopt} -c cleansstate ${clean_packages}
#    bitbake ${bbopt} ${clean_packages}
#fi
#time bitbake ${bbopt} ${IMAGES}
#time bitbake ${bbopt} dip-sdk

# Generate &quot;pn-buildlist&quot; which names all targets
time bitbake ${bbopt} -g ${IMAGES}

# Update NVD data for each of those targets
time bitbake ${bbopt}  -c cve_check `cat pn-buildlist`

# combine all the cve.log into one single file... sorted alphabetically by package
find -name cve.log | sort | xargs cat &gt; cve-${MACHINE}.new

# Fetch previous CVE report
LATEST_DEST=$(echo $PUB_DEST | sed -e &quot;s#/$BUILD_NUMBER/#/latest/#&quot;)
wget -nv -O cve-${MACHINE}.old ${BASE_URL}/${LATEST_DEST}/dip-image-${MACHINE}.rootfs.cve

# Do diffs between old and current CVE report.
wget -nv -O diff-cve https://git.linaro.org/ci/job/configs.git/plain/schneider-openembedded/diff-cve
gawk -f diff-cve cve-${MACHINE}.old cve-${MACHINE}.new | tee ${WORKSPACE}/cve-${MACHINE}.txt

# Same thing, but against arbitrary (but fixed) baseline
case &quot;${MACHINE}&quot; in
    *rzn1*)
	wget -nv -O cve-${MACHINE}.base https://releases.linaro.org/members/schneider/openembedded/2019.09-warrior.2/rzn1d-4.19/dip-image-rzn1-snarc-linaro-rel-2019.09-warrior.2-internal-70.rootfs.cve
	;;
    *soca9*)
	wget -nv -O cve-${MACHINE}.base https://releases.linaro.org/members/schneider/openembedded/2019.09-warrior.2/soca9-4.19/dip-image-snarc-soca9-linaro-rel-2019.09-warrior.2-internal-70.rootfs.cve
	;;
esac
gawk -f diff-cve cve-${MACHINE}.base cve-${MACHINE}.new &gt; ${WORKSPACE}/base-cve-${MACHINE}.txt

exit 0

##################
### SKIP THE REST!
##################

DEPLOY_DIR_IMAGE=$(bitbake -e | grep &quot;^DEPLOY_DIR_IMAGE=&quot;| cut -d&apos;=&apos; -f2 | tr -d &apos;&quot;&apos;)
DEPLOY_DIR_SDK=$(bitbake -e | grep &quot;^DEPLOY_DIR=&quot;| cut -d&apos;=&apos; -f2 | tr -d &apos;&quot;&apos;)/sdk
cp -aR ${DEPLOY_DIR_SDK} ${DEPLOY_DIR_IMAGE}

ls -al ${DEPLOY_DIR_IMAGE}/*

# Prepare files to publish
rm -f ${DEPLOY_DIR_IMAGE}/*.txt
find ${DEPLOY_DIR_IMAGE} -type l -delete
#DEL mv /srv/oe/{source,pinned}-manifest.xml ${DEPLOY_DIR_IMAGE}
#DEL cat ${DEPLOY_DIR_IMAGE}/pinned-manifest.xml

# Generate CVE listing with a fixed filename, so it can be retrieved
# from snapshots.linaro.org by subsequent builds using a known URL.
cp ${DEPLOY_DIR_IMAGE}/dip-image-${MACHINE}-*.rootfs.cve ${DEPLOY_DIR_IMAGE}/dip-image-${MACHINE}.rootfs.cve

# FIXME: IMAGE_FSTYPES_remove doesn&apos;t work
rm -f ${DEPLOY_DIR_IMAGE}/*.rootfs.ext4 \
      ${DEPLOY_DIR_IMAGE}/*.rootfs.iso \
      ${DEPLOY_DIR_IMAGE}/*.iso \
      ${DEPLOY_DIR_IMAGE}/*.jffs* \
      ${DEPLOY_DIR_IMAGE}/*.cpio.gz \
      ${DEPLOY_DIR_IMAGE}/*.squashfs-lzo \
      ${DEPLOY_DIR_IMAGE}/*.stimg

# FIXME: Sparse images here, until it gets done by OE
case &quot;${MACHINE}&quot; in
  *rzn1*)
    pushd ${DEPLOY_DIR_IMAGE}
    rm -f uImage*
    popd
    ;;
  *soca9*)
    # re-create the SoCA9 DTB with a shorter filename
    pushd ${DEPLOY_DIR_IMAGE}
    mv zImage-*soca9*_bestla_512m*.dtb zImage-soca9_qspi_micronN25Q_bestla_512m.dtb || true
    mv zImage-*soca9*.dtb zImage-soca9_qspi_micronN25Q_bestla_512m.dtb || true
    rm -f *[12]G*.dtb || true
    rm -f *freja*.dtb || true
    rm -f *socfpga_cyclone5_socdk*.dtb || true
    popd
    ;;
  juno|stih410-b2260|orangepi-i96)
    ;;
  *)
    for rootfs in $(find ${DEPLOY_DIR_IMAGE} -type f -name *.rootfs.ext4.gz); do
      gunzip -k ${rootfs}
      sudo ext2simg -v ${rootfs%.gz} ${rootfs%.ext4.gz}.img
      rm -f ${rootfs%.gz}
      gzip -9 ${rootfs%.ext4.gz}.img
    done
    ;;
esac

ls -al ${DEPLOY_DIR_IMAGE}/*

# Create MD5SUMS file
find ${DEPLOY_DIR_IMAGE} -type f | xargs md5sum &gt; MD5SUMS.txt
sed -i &quot;s|${DEPLOY_DIR_IMAGE}/||&quot; MD5SUMS.txt
mv MD5SUMS.txt ${DEPLOY_DIR_IMAGE}

# Build information
cat &gt; ${DEPLOY_DIR_IMAGE}/HEADER.textile &lt;&lt; EOF

h4. Reference Platform Build - CE OpenEmbedded

Build description:
* Build URL: &quot;$BUILD_URL&quot;:$BUILD_URL
* Manifest URL: &quot;${MANIFEST_URL}&quot;:${MANIFEST_URL}
* Manifest branch: ${MANIFEST_BRANCH_PREFIX}${MANIFEST_BRANCH}
* Manifest commit: &quot;${MANIFEST_COMMIT}&quot;:${MANIFEST_URL/.git/\/commit}/${MANIFEST_COMMIT}
EOF

if [ -e &quot;/srv/oe/manifest-changes.txt&quot; ]; then
  # the space after pre.. tag is on purpose
  cat &gt; ${DEPLOY_DIR_IMAGE}/README.textile &lt;&lt; EOF

h4. Manifest changes

pre.. 
EOF
  cat /srv/oe/manifest-changes.txt &gt;&gt; ${DEPLOY_DIR_IMAGE}/README.textile
  mv /srv/oe/manifest-changes.txt ${DEPLOY_DIR_IMAGE}
fi

# Need different files for each machine
ROOTFS_EXT4_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rpb-console-image-test-*rzn1*-*-${BUILD_NUMBER}.rootfs.ext4.gz&quot; | xargs -r basename)
ROOTFS_TARXZ_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rpb-console-image-test-*rzn1*-*-${BUILD_NUMBER}.rootfs.tar.xz&quot; | xargs -r basename)
ROOTFS_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rpb-console-image-test-*rzn1*-*-${BUILD_NUMBER}.rootfs.img.gz&quot; | xargs -r basename)
ROOTFS_DESKTOP_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rpb-desktop-image-test-*rzn1*-*-${BUILD_NUMBER}.rootfs.img.gz&quot; | xargs -r basename)
KERNEL_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;zImage-*-*rzn1*-*-${BUILD_NUMBER}.bin&quot; | xargs -r basename)
case &quot;${MACHINE}&quot; in
  am57xx-evm)
    # LAVA image is too big for am57xx-evm
    ROOTFS_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rpb-console-image-${MACHINE}-*-${BUILD_NUMBER}.rootfs.img.gz&quot; | xargs -r basename)
    # FIXME: several dtb files case
    ;;
  intel-core2-32|intel-corei7-64)
    # No LAVA testing on intel-core* machines
    ROOTFS_TARXZ_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rpb-console-image-${MACHINE}-*-${BUILD_NUMBER}.rootfs.tar.xz&quot; | xargs -r basename)
    ;;
  juno)
    # FIXME: several dtb files case
    ;;
  *rzn1*)
    ROOTFS_TAR_BZ2=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-rzn1*-*-${BUILD_NUMBER}.rootfs.tar.bz2&quot; | xargs -r basename)
    ROOTFS_DEV_TAR_BZ2=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-rzn1*-*-${BUILD_NUMBER}.rootfs.tar.bz2&quot; | xargs -r basename)
    ROOTFS_EDGE_TAR_BZ2=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-edge-rzn1*-*-${BUILD_NUMBER}.rootfs.tar.bz2&quot; | xargs -r basename)
    WIC_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-rzn1*-${BUILD_NUMBER}.rootfs.wic.bz2&quot; | xargs -r basename)
    WIC_BMAP=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-rzn1*-${BUILD_NUMBER}.rootfs.wic.bmap&quot; | xargs -r basename)
    WIC_DEV_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-rzn1*-${BUILD_NUMBER}.rootfs.wic.bz2&quot; | xargs -r basename)
    WIC_DEV_BMAP=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-rzn1*-${BUILD_NUMBER}.rootfs.wic.bmap&quot; | xargs -r basename)
    WIC_EDGE_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-edge-rzn1*-${BUILD_NUMBER}.rootfs.wic.bz2&quot; | xargs -r basename)
    WIC_EDGE_BMAP=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-edge-rzn1*-${BUILD_NUMBER}.rootfs.wic.bmap&quot; | xargs -r basename)
    UBI_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-rzn1-snarc-*-${BUILD_NUMBER}.rootfs.ubi&quot; | xargs -r basename)
    UBI_DEV_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-rzn1-snarc-*-${BUILD_NUMBER}.rootfs.ubi&quot; | xargs -r basename)
    UBI_EDGE_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-edge-rzn1-snarc-*-${BUILD_NUMBER}.rootfs.ubi&quot; | xargs -r basename)
    DTB_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;*rzn1*bestla*.dtb&quot; | xargs -r basename)
    KERNEL_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;zImage--*rzn1*.bin&quot; | xargs -r basename)
    KERNEL_FIT_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;fitImage*.itb&quot; | xargs -r basename)
    UBOOT_FIT_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;ubootfitImage*.itb&quot; | xargs -r basename)
    OPTEE_FIT_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;optee-os*.itb&quot; | xargs -r basename)
    FSBL_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;rzn1d-snarc-fsbl-fip*.spkg&quot; | xargs -r basename)
    ;;
  *soca9*)
    ROOTFS_TAR_BZ2=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-snarc-soca9-*-${BUILD_NUMBER}.rootfs.tar.bz2&quot; | xargs -r basename)
    ROOTFS_DEV_TAR_BZ2=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-snarc-soca9*-${BUILD_NUMBER}.rootfs.tar.bz2&quot; | xargs -r basename)
    WIC_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-snarc-soca9-*-${BUILD_NUMBER}.rootfs.wic.bz2&quot; | xargs -r basename)
    WIC_BMAP=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-snarc-soca9-*-${BUILD_NUMBER}.rootfs.wic.bmap&quot; | xargs -r basename)
    WIC_DEV_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-snarc-soca9-*-${BUILD_NUMBER}.rootfs.wic.bz2&quot; | xargs -r basename)
    WIC_DEV_BMAP=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;dip-image-dev-snarc-soca9-*-${BUILD_NUMBER}.rootfs.wic.bmap&quot; | xargs -r basename)
    DTB_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;*soca9*_qspi_micronN25Q_bestla_512m.dtb&quot; | xargs -r basename)
    KERNEL_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;zImage--*soca9*.bin&quot; | xargs -r basename)
    ;;
  *)
    DTB_IMG=$(find ${DEPLOY_DIR_IMAGE} -type f -name &quot;*-${MACHINE}-*-${BUILD_NUMBER}.dtb&quot; | xargs -r basename)
    ;;
esac

# Set MACHINE back to the origin value
MACHINE=${machine_orig}

# Note: the main job script allows to override the default value for
#       BASE_URL and PUB_DEST, typically used for OE RPB builds
cat &lt;&lt; EOF &gt; ${WORKSPACE}/post_build_lava_parameters
DEPLOY_DIR_IMAGE=${DEPLOY_DIR_IMAGE}
MANIFEST_COMMIT=${BUILD_NUMBER}
ROOTFS_BUILD_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_EXT4_IMG}
ROOTFS_SPARSE_BUILD_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_IMG}
ROOTFS_DESKTOP_SPARSE_BUILD_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_DESKTOP_IMG}
SYSTEM_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_EXT4_IMG}
OPTEE_ITB_URL=${BASE_URL}${PUB_DEST}/optee/${OPTEE_FIT_IMG}
FSBL_URL=${BASE_URL}${PUB_DEST}/${FSBL_IMG}
UBOOT_ITB_URL=${BASE_URL}${PUB_DEST}/${UBOOT_FIT_IMG}
KERNEL_FIT_URL=${BASE_URL}${PUB_DEST}/${KERNEL_FIT_IMG}
KERNEL_ZIMAGE_URL=${BASE_URL}${PUB_DEST}/${KERNEL_IMG}
WIC_IMAGE_URL=${BASE_URL}${PUB_DEST}/${WIC_IMG}
WIC_BMAP_URL=${BASE_URL}${PUB_DEST}/${WIC_BMAP}
WIC_DEV_IMAGE_URL=${BASE_URL}${PUB_DEST}/${WIC_DEV_IMG}
WIC_DEV_BMAP_URL=${BASE_URL}${PUB_DEST}/${WIC_DEV_BMAP}
WIC_EDGE_IMAGE_URL=${BASE_URL}${PUB_DEST}/${WIC_EDGE_IMG}
WIC_EDGE_BMAP_URL=${BASE_URL}${PUB_DEST}/${WIC_EDGE_BMAP}
UBI_IMAGE_URL=${BASE_URL}${PUB_DEST}/${UBI_IMG}
UBI_DEV_IMAGE_URL=${BASE_URL}${PUB_DEST}/${UBI_DEV_IMG}
UBI_EDGE_IMAGE_URL=${BASE_URL}${PUB_DEST}/${UBI_EDGE_IMG}
DTB_URL=${BASE_URL}${PUB_DEST}/${DTB_IMG}
NFSROOTFS_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_TAR_BZ2}
NFSROOTFS_DEV_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_DEV_TAR_BZ2}
NFSROOTFS_EDGE_URL=${BASE_URL}${PUB_DEST}/${ROOTFS_EDGE_TAR_BZ2}
RECOVERY_IMAGE_URL=${BASE_URL}${PUB_DEST}/juno-oe-uboot.zip
LXC_ROOTFS_IMG=$(basename ${ROOTFS_IMG} .gz)
DEVICE_TYPE=${MACHINE}
EOF
</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers>
    <hudson.tasks.ArtifactArchiver>
      <artifacts>cve-*.txt, base-cve-*.txt</artifacts>
      <allowEmptyArchive>false</allowEmptyArchive>
      <onlyIfSuccessful>false</onlyIfSuccessful>
      <fingerprint>false</fingerprint>
      <defaultExcludes>true</defaultExcludes>
      <caseSensitive>true</caseSensitive>
      <followSymlinks>true</followSymlinks>
    </hudson.tasks.ArtifactArchiver>
    <org.jenkinsci.plugins.postbuildscript.PostBuildScript plugin="postbuildscript@2.9.1">
      <config>
        <scriptFiles/>
        <groovyScripts/>
        <buildSteps>
          <org.jenkinsci.plugins.postbuildscript.model.PostBuildStep>
            <results>
              <string>SUCCESS</string>
              <string>NOT_BUILT</string>
              <string>ABORTED</string>
              <string>FAILURE</string>
              <string>UNSTABLE</string>
            </results>
            <role>MASTER</role>
            <executeOn>BOTH</executeOn>
            <buildSteps>
              <hudson.tasks.Shell>
                <command>#!/bin/sh
#
# Combine CVE reports for rzn1 and soca9
#

set -e

#
# Did the build succeed? Check for logfiles:
#   axis-MACHINE: rzn1d, soca9
#   files: cve-rzn1-snarc.txt, cve-snarc-soca9.txt
#
if ! test \
-e $JENKINS_HOME/jobs/$JOB_NAME/configurations/axis-DISTRO/dip/axis-MACHINE/rzn1d/axis-label/docker-stretch-amd64/builds/$BUILD_NUMBER/archive/cve-rzn1-snarc.txt -a \
-e $JENKINS_HOME/jobs/$JOB_NAME/configurations/axis-DISTRO/dip/axis-MACHINE/soca9/axis-label/docker-stretch-amd64/builds/$BUILD_NUMBER/archive/cve-snarc-soca9.txt
then
	echo &apos;&lt;h1&gt;Build failed, no CVE check done&lt;/h1&gt;&apos; &gt; cve.html
	echo &apos;Build failed, no CVE check done&apos; &gt; cve.sum
	exit
fi

#
# Combine the reports using sort/uniq.
# Note the wildcard for MACHINE (rzn1/soca9).
#
ARCHIVE=&quot;$JENKINS_HOME/jobs/$JOB_NAME/configurations/axis-DISTRO/dip/axis-MACHINE/*/axis-label/docker-stretch-amd64/builds/$BUILD_NUMBER/archive&quot;
sort -uV $ARCHIVE/cve-*.txt      &gt; cve.txt
sort -uV $ARCHIVE/base-cve-*.txt &gt; base-cve.txt

#
# Detailed report in HTML format. Will be attached to email.
# Perl helper converts tab-delimited text to nested &lt;ul&gt; elements.
#
htmlify() {
	perl -F&apos;\t&apos; -lane &apos;
		my ($type, $cve, $pkg, $url, @rest) = @F;
		sub list {
			return @_ ? join(&quot;&quot;, &quot;&lt;ul&gt;\n&quot;, map(&quot;&lt;li&gt;$_&lt;/li&gt;\n&quot;, @_), &quot;&lt;/ul&gt;&quot;) : &quot;&quot;
		};
		push @{$line{$type}}, (&quot;&lt;a href=\&quot;$url\&quot;&gt;$cve&lt;/a&gt; $pkg&quot; . list(@rest));
		END { foreach (reverse sort keys %line) {
			print &quot;&lt;b&gt;$_ CVEs&lt;/b&gt;&quot;, list(@{$line{$_}}) if @{$line{$_}}
		}}&apos; $1
}
(
	echo &quot;&lt;h1&gt;CVE changes&lt;/h1&gt;&quot;
	echo &quot;&lt;p&gt;Submodule update strategy: &lt;code&gt;$SUBMODULES&lt;/code&gt;.&lt;/p&gt;&quot;
	echo &quot;&lt;h2&gt;Since last build&lt;/h2&gt;&quot;
	htmlify cve.txt
	echo &quot;&lt;h2&gt;Since baseline&lt;/h2&gt;&quot;
	htmlify base-cve.txt
) &gt; cve.html

#
# Summary report in plain text, gets embedded in the email.
# This just prints a count of each type of CVE.
#
summary() { #
	local NEW=`grep -c ^NEW $1`
	local CHANGED=`grep -c ^CHANGED $1`
	local FIXED=`grep -c ^FIXED $1`
	printf &quot;%2d NEW, %2d CHANGED, %2d FIXED\n&quot; $NEW $CHANGED $FIXED
}
(
	echo -n &quot;  - since last build: &quot;
	summary cve.txt
	echo -n &quot;  - since baseline:   &quot;
	summary base-cve.txt
	echo &quot;  - submodule update strategy was $SUBMODULES&quot;
	echo &quot;  - see attached report for details&quot;
) &gt; cve.sum

# Clean up
rm -f cve.txt base-cve.txt
</command>
              </hudson.tasks.Shell>
            </buildSteps>
          </org.jenkinsci.plugins.postbuildscript.model.PostBuildStep>
        </buildSteps>
        <markBuildUnstable>false</markBuildUnstable>
      </config>
    </org.jenkinsci.plugins.postbuildscript.PostBuildScript>
    <org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder plugin="groovy-postbuild@2.5">
      <script plugin="script-security@1.74">
        <script>if (manager.build.result == hudson.model.Result.SUCCESS) {
  def publish_server = manager.envVars[&quot;PUBLISH_SERVER&quot;]
  def pub_dest = manager.envVars[&quot;PUB_DEST&quot;]

  def desc = &quot;&amp;nbsp;&lt;a href=&apos;${publish_server}${pub_dest}&apos;&gt;Build location&lt;/a&gt;&lt;br /&gt;&quot;

  manager.build.setDescription(desc)
}

if (manager.build.result == hudson.model.Result.SUCCESS) {
  def qa_server = manager.envVars[&quot;QA_SERVER&quot;]
  def desc = manager.build.getDescription()
  if (desc == null) {
    desc = &quot;&quot;
  }
  pattern = ~&quot;(${qa_server}/testjob/(\\d+))(.*)&quot;
  manager.build.logFile.eachLine { line -&gt;
    matcher = pattern.matcher(line)
    if(matcher.matches()) {
      def url = matcher.group(1)
      def testjob_id = matcher.group(2)
      def job_name = matcher.group(3)
      desc += &quot;&amp;nbsp;&lt;a href=&apos;${url}&apos;&gt;LAVA job (QA ${testjob_id})${job_name}&lt;/a&gt;&lt;br/&gt;&quot;
    }
  }
  manager.build.setDescription(desc)
}

if (manager.build.result == hudson.model.Result.SUCCESS) {
  pattern = ~/^(\S+)\t(CVE-\S+)\t([^\t]+)\t([^\t]+)/
  def cve = [
	NEW:     [],
	CHANGED: [],
	FIXED:   [],
  ]
  manager.build.logFile.eachLine { line -&gt;
    matcher = pattern.matcher(line)
    if(matcher.matches()) {
      def type = matcher.group(1)
      def num = matcher.group(2)
      def pkg = matcher.group(3)
      def url = matcher.group(4)
      cve[type].add(&quot;&lt;a href=\&quot;${url}\&quot;&gt;${num}&lt;/a&gt; ${pkg}&quot;)
    }
  }
  def summary = manager.createSummary(&quot;warning.gif&quot;)
  cve.each {
    if(it.value.size() &gt; 0) {
      summary.appendText(&quot;$it.key CVEs:&lt;ul&gt;&quot;, false)
      it.value.each {
          summary.appendText(&quot;&lt;li&gt;$it&lt;/li&gt;&quot;, false)
      }
      summary.appendText(&quot;&lt;/ul&gt;&quot;, false)
    }
  }
}
</script>
        <sandbox>false</sandbox>
      </script>
      <behavior>0</behavior>
      <runForMatrixParent>false</runForMatrixParent>
    </org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder>
    <hudson.plugins.emailext.ExtendedEmailPublisher plugin="email-ext@2.69">
      <recipientList>ralph.siemsen@linaro.org</recipientList>
      <configuredTriggers>
        <hudson.plugins.emailext.plugins.trigger.AlwaysTrigger>
          <email>
            <recipientList></recipientList>
            <subject>$PROJECT_DEFAULT_SUBJECT</subject>
            <body>$PROJECT_DEFAULT_CONTENT</body>
            <recipientProviders>
              <hudson.plugins.emailext.plugins.recipients.ListRecipientProvider/>
            </recipientProviders>
            <attachBuildLog>false</attachBuildLog>
            <compressBuildLog>false</compressBuildLog>
          </email>
        </hudson.plugins.emailext.plugins.trigger.AlwaysTrigger>
      </configuredTriggers>
      <contentType>default</contentType>
      <defaultSubject>$DEFAULT_SUBJECT</defaultSubject>
      <defaultContent>$DEFAULT_CONTENT

CVE summary:
${FILE,path=&quot;cve.sum&quot;}
</defaultContent>
      <attachmentsPattern>cve.html</attachmentsPattern>
      <presendScript></presendScript>
      <postsendScript></postsendScript>
      <attachBuildLog>false</attachBuildLog>
      <compressBuildLog>false</compressBuildLog>
      <replyTo>$DEFAULT_REPLYTO</replyTo>
      <saveOutput>false</saveOutput>
      <disabled>false</disabled>
      <matrixTriggerMode>ONLY_PARENT</matrixTriggerMode>
    </hudson.plugins.emailext.ExtendedEmailPublisher>
  </publishers>
  <buildWrappers>
    <hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper@1.11.3"/>
    <com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper plugin="ssh-agent@1.20">
      <credentialIds>
        <string>768c1ba1-6052-4b97-a531-7e4fabda6979</string>
      </credentialIds>
      <ignoreMissing>false</ignoreMissing>
    </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
    <org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper plugin="credentials-binding@1.23">
      <bindings>
        <org.jenkinsci.plugins.credentialsbinding.impl.StringBinding>
          <credentialsId>QA_REPORTS_TOKEN</credentialsId>
          <variable>QA_REPORTS_TOKEN</variable>
        </org.jenkinsci.plugins.credentialsbinding.impl.StringBinding>
      </bindings>
    </org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
  </buildWrappers>
  <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
    <runSequentially>false</runSequentially>
  </executionStrategy>
</matrix-project>