Skip to content

Commit

Permalink
script imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanLaserGit committed Sep 20, 2024
1 parent 853634a commit a8853b1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_test_docker_arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
cd research_datastream/terraform
terraform init
terraform validate
./test/import_resources.sh
terraform apply -var-file=./test/variables_gitactions_arm.tfvars -auto-approve
sleep 60
- name: Set permissions
Expand Down
2 changes: 1 addition & 1 deletion research_datastream/terraform/test/docker_loginNpush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKERHUB_USERNAME="awiciroh"

if [ "$(echo $DOCKERHUB_TOKEN | docker login -u $DOCKERHUB_USERNAME --password-stdin)" == "Login Succeeded" ]; then
echo "Docker login successful"
./scripts/docker_builds.sh -p >> ./docker_build_log.txt
/home/ec2-user/ngen-datastream/scripts/docker_builds.sh -p -s >> /home/ec2-user/ngen-datastream/docker_build_log.txt
echo "Push complete"
else
echo "Docker login failed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"commands" : [
"runuser -l ec2-user -c 'rm -rf /home/ec2-user/ngen-datastream && docker rmi -f $(docker images -aq)'",
"runuser -l ec2-user -c 'git clone -b test_terraform https://github.com/CIROH-UA/ngen-datastream.git'",
"runuser -l ec2-user -c '/home/ec2-user/ngen-datastream/scripts/docker_builds.sh -b'",
"runuser -l ec2-user -c '/home/ec2-user/ngen-datastream/scripts/docker_builds.sh -b -s'",
"runuser -l ec2-user -c '/home/ec2-user/ngen-datastream/research_datastream/terraform/test/docker_loginNpush.sh >> /home/ec2-user/ngen-datastream/docker_login_log.txt'",
"runuser -l ec2-user -c 'aws s3 cp /home/ec2-user/ngen-datastream/docker_login_log.txt s3://ngen-datastream/docker_login_log.txt'",
"runuser -l ec2-user -c 'aws s3 cp /home/ec2-user/ngen-datastream/docker_build_log.txt s3://ngen-datastream/docker_build_log.txt'"
Expand Down
28 changes: 14 additions & 14 deletions research_datastream/terraform/test/variables_gitactions_arm.tfvars
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
region = "us-east-1"
sm_name = "datastreamconductor_github_actions_arm"
sm_role_name = "datastreamconductor_role_github_actions_arm"
starter_lambda_name = "ec2start_ami_github_actions_arm"
commander_lambda_name = "ec2commander_github_actions_arm"
poller_lambda_name = "CommandPoller_github_actions_arm"
checker_lambda_name = "S3ObjectChecker_github_actions_arm"
stopper_lambda_name = "EC2Stopper_github_actions_arm"
lambda_policy_name = "datastream_lambda_policy_github_actions_arm"
lambda_role_name = "datastream_lambda_role_github_actions_arm"
lambda_invoke_policy_name = "datastream_lambda_invoke_policy_github_actions_arm"
ec2_role = "datastream_ec2_role_github_actions_arm"
ec2_policy_name = "datastream_ec2_policy_github_actions_arm"
profile_name = "datastream_ec2_profile_github_actions_arm"
region="us-east-1"
sm_name="datastreamconductor_github_actions_arm"
sm_role_name="datastreamconductor_role_github_actions_arm"
starter_lambda_name="ec2start_ami_github_actions_arm"
commander_lambda_name="ec2commander_github_actions_arm"
poller_lambda_name="CommandPoller_github_actions_arm"
checker_lambda_name="S3ObjectChecker_github_actions_arm"
stopper_lambda_name="EC2Stopper_github_actions_arm"
lambda_policy_name="datastream_lambda_policy_github_actions_arm"
lambda_role_name="datastream_lambda_role_github_actions_arm"
lambda_invoke_policy_name="datastream_lambda_invoke_policy_github_actions_arm"
ec2_role="datastream_ec2_role_github_actions_arm"
ec2_policy_name="datastream_ec2_policy_github_actions_arm"
profile_name="datastream_ec2_profile_github_actions_arm"
12 changes: 9 additions & 3 deletions scripts/docker_builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ TAG="latest$PLATORM_TAG"

BUILD="no"
PUSH="no"
SKIP_DEPS="no"
while getopts "bp" flag; do
case $flag in
b) BUILD="yes"
;;
p) PUSH="yes"
;;
s) SKIP_DEPS="yes"
;;
\?)
;;
esac
Expand All @@ -28,8 +31,9 @@ if [ "$BUILD" = "yes" ]; then

cd $DOCKER_DIR
echo "Building docker from "$DOCKER_DIR

docker build -t awiciroh/datastream-deps:$TAG -f Dockerfile.datastream-deps . --no-cache --build-arg TAG_NAME=$TAG --build-arg ARCH=$PLATFORM --platform linux/$PLATFORM
if [ "$SKIP_DEPS" = "no" ]; then
docker build -t awiciroh/datastream-deps:$TAG -f Dockerfile.datastream-deps . --no-cache --build-arg TAG_NAME=$TAG --build-arg ARCH=$PLATFORM --platform linux/$PLATFORM
fi

if [ -d "$DOCKER_DATASTREAM" ]; then
rm -rf $DOCKER_DATASTREAM
Expand All @@ -50,7 +54,9 @@ fi

if [ "$PUSH" = "yes" ]; then
echo "Pushing docker containers"
docker push awiciroh/datastream-deps:$TAG
if [ "$SKIP_DEPS" = "no" ]; then
docker push awiciroh/datastream-deps:$TAG
fi
docker push awiciroh/datastream:$TAG
docker push awiciroh/forcingprocessor:$TAG
echo "Docker containers have been pushed to awiciroh dockerhub!"
Expand Down

0 comments on commit a8853b1

Please sign in to comment.