|  | 
|  | 1 | +#!/usr/bin/env bash | 
|  | 2 | +set -eu | 
|  | 3 | +set -o pipefail | 
|  | 4 | + | 
|  | 5 | +# Shellscript for managing releases in ansible-oracle | 
|  | 6 | +# | 
|  | 7 | +# used to update the collection version in files. | 
|  | 8 | + | 
|  | 9 | +galaxy="../../galaxy.yml" | 
|  | 10 | + | 
|  | 11 | +workdir=$(dirname "$0") | 
|  | 12 | +cd "$workdir" || exit 1 | 
|  | 13 | + | 
|  | 14 | +build_release=$(git branch --show-current | cut -d"/" -f2) | 
|  | 15 | + | 
|  | 16 | +function change_release_version() { | 
|  | 17 | +  echo "Using Release from branch: $build_release" | 
|  | 18 | +  echo "Format galaxy.yml" | 
|  | 19 | +  sed -i "/^version: /c\version: ${build_release}" "${galaxy}" | 
|  | 20 | +  grep "version: " "${galaxy}" | 
|  | 21 | + | 
|  | 22 | +  echo "Format requirements.yml" | 
|  | 23 | +  sed -i "/^    version: /c\    version: ${build_release}" requirements.yml | 
|  | 24 | +  grep "version: " requirements.yml | 
|  | 25 | + | 
|  | 26 | +  target_dirs="example/beginner_patching/ansible/requirements.yml | 
|  | 27 | +  example/rac/ansible/requirements.yml | 
|  | 28 | +  example/beginner/ansible/requirements.yml" | 
|  | 29 | + | 
|  | 30 | +  for requirement_file in ${target_dirs} ; do | 
|  | 31 | +    filename="../../${requirement_file}" | 
|  | 32 | + | 
|  | 33 | +    echo "target file: ${filename}" | 
|  | 34 | +    cp requirements.yml "${filename}" | 
|  | 35 | +  done | 
|  | 36 | + | 
|  | 37 | +} | 
|  | 38 | + | 
|  | 39 | +check_antsibull_changes() { | 
|  | 40 | + | 
|  | 41 | +  # check if all antsibull entries have a reference with (oravirt#[0-9][0-9][0-9]) | 
|  | 42 | +  echo "Checking antsibull changelog entries" | 
|  | 43 | + | 
|  | 44 | +  pwd | 
|  | 45 | + | 
|  | 46 | +  for clfile in "../../changelogs/fragments"/*yml ; do | 
|  | 47 | +    echo "Checking file: ${clfile}" | 
|  | 48 | + | 
|  | 49 | +    if grep "  - " "${clfile}" | grep -v "oravirt#[0-9][0-9][0-9]" ; then | 
|  | 50 | +      echo "Found changelog entries without PR reference" | 
|  | 51 | +      exit | 
|  | 52 | +    fi | 
|  | 53 | +  done | 
|  | 54 | + | 
|  | 55 | +} | 
|  | 56 | + | 
|  | 57 | +function make_changelog() { | 
|  | 58 | +  # cd "${workdir}/../.." | 
|  | 59 | +  pwd | 
|  | 60 | +  echo "Starting antsibull changelog" | 
|  | 61 | +  ../.././.venv/antsibull/bin/antsibull-changelog release | 
|  | 62 | +} | 
|  | 63 | + | 
|  | 64 | +check_antsibull_changes | 
|  | 65 | +change_release_version | 
|  | 66 | + | 
|  | 67 | +make_changelog | 
0 commit comments