github.com/stevenmatthewt/agent@v3.5.4+incompatible/.buildkite/steps/publish-rpm-package.sh (about) 1 #!/bin/bash 2 set -euo pipefail 3 4 artifacts_build=$(buildkite-agent meta-data get "agent-artifacts-build") 5 6 dry_run() { 7 if [[ "${DRY_RUN:-}" == "false" ]] ; then 8 "$@" 9 else 10 echo "[dry-run] $*" 11 fi 12 } 13 14 if [[ "$CODENAME" == "" ]]; then 15 echo "Error: Missing \$CODENAME (stable or unstable)" 16 exit 1 17 fi 18 19 YUM_PATH=/yum.buildkite.com 20 21 echo '--- Downloading built yum packages packages' 22 rm -rf rpm 23 mkdir -p rpm 24 buildkite-agent artifact download --build "$artifacts_build" "rpm/*.rpm" rpm/ 25 26 echo '--- Installing dependencies' 27 bundle 28 29 # Make sure we have a local copy of the yum repo 30 echo "--- Syncing s3://$RPM_S3_BUCKET to `hostname`" 31 mkdir -p $YUM_PATH 32 aws --region us-east-1 s3 sync --delete "s3://$RPM_S3_BUCKET" "$YUM_PATH" 33 34 # Add the rpms and update meta-data 35 for ARCH in "x86_64" "i386"; do 36 echo "--- Updating yum repository for ${CODENAME}/${ARCH}" 37 38 ARCH_PATH="${YUM_PATH}/buildkite-agent/${CODENAME}/${ARCH}" 39 mkdir -p "$ARCH_PATH" 40 find "rpm/" -type f -name "*${ARCH}*" | xargs cp -t "$ARCH_PATH" 41 # createrepo_c is much faster and more resilient than createrepo 42 createrepo_c --no-database --unique-md-filenames --retain-old-md-by-age=7d --update "$ARCH_PATH" || \ 43 createrepo_c --no-database --unique-md-filenames --retain-old-md-by-age=7d "$ARCH_PATH" 44 #createrepo --no-database --unique-md-filenames --update "$ARCH_PATH" || \ 45 # createrepo --no-database --unique-md-filenames "$ARCH_PATH" 46 done 47 48 # Sync back our changes to S3 49 echo "--- Syncing local $YUM_PATH changes back to s3://$RPM_S3_BUCKET" 50 dry_run aws --region us-east-1 s3 sync --delete "$YUM_PATH/" "s3://$RPM_S3_BUCKET" --no-guess-mime-type --exclude "lost+found" --exclude ".repodata"