2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
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 echo "---> update-autorelease-projects-views.sh"
13 VIEWS_AR_YAML_FILE="${WORKSPACE}/jjb/autorelease/view-autorelease-${STREAM}.yaml"
14 BRANCH="stable/${STREAM}"
16 # The current development release will not have a stable branch defined so if
17 # branch does not exist assume master
18 url="https://git.opendaylight.org/gerrit/projects/releng%2Fautorelease/branches/"
19 resp=$(curl -s -w "\\n\\n%{http_code}" --globoff -H "Content-Type:application/json" "$url")
20 if [[ ! "$resp" =~ $BRANCH ]]; then
24 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"
26 # handle list of projects read from the pom.xml output as multiple lines.
27 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)
29 cat > "$VIEWS_AR_YAML_FILE" << EOF
31 # Autogenerated view by autorelease autorelease-update-validate-jobs-{stream} Jenkins job
32 - releng_view: &releng_autorelease_view_common_${STREAM}
33 name: releng-view-autorelease-${STREAM}
35 filter-executors: false
51 name: Merge-${STREAM^}
52 description: 'List of ${STREAM^} Merge jobs for Autorelease'
56 for module in "${modules[@]}"; do
57 echo "Include project:$module to autorelease view"
58 echo " - '$module-maven-merge-${STREAM}'" >> "$VIEWS_AR_YAML_FILE"
60 echo " <<: *releng_autorelease_view_common_${STREAM}" >> "$VIEWS_AR_YAML_FILE"
62 git add "${VIEWS_AR_YAML_FILE}"
64 mkdir -p "${WORKSPACE}/archives"
65 cp "${VIEWS_AR_YAML_FILE}" "${WORKSPACE}/archives"