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