From cc7394f509bb4ea0cbea5a58052e4989f40d50ad Mon Sep 17 00:00:00 2001 From: Seth Carbon Date: Tue, 1 Oct 2024 22:12:17 -0700 Subject: [PATCH] re-add initialize() code; for #388 --- Jenkinsfile | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3c0d3c7..4253996 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -813,3 +813,63 @@ void watchdog() { sh '`exit -1`' } } + +// Reset and initialize skyhook base. +void initialize() { + + // Possibly protect against issues like #350 by making sure + // $BRANCH_NAME is there and vaguely sane. + if(BRANCH_NAME instanceof String && BRANCH_NAME.size() >= 3 ) { + + // Get a mount point ready + sh 'mkdir -p $WORKSPACE/mnt || true' + // Ninja in our file credentials from Jenkins. + withCredentials([file(credentialsId: 'skyhook-private-key', variable: 'SKYHOOK_IDENTITY')]) { + // Try and ssh fuse skyhook onto our local system. + sh 'sshfs -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o IdentityFile=$SKYHOOK_IDENTITY -o idmap=user skyhook@skyhook.berkeleybop.org:/home/skyhook $WORKSPACE/mnt/' + } + // Remove anything we might have left around from + // times past. + sh 'rm -r -f $WORKSPACE/mnt/$BRANCH_NAME || true' + // Rebuild directory structure. + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/bin || true' + // WARNING/BUG: needed for arachne to run at + // this point. + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/lib || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/ttl || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/json || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/blazegraph || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/upstream_and_raw_data || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/pages || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/solr || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/panther || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/products/gaferencer || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/metadata || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/annotations || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/ontology || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/reports || true' + sh 'mkdir -p $WORKSPACE/mnt/$BRANCH_NAME/release_stats || true' + // Tag the top to let the world know I was at least + // here. + sh 'echo "Runtime summary." > $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'date >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "Release notes: https://github.com/geneontology/go-site/tree/master/releases" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "Branch: $BRANCH_NAME" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "Start day: $START_DAY" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "Start date: $START_DATE" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "$START_DAY" > $WORKSPACE/mnt/$BRANCH_NAME/metadata/dow.txt' + sh 'echo "$START_DATE" > $WORKSPACE/mnt/$BRANCH_NAME/metadata/date.txt' + + sh 'echo "Official release date: metadata/release-date.json" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "Official Zenodo archive DOI: metadata/release-archive-doi.json" >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + sh 'echo "TODO: Note software versions." >> $WORKSPACE/mnt/$BRANCH_NAME/summary.txt' + // TODO: This should be wrapped in exception + // handling. In fact, this whole thing should be. + sh 'fusermount -u $WORKSPACE/mnt/ || true' + }else{ + sh 'echo "HOW DID THIS EVEN HAPPEN?"' + } +}