@@ -685,7 +685,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
685
685
platform: { arch: arch },
686
686
// [if arch == 'arm64' then 'node']: { arch: 'arm64' },
687
687
clone: { depth: 10 },
688
- steps: [
688
+ steps: std.filter ( function (step) step != null , [
689
689
{
690
690
name: 'submodules' ,
691
691
image: 'alpine/git' ,
@@ -718,8 +718,36 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
718
718
],
719
719
},
720
720
{
721
- name: 'build ' ,
721
+ name: 'get-local-sccache ' ,
722
722
depends_on: ['clone-mdb' ],
723
+ image: 'amazon/aws-cli' ,
724
+ volumes: [pipeline._volumes.mdb],
725
+ environment: {
726
+ AWS_ACCESS_KEY_ID: {
727
+ from_secret: 'aws_access_key_id' ,
728
+ },
729
+ AWS_SECRET_ACCESS_KEY: {
730
+ from_secret: 'aws_secret_access_key' ,
731
+ },
732
+ },
733
+ commands: [
734
+ 'yum install -y tar zstd' ,
735
+ 'mkdir -p /mdb/sccache' ,
736
+ 'echo "Attempting to download SCCache archive from S3..."' ,
737
+ 'if aws s3 cp s3://cspkg/nightly-sccache/stable-23.10-' + server + '-' + arch + '-' + std.strReplace (platform, ":" , "-" ) + '/sccache.tar.zst /tmp/sccache.tar.zst; then' ,
738
+ ' echo "SCCache archive found. Extracting..."' ,
739
+ ' tar -I zstd -xf /tmp/sccache.tar.zst -C /mdb/sccache' ,
740
+ ' ls /mdb/sccache/ && mv /mdb/sccache/mdb/sccache /mdb/sccache_inner && rm -rf /mdb/sccache/ && mv /mdb/sccache_inner /mdb/sccache' , # TODO remove
741
+ ' echo "SCCache successfully downloaded and extracted."' ,
742
+ ' ls /mdb/sccache' ,
743
+ 'else' ,
744
+ ' echo "SCCache archive not found on S3. Proceeding without it."' ,
745
+ 'fi' ,
746
+ ],
747
+ },
748
+ {
749
+ name: 'build' ,
750
+ depends_on: ['get-local-sccache' ],
723
751
image: img,
724
752
volumes: [pipeline._volumes.mdb],
725
753
environment: {
@@ -733,19 +761,15 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
733
761
AWS_SECRET_ACCESS_KEY: {
734
762
from_secret: 'aws_secret_access_key' ,
735
763
},
736
- SCCACHE_DIR: '/tmp /sccache' , // local cache for sccache
764
+ SCCACHE_DIR: '/mdb /sccache' , // local cache for sccache
737
765
SCCACHE_CACHE_SIZE: '20G' ,
738
- // SCCACHE_BUCKET: 'cs-sccache', // remote S3 cache in case we have a local miss
739
- // SCCACHE_REGION: 'us-east-1',
740
- // SCCACHE_S3_USE_SSL: 'true',
741
- // SCCACHE_S3_KEY_PREFIX: result + branch + server + arch + '${DRONE_PULL_REQUEST}',
742
- SCCACHE_ERROR_LOG: '/tmp/sccache_log.txt' ,
743
- SCCACHE_LOG: 'sccache_debug.txt' ,
766
+ // SCCACHE_ERROR_LOG: '/tmp/sccache_log.txt',
767
+ // SCCACHE_LOG: 'sccache_debug.txt',
744
768
},
745
769
commands: [
746
770
'export CLICOLOR_FORCE=1' ,
747
771
get_sccache,
748
- 'mkdir -p /tmp /sccache' ,
772
+ 'mkdir -p /mdb /sccache' ,
749
773
'mkdir /mdb/' + builddir + '/' + result,
750
774
751
775
'bash -c "set -o pipefail && bash /mdb/' + builddir + '/storage/columnstore/columnstore/build/bootstrap_mcs.sh ' +
@@ -757,12 +781,6 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
757
781
'/mdb/' + builddir + '/' + result + '/build.log"' ,
758
782
'sccache --show-adv-stats' ,
759
783
760
- // if this is a nightly build, archive local sccache dir and upload it to S3
761
- 'du -hs /tmp/sccache' ,
762
- 'time tar -I pzstd -cf sccache.tar.zst /tmp/sccache' ,
763
- 'time aws s3 cp sccache.tar.zst s3://cspkg/nightly-sccache/stable-23.10-' + server + '-' + arch + '-' + std.strReplace (platform, ':' , '-' ) + '/sccache.tar.zst' ,
764
- 'echo "Nightly build cache uploaded to: s3://cspkg/nightly-sccache/stable-23.10-' + server + '-' + arch + '-' + std.strReplace (platform, ':' , '-' ) + '/sccache.tar.zst"' ,
765
-
766
784
// move engine and cmapi packages to one dir and make a repo
767
785
if (pkg_format == 'rpm' ) then "mv -v -t ./" + result + "/ /mdb/" + builddir + "/*.rpm /drone/src/cmapi/" + result + "/*.rpm && createrepo ./" + result
768
786
else "mv -v -t ./" + result + "/ /mdb/*.deb /drone/src/cmapi/" + result + "/*.deb && dpkg-scanpackages " + result + " | gzip > ./" + result + "/Packages.gz" ,
@@ -771,6 +789,30 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
771
789
'ls -la /mdb/' + builddir + '/storage/columnstore/columnstore/storage-manager' ,
772
790
],
773
791
},
792
+ // (if (event == 'cron') then { // Publish cache only in the nightly builds)
793
+ (if (1 == 1 ) then {
794
+ name: 'publish-sccache' ,
795
+ depends_on: ['build' ],
796
+ image: 'amazon/aws-cli' ,
797
+ volumes: [pipeline._volumes.mdb],
798
+ environment: {
799
+ AWS_ACCESS_KEY_ID: {
800
+ from_secret: 'aws_access_key_id' ,
801
+ },
802
+ AWS_SECRET_ACCESS_KEY: {
803
+ from_secret: 'aws_secret_access_key' ,
804
+ },
805
+ },
806
+ commands: [
807
+ 'yum install -y tar zstd' ,
808
+ 'du -hs /mdb/sccache' ,
809
+ 'cd /mdb/sccache' ,
810
+ 'time tar -I pzstd -cf ../sccache.tar.zst .' ,
811
+ 'cd ..' ,
812
+ 'time aws s3 cp sccache.tar.zst s3://cspkg/nightly-sccache/stable-23.10-' + server + '-' + arch + '-' + std.strReplace (platform, ':' , '-' ) + '/sccache.tar.zst' ,
813
+ 'echo "Nightly build cache uploaded to: s3://cspkg/nightly-sccache/stable-23.10-' + server + '-' + arch + '-' + std.strReplace (platform, ':' , '-' ) + '/sccache.tar.zst"' ,
814
+ ],
815
+ } else null ),
774
816
{
775
817
name: 'unittests' ,
776
818
depends_on: ['build' ],
@@ -813,7 +855,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
813
855
'ls -l /drone/src/%s | grep columnstore' % result,
814
856
],
815
857
},
816
- ] +
858
+ ]) +
817
859
[pipeline.cmapipython] + [pipeline.cmapibuild] +
818
860
[pipeline.publish('cmapi build' )] +
819
861
[pipeline.publish()] +
0 commit comments