Skip to content

Commit

Permalink
add policy
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanLaserGit committed Sep 19, 2024
1 parent bc98c1c commit 9862a88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build_test_docker_arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,17 @@ jobs:
- name: Build and Test arm docker containers with AWS infra
run : |
cd research_datastream/terraform
aws iam attach-role-policy --role-name datastream_ec2_role_github_actions_arm --policy-arn arn:aws:iam::aws:policy/SecretsManagerReadWrite
if ! aws ec2 describe-key-pairs --key-names "actions_key_arm" --query 'KeyPairs[0].KeyName' --output text 2>/dev/null; then aws ec2 create-key-pair --key-name "actions_key_arm" --query 'KeyName' --output text && echo "Key pair 'actions_key' created in AWS"; else echo "Key pair 'actions_key' already exists"; fi
execution_arn=$(aws stepfunctions start-execution --state-machine-arn $(cat ./sm_ARN.txt) --name docker_builder_$(env TZ=US/Eastern date +'%Y%m%d%H%M%S') --input "file://test/execution_gp_arm_docker_buildNtester.json" --region us-east-1 --query 'executionArn' --output text); echo "Execution ARN: $execution_arn"; status="RUNNING"; while [ "$status" != "SUCCEEDED" ]; do status=$(aws stepfunctions describe-execution --execution-arn "$execution_arn" --region us-east-1 --query 'status' --output text); echo "Current status: $status"; if [ "$status" == "FAILED" ]; then echo "State machine execution failed!"; exit 1; fi; sleep 5; done; echo "State machine execution succeeded!"
- name: Confirm docker push
run : |
docker rmi -f $(docker images -aq)
docker pull awiciroh/datastream:latest
CONTAINER_ID=$(docker ps -q --filter ancestor=awiciroh/datastream:latest) && CREATION_TIME=$(docker inspect -f '{{.Created}}' $CONTAINER_ID) && CREATION_EPOCH=$(date --date="$CREATION_TIME" +%s) && CURRENT_EPOCH=$(date +%s) && TIME_DIFF=$((CURRENT_EPOCH - CREATION_EPOCH)) && [ $TIME_DIFF -le 300 ] && echo "The container was created within the past 5 minutes." || { echo "Error: The container was NOT created within the past 5 minutes."; exit 1; }
CREATION_EPOCH=$(date --date="$(docker inspect -f '{{.Created}}' awiciroh/datastream:latest)" +%s) && CURRENT_EPOCH=$(date +%s) && TIME_DIFF=$((CURRENT_EPOCH - CREATION_EPOCH)) && [ $TIME_DIFF -le 300 ] && echo "The container was created within the past 5 minutes." || { echo "Error: The container was NOT created within the past 5 minutes."; exit 1; }
docker pull awiciroh/forcingprocessor:latest
CONTAINER_ID=$(docker ps -q --filter ancestor=awiciroh/forcingprocessor:latest) && CREATION_TIME=$(docker inspect -f '{{.Created}}' $CONTAINER_ID) && CREATION_EPOCH=$(date --date="$CREATION_TIME" +%s) && CURRENT_EPOCH=$(date +%s) && TIME_DIFF=$((CURRENT_EPOCH - CREATION_EPOCH)) && [ $TIME_DIFF -le 300 ] && echo "The container was created within the past 5 minutes." || { echo "Error: The container was NOT created within the past 5 minutes."; exit 1; }
CREATION_EPOCH=$(date --date="$(docker inspect -f '{{.Created}}' awiciroh/forcingprocessor:latest)" +%s) && CURRENT_EPOCH=$(date +%s) && TIME_DIFF=$((CURRENT_EPOCH - CREATION_EPOCH)) && [ $TIME_DIFF -le 300 ] && echo "The container was created within the past 5 minutes." || { echo "Error: The container was NOT created within the past 5 minutes."; exit 1; }
- name: Tear down infra
if: always()
Expand Down

0 comments on commit 9862a88

Please sign in to comment.