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