fix download script

This commit is contained in:
Marco Carrozzo
2023-01-20 10:37:55 +01:00
parent f5fbd09850
commit 93ed6973bc
2 changed files with 18 additions and 17 deletions
@@ -20,36 +20,37 @@ inputs:
runs:
using: "composite"
steps:
- name: download and extract artifacts from s3
- name: download and extract current run cache artifacts from s3
shell: bash
env:
REMOTE_PATH: "alfresco-ng2-components/build-cache/${{ github.run_id }}"
REMOTE_PATH: "adf/build-cache/${{ github.run_id }}"
run: |
packages=( $(echo ${{ inputs.packages }}) )
for i in "${packages[@]}"; do
echo "downloading current run cache artifacts from ${REMOTE_PATH}/$i.tar.gz"
time aws s3 cp --no-progress s3://${S3_BUILD_BUCKET_SHORT_NAME}/${REMOTE_PATH}/$i.tar.gz $i.tar.gz
du -h $i.tar.gz
time tar xzf $i.tar.gz
done
- name: download and extract persistent artifacts from s3
- name: download and extract persistent cache artifacts from s3
shell: bash
run: |
HASH=$(cat package-lock.json | shasum -a 512 | cut -d ' ' -f 1)
REMOTE_PATH="alfresco-ng2-components/build-cache/${HASH}"
HASH=$(cat package-lock.json | shasum | head -c 40)
REMOTE_PATH="adf/build-cache/${HASH}"
if [ -n "${{ inputs.cache-key-suffix }}" ]; then
REMOTE_PATH="${REMOTE_PATH}-${{ inputs.cache-key-suffix }}"
fi
echo "remote path $REMOTE_PATH"
packages=( $(echo ${{ inputs.persistent-packages }}) )
for i in "${packages[@]}"; do
REMOTE_FILE_PATH="s3://${S3_BUILD_BUCKET_SHORT_NAME}/${REMOTE_PATH}/$i.tar.gz"
cache_exists=$(aws s3 ls $REMOTE_FILE_PATH)
if [ -n "$exists" ]; then
cache_exists=$(aws s3 ls $REMOTE_FILE_PATH > /dev/null)
if [ $cache_exists -eq 0 ]; then
echo "downloading persistent cache artifacts from $REMOTE_FILE_PATH"
time aws s3 cp --no-progress REMOTE_FILE_PATH $i.tar.gz
du -h $i.tar.gz
time tar xzf $i.tar.gz
tar xzf $i.tar.gz
else
echo "file not found $REMOTE_FILE_PATH. continue."
echo "persistent cache artifact file not found on $REMOTE_FILE_PATH. continue."
fi
done
@@ -19,31 +19,31 @@ inputs:
runs:
using: "composite"
steps:
- name: tar and upload artifacts
- name: tar and upload current run cache artifacts
shell: bash
env:
REMOTE_PATH: "alfresco-ng2-components/build-cache/${{ github.run_id }}"
REMOTE_PATH: "adf/build-cache/${{ github.run_id }}"
run: |
packages=( $(echo ${{ inputs.packages }}) )
for i in "${packages[@]}"; do
time tar czf $i.tar.gz $i
du -h $i.tar.gz
echo "uploading current run artifacts to ${REMOTE_PATH}/$i.tar.gz"
time aws s3 cp --no-progress $i.tar.gz s3://${S3_BUILD_BUCKET_SHORT_NAME}/${REMOTE_PATH}/$i.tar.gz
done
- name: tar and upload persistent artifacts
- name: tar and upload persistent cache artifacts
shell: bash
run: |
HASH=$(cat package-lock.json | shasum -a 512 | cut -d ' ' -f 1)
REMOTE_PATH="alfresco-ng2-components/build-cache/${HASH}"
HASH=$(cat package-lock.json | shasum | head -c 40)
REMOTE_PATH="adf/build-cache/${HASH}"
if [ -n "${{ inputs.cache-key-suffix }}" ]; then
REMOTE_PATH="${REMOTE_PATH}-${{ inputs.cache-key-suffix }}"
fi
echo "pushing to $REMOTE_PATH"
packages=( $(echo ${{ inputs.persistent-packages }}) )
for i in "${packages[@]}"; do
time tar czf $i.tar.gz $i
du -h $i.tar.gz
echo "pushing persistent cache"
echo "pushing persistent cache to $REMOTE_PATH"
time aws s3 cp --no-progress $i.tar.gz s3://${S3_BUILD_BUCKET_SHORT_NAME}/${REMOTE_PATH}/$i.tar.gz
done