Skip to content

azure --> aws

azure --> aws #3

name: Benchmark machine
on:
workflow_dispatch:
inputs:
docker_tag:
description: The tag of docker image to pull
default: 'latest'
required: true
env:
INSTANCE_ID: ${{ secrets.BENCHMARK_INSTANCE_ID }}
BENCHMARK_SSH_USER: ${{ secrets.BENCHMARK_SSH_USER }}
BENCHMARK_SSH_KEY: ${{ secrets.BENCHMARK_SSH_KEY }}
jobs:
## run the benchmarking remotely
benchmark-machine:

Check failure on line 18 in .github/workflows/benchmark-machine.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/benchmark-machine.yml

Invalid workflow file

You have an error in your yaml syntax on line 18
runs-on: jumphost.azure
steps:
- name: Checkout codes on ${{ github.ref }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
# TODO: maybe use GHA to start/stop remote instance
- name: Start remote instance
timeout-minutes: 10
id: start_instance
run: |
aws ec2 start-instances --instance-ids ${{ env.INSTANCE_ID }}
sleep 5
instance_status="aws ec2 describe-instance-status --instance-ids ${{ env.INSTANCE_ID }} --query 'InstanceStatuses[0].InstanceStatus.Status' --output text"
system_status="aws ec2 describe-instance-status --instance-ids ${{ env.INSTANCE_ID }} --query 'InstanceStatuses[0].SystemStatus.Status' --output text"
SECONDS=0
while : ; do
if [ "$(eval $instance_status)" = "ok" ] && [ "$(eval $system_status)" = "ok" ]; then
break
else
sleep 20
SECONDS=$((SECONDS + 20))
fi
done
echo "Remote instance reachable now after $SECONDS seconds"
remote_ip=`aws ec2 describe-instances --filters 'Name=instance-state-name,Values=running' 'Name=instance-id,Values=${{ env.INSTANCE_ID }}' --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text`
echo "Running instances ip address: $remote_ip"
echo "remote_ip=$remote_ip" >> $GITHUB_OUTPUT
# exit status should propagate through ssh
- name: Remotely benchmark machine
timeout-minutes: 10
run: |
echo "Running instances ip address: ${{ steps.start_instance.outputs.remote_ip }}"
cat << EOF > ./benchmark-server-key.pem
${{ env.BENCHMARK_SSH_KEY }}
EOF
chmod 600 ./benchmark-server-key.pem
ssh -x -o StrictHostKeychecking=no "${{ steps.start_instance.outputs.remote_ip }}" -l ${{ env.BENCHMARK_SSH_USER }} -i ./benchmark-server-key.pem \
docker pull litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} && \
docker run --rm litentry/litentry-parachain:${{ github.event.inputs.docker_tag }} benchmark machine --allow-fail --chain=litmus-dev
- name: Stop remote instance
if: always()
run: |
aws ec2 stop-instances --instance-ids ${{ env.INSTANCE_ID }}
sleep 5
ret=`aws ec2 describe-instance-status --instance-ids ${{ env.INSTANCE_ID }} | jq '.InstanceStatuses[0].InstanceState.Name'`
echo "Remote instance running state: $ret"