Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.97 KB | None | 0 0
  1.    1 #!/bin/bash -ex
  2.    2
  3.    3 BREW_BUILD_TARGET="rhevm-4.3-rhel-7-candidate"
  4.    4 KRB_PRINCIPAL="rhev-build/jenkins-ci.eng.lab.tlv.redhat.com@REDHAT.COM"
  5.    5
  6.    6 enable_kinit() {
  7.    7     export KRB5CCNAME="$(mktemp .krbcc.XXXXXX)"
  8.    8     chmod 600 "$KRB5CCNAME"
  9.    9     REAL_KEYTAB="$(mktemp .keytab.XXXXXX)"
  10.   10     chmod 600 "$REAL_KEYTAB"
  11.   11     # suppressing bash -x so we'll not expose kerberos key
  12.   12     (
  13.   13         set +x
  14.   14         /usr/bin/base64 -d <<<"$RH_KERBEROS_KEY" > "$REAL_KEYTAB"
  15.   15     )
  16.   16     : "Credential cache at: $KRB5CCNAME"
  17.   17     /usr/bin/kinit "$KRB_PRINCIPAL" -k -t "$REAL_KEYTAB"
  18.   18     rm -f "$REAL_KEYTAB"
  19.   19     : "Loaded kerberos credentials:"
  20.   20     klist
  21.   21     export KRB5CCNAME=$KRB5CCNAME
  22.   22 }
  23.   23
  24.   24 apply_downstream_patches() {
  25.   25     for patch in downstream-patches/*.patch; do
  26.   26         [ -f "$patch" ] || continue
  27.   27         echo "Applying patch $patch"
  28.   28         git apply -v $patch
  29.   29     done
  30.   30 }
  31.   31
  32.   32 compile_vdsm_and_create_rpm() {
  33.   33     echo "running autogen"
  34.   34     ./contrib/rhev_build.sh
  35.   35     echo "running make"
  36.   36     make dist
  37.   37 }
  38.   38
  39.   39 get_image_path () {
  40.   40     echo $(rpmbuild -ts vdsm-*.tar.gz | awk {'print $2'})
  41.   41 }
  42.   42
  43.   43 brew_build_vdsm() {
  44.   44     local img_src="${1:?}"
  45.   45
  46.   46     rhpkg scratch-build --srpm "$img_src" --target "$BREW_BUILD_TARGET" | \
  47.   47         tee build_output
  48.   48 }
  49.   49
  50.   50 archive_brew_artifacts() {
  51.   51     task_id=$(cat build_output | grep x86_64 | grep closed | awk '{print $1}')
  52.   52     rpm_list=$(brew taskinfo $task_id | grep .rpm | \
  53.   53         sed 's:/mnt/redhat:http\://download.eng.bos.redhat.com:')
  54.   54     echo $rpm_list | xargs -n 1 -P 8 wget -q -P exported-artifacts/
  55.   55 }
  56.   56
  57.   57 apply_downstream_patches
  58.   58 compile_vdsm_and_create_rpm
  59.   59 img_src=$(get_image_path)
  60.   60 enable_kinit
  61.   61 brew_build_vdsm $img_src
  62.   62 archive_brew_artifacts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement