Skip to content

Commit

Permalink
Send package in chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
sshrihar committed Sep 2, 2024
1 parent 74e1f82 commit 3f68c60
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions .github/workflows/deploy_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,43 @@ jobs:

- name: Copy miden node package to devnet instance
run: |
# Base64 encode files locally
MIDEN_NODE_CONTENT=$(base64 -w 0 ${{ runner.workspace }}/miden-node/miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb)
FAUCET_NODE_CONTENT=$(base64 -w 0 ${{ runner.workspace }}/miden-node/miden-faucet-${{ inputs.tag }}-${{ env.ARCH }}.deb)
# Encode the file in base64 and split it into chunks of 3000 bytes
base64 ${{ runner.workspace }}/miden-node/miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb | split -b 3000 - miden_node_part_
# Send each chunk to the EC2 instance
for part in miden_node_part_*; do
CONTENT=$(cat $part)
aws ssm send-command \
--instance-ids $EC2_INSTANCE_ID \
--document-name "AWS-RunShellScript" \
--parameters commands="echo $CONTENT >> miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb.base64"
done
# Use the encoded content in the SSM command
# Combine the chunks and decode the file on the EC2 instance
aws ssm send-command \
--instance-ids $EC2_INSTANCE_ID \
--document-name "AWS-RunShellScript" \
--parameters commands="
echo $MIDEN_NODE_CONTENT | base64 -d > miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb
echo $FAUCET_NODE_CONTENT | base64 -d > miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb.checksum
"
--parameters commands="base64 -d miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb.base64 > miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb; rm -f miden-node-${{ inputs.tag }}-${{ env.ARCH }}.deb.base64"
- name: Copy miden faucet package to devnet instance
run: |
# Encode the file in base64 and split it into chunks of 3000 bytes
base64 ${{ runner.workspace }}/miden-node/miden-faucet-${{ inputs.tag }}-${{ env.ARCH }}.deb | split -b 3000 - miden_faucet_part_
# Send each chunk to the EC2 instance
for part in miden_faucet_part_*; do
CONTENT=$(cat $part)
aws ssm send-command \
--instance-ids $EC2_INSTANCE_ID \
--document-name "AWS-RunShellScript" \
--parameters commands="echo $CONTENT >> miden-faucet-${{ inputs.tag }}-${{ env.ARCH }}.deb.base64"
done
# Combine the chunks and decode the file on the EC2 instance
aws ssm send-command \
--instance-ids $EC2_INSTANCE_ID \
--document-name "AWS-RunShellScript" \
--parameters commands="base64 -d miden-faucet-${{ inputs.tag }}-${{ env.ARCH }}.deb.base64 > miden-faucet-${{ inputs.tag }}-${{ env.ARCH }}.deb; rm -f miden-faucet-${{ inputs.tag }}-${{ env.ARCH }}.deb.base64"
env:
ARCH: arm64
if: ${{ github.event_name == 'push' }}
Expand Down

0 comments on commit 3f68c60

Please sign in to comment.