Merge "Remove docs profile from autorelease build"
[releng/builder.git] / jjb / autorelease / update-autorelease-projects-views.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11
12 VIEWS_AR_YAML_FILE="${WORKSPACE}/jjb/autorelease/view-autorelease-${STREAM}.yaml"
13 BRANCH="stable/${STREAM}"
14
15 # The current development release will not have a stable branch defined so if
16 # branch does not exist assume master
17 url="https://git.opendaylight.org/gerrit/projects/releng%2Fautorelease/branches/"
18 resp=$(curl -s -w "\\n\\n%{http_code}" --globoff -H "Content-Type:application/json" "$url")
19 if [[ ! "$resp" =~ $BRANCH ]]; then
20     BRANCH="master"
21 fi
22
23 wget -nv -O /tmp/pom.xml "https://git.opendaylight.org/gerrit/gitweb?p=releng/autorelease.git;a=blob_plain;f=pom.xml;hb=$GERRIT_BRANCH"
24
25 # handle list of projects read from the pom.xml output as multiple lines.
26 mapfile -t modules < <(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' /tmp/pom.xml)
27
28 cat > "$VIEWS_AR_YAML_FILE" << EOF
29 ---
30 # Autogenerated view by autorelease autorelease-update-validate-jobs-{stream} Jenkins job
31 - releng_view: &releng_autorelease_view_common_${STREAM}
32     name: releng-view-autorelease-${STREAM}
33     view-type: list
34     filter-executors: false
35     filter-queue: false
36     columns:
37         - status
38         - weather
39         - job
40         - last-success
41         - last-failure
42         - last-duration
43         - build-button
44     recurse: false
45
46 - view:
47     name: Merge-${STREAM^}
48     description: 'List of ${STREAM^} Merge jobs for Autorelease'
49     job-name:
50 EOF
51
52 for module in "${modules[@]}"; do
53     echo "Include project:$module to autorelease view"
54     echo "      - '$module-maven-merge-${STREAM}'" >> "$VIEWS_AR_YAML_FILE"
55 done
56 echo "    <<: *releng_autorelease_view_common_${STREAM}" >> "$VIEWS_AR_YAML_FILE"
57
58 git add "${VIEWS_AR_YAML_FILE}"
59
60 cp "${VIEWS_AR_YAML_FILE}" $WORKSPACE/archives