Skip to content

Commit

Permalink
first attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
stebo85 committed Jun 22, 2024
1 parent 2e8dedb commit 5a7109e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 30 deletions.
Binary file modified .DS_Store
Binary file not shown.
8 changes: 5 additions & 3 deletions .github/workflows/build-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ jobs:
echo "APPLICATION: $APPLICATION"
cd recipes/$APPLICATION
echo `which python`
/bin/bash build.sh
/bin/bash ../build.sh
- name: Setup rclone
run: |
mkdir -p ~/.config/rclone
echo "$RCLONE_CONFIG" > ~/.config/rclone/rclone.conf
if [ ! -f ~/.config/rclone/rclone.conf ]; then
echo "$RCLONE_CONFIG" > ~/.config/rclone/rclone.conf
fi
- name: Set image variables
id: IMAGEVARS
run: |
Expand All @@ -50,5 +52,5 @@ jobs:
echo "IMAGENAME: $IMAGENAME"
echo "IMAGENAME_TEST=${IMAGENAME//_/ }" >> $GITHUB_ENV
echo "IMAGENAME=$IMAGENAME" >> $GITHUB_ENV
- name : Upload file
- name : Upload zip file
run: /bin/bash .github/workflows/upload-zip.sh $IMAGENAME
21 changes: 10 additions & 11 deletions .github/workflows/upload-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@ cd recipes/$APPLICATION

IMAGENAME=$1

IMAGE_HOME=/storage/openrecon

#This prevents the sometimes stuck apt process from stopping the build
if [ -f "/var/lib/apt/lists/lock" ]; then
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
fi

echo "[DEBUG] Attempting upload to Nectar Object Storage ..."
rclone copy --progress $IMAGE_HOME/${IMAGENAME}_${BUILDDATE}.zip nectar:/neurodesk/openrecon

echo "[DEBUG] Attempting upload to AWS Object Storage ..."
rclone copy --progress $IMAGE_HOME/${IMAGENAME}_${BUILDDATE}.zip aws-neurocontainers:/neurocontainers/openrecon
rclone copy --progress $IMAGE_HOME/${IMAGENAME}.zip aws-neurocontainers:/openrecon

if curl --output /dev/null --silent --head --fail "https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/openrecon/${IMAGENAME}_${BUILDDATE}.zip"; then
echo "[DEBUG] ${IMAGENAME}_${BUILDDATE}.simg was freshly build and exists now :)"
echo "[DEBUG] cleaning up $IMAGE_HOME/${IMAGENAME}_${BUILDDATE}.zip"
rm -rf $IMAGE_HOME/${IMAGENAME}_${BUILDDATE}.zip
if curl --output /dev/null --silent --head --fail "https://openrecon.neurodeks.org/${IMAGENAME}.zip"; then
echo "[DEBUG] ${IMAGENAME}.simg was freshly build and exists now :)"
echo "[DEBUG] cleaning up $IMAGE_HOME/${IMAGENAME}.zip"
rm -rf $IMAGE_HOME/${IMAGENAME}.zip
else
echo "[ERROR] ${IMAGENAME}_${BUILDDATE}.zip does not exist yet. Something is WRONG"
echo "[ERROR] cleaning up $IMAGE_HOME/${IMAGENAME}_${BUILDDATE}.zip"
rm -rf $IMAGE_HOME/${IMAGENAME}_${BUILDDATE}.zip
echo "[ERROR] ${IMAGENAME}.zip does not exist yet. Something is WRONG"
echo "[ERROR] cleaning up $IMAGE_HOME/${IMAGENAME}.zip"
rm -rf $IMAGE_HOME/${IMAGENAME}.zip
exit 2
fi

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
File renamed without changes.
22 changes: 22 additions & 0 deletions recipes/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

# check and install dependencies
if ! pip3 show jsonschema &> /dev/null; then
pip3 install jsonschema
fi

if ! pip3 show packaging &> /dev/null; then
pip3 install packaging
fi

if ! command -v 7z &> /dev/null; then
sudo apt install p7zip
fi

# check docker version
python ../checkDockerVersion.py

# build zip file
python build.py

6 changes: 3 additions & 3 deletions recipes/defacing/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Validate JSON file against OpenRecon schema and write Dockerfile
jsonFilePath = 'OpenReconLabel.json'
schemaFilePath = 'OpenReconSchema_1.1.0.json'
schemaFilePath = '../OpenReconSchema_1.1.0.json'
dockerfilePath = 'OpenRecon.dockerfile'
baseDockerImage = 'stebo85/niimath-test'

Expand Down Expand Up @@ -68,10 +68,10 @@ def validateJson(jsonFilePath, schemaFilePath):
raise Exception('Could not find documentation file: ' + docsFile)

# Check 7-zip exists
zipExe = '7z'
zipExe = '/usr/bin/7z'

if not os.path.isfile(zipExe):
raise Exception('Could not find 7-Zip executable: ' + docsFile + '\nPlease download and install 7-Zip')
raise Exception('Could not find 7-Zip executable: ' + zipExe + '\nPlease download and install 7-Zip')

dockerImagename = ('OpenRecon_' + vendor + '_' + name + ':' + 'V' + version).lower()
baseFilename = 'OpenRecon_' + vendor + '_' + name + '_V' + version
Expand Down
13 changes: 0 additions & 13 deletions recipes/defacing/build.sh

This file was deleted.

0 comments on commit 5a7109e

Please sign in to comment.