Updating jobs to better cleanup
This commit is contained in:
@@ -12,7 +12,8 @@ jobs:
|
||||
|
||||
env:
|
||||
IMAGE_NAME: territory-autobattler-auth:latest
|
||||
IMAGE_TAR: /tmp/territory-autobattler-auth.tar
|
||||
IMAGE_TAR: ${{ github.workspace }}/territory-autobattler-auth.tar
|
||||
REMOTE_IMAGE_TAR: /home/hz/territory-autobattler-auth.tar
|
||||
NAMESPACE: territory-autobattler
|
||||
DEPLOYMENT_NAME: territory-autobattler-auth
|
||||
NODES: "192.168.86.72 192.168.86.73 192.168.86.74"
|
||||
@@ -26,6 +27,10 @@ jobs:
|
||||
cd microservices/AuthApi
|
||||
docker build -t "${IMAGE_NAME}" .
|
||||
|
||||
- name: Clean stale TAR on runner
|
||||
run: |
|
||||
rm -f "${IMAGE_TAR}"
|
||||
|
||||
- name: Save Docker image to TAR
|
||||
run: |
|
||||
docker save "${IMAGE_NAME}" -o "${IMAGE_TAR}"
|
||||
@@ -34,24 +39,27 @@ jobs:
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Copying image tar to $node ..."
|
||||
scp -o StrictHostKeyChecking=no "${IMAGE_TAR}" hz@"$node":"${IMAGE_TAR}"
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "rm -f ${REMOTE_IMAGE_TAR}"
|
||||
scp -o StrictHostKeyChecking=no "${IMAGE_TAR}" hz@"$node":"${REMOTE_IMAGE_TAR}"
|
||||
done
|
||||
|
||||
- name: Import image on nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Importing image on $node ..."
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "sudo ctr -n k8s.io images import ${IMAGE_TAR}"
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "sudo ctr -n k8s.io images import ${REMOTE_IMAGE_TAR}"
|
||||
done
|
||||
|
||||
- name: Clean TAR from nodes
|
||||
if: always()
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Removing image tar on $node ..."
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "rm -f ${IMAGE_TAR}"
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "rm -f ${REMOTE_IMAGE_TAR}"
|
||||
done
|
||||
|
||||
- name: Clean TAR on runner
|
||||
if: always()
|
||||
run: |
|
||||
rm -f "${IMAGE_TAR}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user