]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-dev-new-build: Set up sccache if requested
authorZack Cerza <zack@redhat.com>
Mon, 28 Oct 2024 22:47:49 +0000 (16:47 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 31 Oct 2024 16:57:47 +0000 (10:57 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
ceph-dev-new-build/build/build_rpm
ceph-dev-new-build/build/setup_rpm
ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml
scripts/setup_sccache.sh [new file with mode: 0644]

index c2a6ac5c5629758eb5b8e7ee9625c087cfc1f8a1..22987d4f626e7767bf8f41df33a2f6047ef59840 100644 (file)
@@ -48,6 +48,7 @@ PACKAGE_MANAGER_VERSION="$RPM_VERSION-$RPM_RELEASE"
 
 BUILDAREA=$(setup_rpm_build_area ./rpm/$dist)
 build_rpms ${BUILDAREA} "${CEPH_EXTRA_RPMBUILD_ARGS}"
+[ "$SCCACHE" = true ] && sccache -s
 build_ceph_release_rpm ${BUILDAREA} true
 
 # Make sure we execute at the top level directory
index 0c130940dbd999c32abdf5c8be3525b956aeb551..8a6908b60aabaeb8afdf80209dfaa96cd075fdcb 100644 (file)
@@ -76,3 +76,9 @@ if [ "$THROWAWAY" = false ] ; then
     # TODO if this exits we need to post to shaman a success
     check_binary_existence $VENV $chacra_check_url
 fi
+
+if [ "$SCCACHE" = true ] ; then
+    write_sccache_conf
+    write_aws_credentials
+    install_sccache
+fi
index 90ee5a8aadf84324128cf9071edcca1adf4b18a2..92c1d5608cba63cbf0b028282a608e7c9ace1a2b 100644 (file)
@@ -90,6 +90,7 @@
           !include-raw:
             - ../../build/validate_rpm
             - ../../../scripts/build_utils.sh
+            - ../../../scripts/setup_sccache.sh
             - ../../build/setup_rpm
             - ../../build/build_rpm
       # osc build scripts
diff --git a/scripts/setup_sccache.sh b/scripts/setup_sccache.sh
new file mode 100644 (file)
index 0000000..2b9b8cc
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+# vim: ts=4 sw=4 expandtab
+
+set -ex
+
+function write_sccache_conf() {
+  export SCCACHE_CONF=$WORKSPACE/sccache.conf
+  cat << EOF > $SCCACHE_CONF
+[cache.s3]
+bucket = "ceph-sccache"
+endpoint = "s3.us-south.cloud-object-storage.appdomain.cloud"
+use_ssl = true
+key_prefix = ""
+server_side_encryption = false
+no_credentials = false
+region = "auto"
+EOF
+}
+
+function write_aws_credentials() {
+  export AWS_PROFILE=default
+  mkdir -p $HOME/.aws
+  cat << EOF > $HOME/.aws/credentials
+[default]
+aws_access_key_id = ${AWS_ACCESS_KEY_ID}
+aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}
+EOF
+}
+
+function install_sccache () {
+  SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v0.8.2/sccache-v0.8.2-$(uname -m)-unknown-linux-musl.tar.gz"
+  curl -L $SCCACHE_URL | sudo tar --no-anchored --strip-components=1 -C /usr/local/bin/ -xzf - sccache
+}