Add template for build of xds-server in CI 43/13843/5
authorJan-Simon Möller <jsmoeller@linuxfoundation.org>
Fri, 27 Apr 2018 21:12:44 +0000 (23:12 +0200)
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>
Fri, 27 Apr 2018 22:18:10 +0000 (00:18 +0200)
Change-Id: I15fe3da53ef882657161111cfb179cf8307778a1
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
jjb/ci-xds-verify/ci-xds-jjb.yaml [new file with mode: 0644]
jjb/ci-xds-verify/ci-xds-local.sh [new file with mode: 0755]
jjb/common/include-xds-build-common.sh [new file with mode: 0644]
jjb/common/include-xds-header.sh [new file with mode: 0644]
jjb/common/include-xds-prepare-upload-folder-merged.sh [new file with mode: 0644]
jjb/common/include-xds-prepare-upload-folder.sh [new file with mode: 0644]
jjb/common/include-xds-rsync-download-changeid.sh [new file with mode: 0644]
jjb/common/include-xds-rsync-download-xds.sh [new file with mode: 0644]

diff --git a/jjb/ci-xds-verify/ci-xds-jjb.yaml b/jjb/ci-xds-verify/ci-xds-jjb.yaml
new file mode 100644 (file)
index 0000000..39a1946
--- /dev/null
@@ -0,0 +1,467 @@
+---
+- project:
+    name: ci-xds-AGL
+    aglbranch:
+      - master
+    project:
+      - xds-server
+    jobs:
+      - ci-xds-{project}-verify-{aglbranch}
+      - ci-xds-{project}-verify-{aglbranch}-CIB
+      - ci-xds-{project}-verify-{aglbranch}-CIB-finish-success
+      - ci-xds-{project}-remove-artifacts
+      - ci-xds-{project}-merge
+      - ci-xds-{project}-merge-finish-success
+
+
+################################################################################################################################################################
+################################################################################################################################################################
+
+################# VERIFY #################
+
+################################################################################
+# ci-xds-{project}-verify  =  trigger from gerrit and control job
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-verify-{aglbranch}'
+    project-type: multijob
+    concurrent: true
+    node: control-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: 'refs/heads/{aglbranch}'
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: "8313"
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: "2"
+          description: "patchset # to build"
+      - string:
+          name: AGLBRANCH
+          default: '{aglbranch}'
+          description: "AGL release branch to use"
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+    triggers:
+      - gerrit-trigger-patch-submitted-manual-verified:
+          name: 'src/xds/{project}'
+          branch: '{aglbranch}'
+          silent: 'true'
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+    builders:
+      - shell: |
+          set
+          export TRIGGERURL=$(echo ${{BUILD_URL}} | sed -e 's,-CIB-start.*,,')
+          echo \$TRIGGERURL
+          ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified=0 -n NONE --message="CI-cycle\ started.\ URL:\ ${{BUILD_URL}}" || true
+      - multijob:
+          name: CIB-{project}
+          condition: SUCCESSFUL
+          projects:
+            - name: 'ci-xds-{project}-verify-{aglbranch}-CIB'
+              current-parameters: true
+              #abort-all-job: true
+              kill-phase-on: FAILURE
+              predefined-parameters: AGLBRANCH={aglbranch}
+      - multijob:
+          name: CIB-finish-success
+          condition: SUCCESSFUL
+          projects:
+            - name: 'ci-xds-{project}-verify-{aglbranch}-CIB-finish-success'
+              current-parameters: true
+              abort-all-job: true
+              kill-phase-on: FAILURE
+
+
+
+#      - ci-xds-{project}-verify-{aglbranch}-CIB
+################################################################################
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-verify-{aglbranch}-CIB'
+    project-type: freestyle
+    concurrent: true
+    node: agl-test-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: refs/heads/{aglbranch}
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: ""
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: ""
+          description: "patchset # to build"
+      - string:
+          name: AGLBRANCH
+          default: '{aglbranch}'
+          description: "AGL release branch to use"
+      - string:
+          name: PROJECT_TO_BUILD
+          default: '{project}'
+          description: 'plain project name'
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+      - openstack:
+          single-use: true
+
+    builders:
+      - shell:
+          # including from ../common
+          !include-raw-escape:
+          - ../common/include-xds-header.sh
+          - ../common/include-xds-build-common.sh
+          - ../common/include-xds-prepare-upload-folder.sh
+          - ../common/include-xds-rsync-download-changeid.sh
+
+    publishers:
+      - naginator:
+          rerun-unstable-builds: true
+          progressive-delay-increment: 5
+          progressive-delay-maximum: 15
+          max-failed-builds: 2
+          #regular-expression: "Unexpected termination of the channel"
+
+
+#      - ci-xds-{project}-verify-{aglbranch}-CIB-finish-success
+################################################################################
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-verify-{aglbranch}-CIB-finish-success'
+    project-type: freestyle
+    concurrent: true
+    node: control-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: 'refs/heads/{aglbranch}'
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: "8313"
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: "2"
+          description: "patchset # to build"
+      - string:
+          name: AGLBRANCH
+          default: '{aglbranch}'
+          description: "AGL release branch to use"
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+    builders:
+      - shell: |
+          set
+          echo "#### CIB +1 #### Verified +1 ####"
+          ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified +1 --label ci-image-build=+1 -n NONE --message="CI-Image-Build\ finished,\ CIB+1,\ Verified+1.\ Artifacts\ available\ at\ https://download.automotivelinux.org/AGL/upload/ci/${{GERRIT_CHANGE_NUMBER}}/${{GERRIT_PATCHSET_NUMBER}}/\ ." || true
+
+
+#      - ci-xds-{project}-verify-{aglbranch}-failure
+################################################################################
+################################################################################
+
+#      - ci-xds-{project}-merge
+################################################################################
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-merge'
+    project-type: multijob
+    concurrent: true
+    node: control-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: 'refs/heads/{aglbranch}'
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: "8313"
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: "2"
+          description: "patchset # to build"
+      - string:
+          name: AGLBRANCH
+          default: '{aglbranch}'
+          description: "AGL release branch to use"
+      - string:
+          name: PROJECT_TO_BUILD
+          default: '{project}'
+          description: 'plain project name to build'
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+    triggers:
+      - gerrit-trigger-silent-patch-merged:
+          name: 'src/xds/{project}'
+          branch: '{aglbranch}'
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+    builders:
+      - multijob:
+          name: CI-merge-{project}
+          condition: SUCCESSFUL
+          projects:
+            - name: 'ci-xds-{project}-merge-{aglbranch}'
+              current-parameters: true
+              #abort-all-job: true
+              kill-phase-on: FAILURE
+              predefined-parameters: AGLBRANCH={aglbranch}
+      - multijob:
+          name: CIB-{project}-{aglbranch}-finish-success
+          condition: SUCCESSFUL
+          projects:
+            - name: 'ci-xds-{project}-merge-finish-success'
+              current-parameters: true
+              abort-all-job: true
+              kill-phase-on: FAILURE
+
+#      - ci-xds-{project}-merge-{aglbranch}
+################################################################################
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-merge-{aglbranch}'
+    project-type: freestyle
+    concurrent: true
+    node: agl-test-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: refs/heads/{aglbranch}
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: ""
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: ""
+          description: "patchset # to build"
+      - string:
+          name: TARGETARCH
+          default: '{architecture}'
+          description: "Machine to build"
+      - string:
+          name: AGLBRANCH
+          default: '{aglbranch}'
+          description: "AGL release branch to use"
+      - string:
+          name: PROJECT_TO_BUILD
+          default: '{project}'
+          description: 'plain project name'
+
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+      - openstack:
+          single-use: true
+
+    builders:
+      - shell:
+          # including from ../common
+          !include-raw-escape:
+          - ../common/include-xds-header.sh
+          - ../common/include-xds-build-common.sh
+          - ../common/include-xds-prepare-upload-folder-merged.sh
+          - ../common/include-xds-rsync-download-xds.sh
+
+
+    publishers:
+      - naginator:
+          rerun-unstable-builds: true
+          progressive-delay-increment: 5
+          progressive-delay-maximum: 15
+          max-failed-builds: 2
+          #regular-expression: "Unexpected termination of the channel"
+
+
+#      - ci-xds-{project}-merge-finish-success
+################################################################################
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-merge-finish-success'
+    project-type: freestyle
+    concurrent: true
+    node: control-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: 'refs/heads/{aglbranch}'
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: "8313"
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: "2"
+          description: "patchset # to build"
+      - string:
+          name: AGLBRANCH
+          default: '{aglbranch}'
+          description: "AGL release branch to use"
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+    builders:
+      - shell: |
+          ssh -p 29418 agl-jobbuilder@gerrit.automotivelinux.org gerrit review ${{GERRIT_CHANGE_NUMBER}},${{GERRIT_PATCHSET_NUMBER}} --verified +1 --label ci-image-build=+1 -n NONE --message="Merge\ finished,\ Artifacts\ available\ at\ https://download.automotivelinux.org/AGL/xds/{project}/\ ." || true
+
+
+#      - ci-xds-{project}-remove-artifacts
+################################################################################
+################################################################################
+- job-template:
+    name: 'ci-xds-{project}-remove-artifacts'
+    project-type: freestyle
+    concurrent: true
+    node: control-slave
+    parameters:
+      - string:
+          name: GERRIT_PROJECT
+          default: 'src/xds/{project}'
+          description: "Project to build"
+      - string:
+          name: GERRIT_BRANCH
+          default: '{aglbranch}'
+          description: "branch to build"
+      - string:
+          name: GERRIT_REFSPEC
+          default: refs/heads/{aglbranch}
+          description: "refspec to build"
+      - string:
+          name: GERRIT_CHANGE_NUMBER
+          default: "9551"
+          description: "change # to build"
+      - string:
+          name: GERRIT_PATCHSET_NUMBER
+          default: "2"
+          description: "patchset # to build"
+    build-discarder:
+      days-to-keep: 30
+      artifact-days-to-keep: -1
+      artifact-num-to-keep: 5
+    wrappers:
+      - agl-infra-wrappers:
+          build-timeout: '{build-timeout}'
+      - openstack:
+          single-use: false
+    triggers:
+      - gerrit-trigger-silent-patch-merged-abandoned:
+          name: 'src/xds/{project}'
+          branch: 'refs/heads/{aglbranch}'
+    builders:
+      - shell:
+          !include-raw-escape:
+          - ../common/include-agl-remove-artifacts-changeid.sh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jjb/ci-xds-verify/ci-xds-local.sh b/jjb/ci-xds-verify/ci-xds-local.sh
new file mode 100755 (executable)
index 0000000..e902d95
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+#set -x
+export AGLBRANCH=master
+export GERRIT_REFSPEC="refs/changes/51/9551/2"
+export GERRIT_PROJECT="src/xds/xds-server"
+export GERRIT_CHANGE_NUMBER="10799"
+export GERRIT_PATCHSET_NUMBER="1"
+export GERRIT_PATCHSET_REVISION="1a1ff962da92aff5a1d3e757710c725e03238458"
+export GERRIT_HOST="gerrit.automotivelinux.org"
+export GERRIT_PORT="29418"
+export PROJECT_TO_BUILD="xds-server"
+
+export -p > env.save
+
+# TBI
+
+source env.save
+
+#. ../common/include-xds-header.sh
+#. ../common/include-xds-build-common.sh
+
+done
\ No newline at end of file
diff --git a/jjb/common/include-xds-build-common.sh b/jjb/common/include-xds-build-common.sh
new file mode 100644 (file)
index 0000000..90033bc
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# (c) 2018 Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+# License: GPLv2
+
+
+ROOTDIR=`pwd`
+rm -rf $ROOTDIR/src || true
+mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/xds
+cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds 
+git clone https://gerrit.automotivelinux.org/gerrit/${GERRIT_PROJECT}
+cd ${PROJECT_TO_BUILD}
+export V=1
+make package-all
+
+cd $ROOTDIR
+tree
+
diff --git a/jjb/common/include-xds-header.sh b/jjb/common/include-xds-header.sh
new file mode 100644 (file)
index 0000000..126e79d
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# (c) 2018  Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
+# License: GPLv2
+
diff --git a/jjb/common/include-xds-prepare-upload-folder-merged.sh b/jjb/common/include-xds-prepare-upload-folder-merged.sh
new file mode 100644 (file)
index 0000000..c4b990d
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+#set -x
+set -e
+
+echo -e "\n\n\n"
+echo "#########################################"
+echo -e "\n\n\n"
+
+#failsafe
+if test x"" = x"${AGLBRANCH}" ; then
+  echo "AGLBRANCH not defined"
+  exit 1
+fi
+if test x"" = x"${MYPROJECT}"; then
+  echo "MYPROJECT not defined"
+  exit 1
+fi
+if test x"" = x"${BUILD_NUMBER}"; then
+  echo "BUILD_NUMBER not defined"
+  exit 1
+fi
+if test x"" = x"${GERRIT_CHANGE_NUMBER}"; then
+  echo "GERRIT_CHANGE_NUMBER not defined"
+  exit 1
+fi
+if test x"" = x"${TARGETARCH}"; then
+  echo "TARGETARCH is not defined"
+  exit 1
+fi
+
+# construct upload folder
+#mv UPLOAD UPLOAD2 || true
+rm -rf UPLOAD/* || true
+
+PROJECTDIR="${AGLBRANCH}/${MYPROJECT}/"
+PROJECTPATTERN="${PROJECTDIR}/changeset-${GERRIT_CHANGE_NUMBER}"
+
+mkdir -p UPLOAD/${PROJECTPATTERN}
+ln -sf changeset-${GERRIT_CHANGE_NUMBER} UPLOAD/${PROJECTDIR}/latest
+export DEST=$(pwd)/UPLOAD/${PROJECTPATTERN}/
+
+# copy the wgt to the upload folder
+pushd ${MYPROJECT}
+
+cp  src/gerrit.automotivelinux.org/gerrit/${GERRIT_PROJECT}/*.zip $DEST/
+
+popd
diff --git a/jjb/common/include-xds-prepare-upload-folder.sh b/jjb/common/include-xds-prepare-upload-folder.sh
new file mode 100644 (file)
index 0000000..e28e462
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#set -x
+set -e
+
+echo -e "\n\n\n"
+echo "#########################################"
+echo -e "\n\n\n"
+
+
+
+# construct upload folder
+#mv UPLOAD UPLOAD2 || true
+rm -rf UPLOAD/${AGLBRANCH} || true
+mkdir -p UPLOAD/${AGLBRANCH}/
+export DEST=$(pwd)/UPLOAD/${AGLBRANCH}/
+
+pushd ${MYPROJECT}
+pwd
+
+ls -alh
+
+ls
+
+ls package || true
+
+cp  src/gerrit.automotivelinux.org/gerrit/${GERRIT_PROJECT}/*.zip $DEST
+
+ls -alh $DEST
+
+popd
diff --git a/jjb/common/include-xds-rsync-download-changeid.sh b/jjb/common/include-xds-rsync-download-changeid.sh
new file mode 100644 (file)
index 0000000..c8e341a
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+#set -x
+set -e
+
+echo -e "\n\n\n"
+echo "#########################################"
+echo -e "\n\n\n"
+
+export RSYNCDST="/srv/download/AGL/upload/ci/${GERRIT_CHANGE_NUMBER}/${GERRIT_PATCHSET_NUMBER}/"
+export RSYNCSRC=$(pwd)/UPLOAD/*
+LANG=C tree $RSYNCSRC
+ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 mkdir -p ${RSYNCDST}
+rsync -avr --inplace -L -e "ssh -o StrictHostKeyChecking=no" $RSYNCSRC jenkins-slave@10.30.72.8:$RSYNCDST
diff --git a/jjb/common/include-xds-rsync-download-xds.sh b/jjb/common/include-xds-rsync-download-xds.sh
new file mode 100644 (file)
index 0000000..08c0070
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+#set -x
+set -e
+
+echo -e "\n\n\n"
+echo "#########################################"
+echo -e "\n\n\n"
+#                             project branch buildid-changesetnr(latest)
+export RSYNCDST="/srv/download/AGL/xds/"
+export RSYNCSRC=$(pwd)/UPLOAD/*
+LANG=C tree $RSYNCSRC
+
+#set
+#exit 0
+ssh -o StrictHostKeyChecking=no jenkins-slave@10.30.72.8 mkdir -p ${RSYNCDST}
+rsync -avr -l --inplace --copy-unsafe-links -e "ssh -o StrictHostKeyChecking=no" $RSYNCSRC jenkins-slave@10.30.72.8:$RSYNCDST