11name : Build, Test, and Push Datastream Docker Containers on X86 and ARM (Version Aware)
22
33on :
4- workflow_dispatch:
4+ workflow_dispatch :
5+ inputs :
6+ branch_name :
7+ description : ' Branch name to build from (leave empty to use current branch)'
8+ required : false
9+ default : ' '
10+ type : string
511 push :
6- branches:
7- - main
12+ # branches:
13+ # - main
814 paths :
915 - ' versions.yml'
1016
7985 fi
8086 echo "ds_version=$CURRENT_DS" >> "$GITHUB_OUTPUT"
8187
82- build-test-docker-x86:
88+ build-test-push- docker-x86 :
8389 needs : [detect-changes]
8490 runs-on : ubuntu-latest
8591 steps :
@@ -104,14 +110,15 @@ jobs:
104110 username : ${{ secrets.DOCKERHUB_USERNAME }}
105111 password : ${{ secrets.DOCKERHUB_TOKEN }}
106112
107- - name: Install packages for datastream
108- run: |
109- curl -L -O https://github.com/lynker-spatial/hfsubsetCLI/releases/download/v1.1.0/hfsubset-v1.1.0-linux_amd64.tar.gz && tar -xzvf hfsubset-v1.1.0-linux_amd64.tar.gz && sudo mv ./hfsubset /usr/bin/hfsubset && sudo apt-get update && sudo apt-get install git pip pigz -y
113+ # - name: Install packages for datastream
114+ # run: |
115+ # curl -L -O https://github.com/lynker-spatial/hfsubsetCLI/releases/download/v1.1.0/hfsubset-v1.1.0-linux_amd64.tar.gz && tar -xzvf hfsubset-v1.1.0-linux_amd64.tar.gz && sudo mv ./hfsubset /usr/bin/hfsubset && sudo apt-get update && sudo apt-get install git pip pigz -y
110116
111117 - name : Build docker containers
112118 run : |
113- chmod +x ./scripts/docker_builds.sh
114- ./scripts/docker_builds.sh -e -f -d -t latest-x86
119+ ARCH=$(uname -m) TAG=latest-x86 docker compose -f docker/docker-compose.yml build datastream-deps
120+ TAG=latest-x86 docker compose -f docker/docker-compose.yml build datastream
121+ TAG=latest-x86 docker compose -f docker/docker-compose.yml build forcingprocessor
115122
116123 - name : Prepare and test docker containers
117124 run : |
@@ -140,7 +147,7 @@ jobs:
140147 fi
141148
142149 build-test-push-docker-arm :
143- needs: [detect-changes, build-test-docker-x86]
150+ needs : [detect-changes, build-test-push- docker-x86]
144151 runs-on : ubuntu-latest
145152 steps :
146153 - name : Checkout code
@@ -155,6 +162,23 @@ jobs:
155162 aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
156163 aws configure set region us-east-1
157164
165+ - name : Prepare execution config with branch
166+ run : |
167+ # Determine the branch name
168+ if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ inputs.branch_name }}" ]; then
169+ BRANCH_NAME="${{ inputs.branch_name }}"
170+ echo "Using manual input branch: $BRANCH_NAME"
171+ else
172+ BRANCH_NAME="${{ github.ref_name }}"
173+ echo "Using current branch: $BRANCH_NAME"
174+ fi
175+
176+ # Replace ${BRANCH_NAME} with actual branch name in the file
177+ cd research_datastream/terraform/test
178+ sed -i "s/\${BRANCH_NAME}/$BRANCH_NAME/g" execution_gp_arm_docker_buildNtester.json
179+ cat execution_gp_arm_docker_buildNtester.json
180+
181+
158182 - name : Build AWS Infra
159183 run : |
160184 cd research_datastream/terraform
@@ -203,14 +227,15 @@ jobs:
203227 BUILD_FLAGS=$(echo "$BUILD_FLAGS" | sed 's/^ *//')
204228
205229 cd research_datastream/terraform
206- sed -e "s/\${TAG}/$TAG/g" -e "s/\${BUILD_ARGS}/$BUILD_FLAGS/g" \
207- test/execution_gp_arm_docker_buildNtester.json > test/execution_temp.json
230+
231+ sed -i -e "s/\${TAG}/$TAG/g" -e "s/\${BUILD_ARGS}/$BUILD_FLAGS/g" \
232+ test/execution_gp_arm_docker_buildNtester.json
208233
209234 echo "Generated execution file:"
210- cat test/execution_temp .json
235+ cat test/execution_gp_arm_docker_buildNtester .json
211236
212237 echo "Building with TAG: $TAG and FLAGS: $BUILD_FLAGS"
213- 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_temp .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!"
238+ 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!"
214239
215240
216241 - name : Tear down infra
0 commit comments