2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 - 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 ##############################################################################
12 YAML_FILE="${WORKSPACE}/jjb/autorelease/validate-autorelease-${STREAM}.yaml"
13 BRANCH="stable/${STREAM}"
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
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 # Allow word splitting as we only expect modules to appear
25 # shellcheck disable=2207
26 modules=($(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' /tmp/pom.xml))
28 cat > "$YAML_FILE" << EOF
30 # Autogenerated by autorelease autorelease-update-validate-autorelease-jobs-{stream} Jenkins job
32 name: autorelease-validate-${STREAM}
34 - "{project-name}-validate-autorelease-{stream}"
40 for module in "${modules[@]}"; do
41 echo "Include $module"
42 echo " - ${module//\//-}:" >> "$YAML_FILE"
43 echo " project: $module" >> "$YAML_FILE"
46 git add "${YAML_FILE}"