diff --git a/.github/workflows/nextjs-prod-CD.yml b/.github/workflows/nextjs-prod-CD.yml index 7cdde61d..ccc9dbb4 100644 --- a/.github/workflows/nextjs-prod-CD.yml +++ b/.github/workflows/nextjs-prod-CD.yml @@ -38,29 +38,19 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_KEY }} - - name: Add known hosts + - name: Add known hosts for Bastion Host run: | mkdir -p ~/.ssh echo "BASTION_IP: ${{ secrets.BASTION_IP }}" - echo "WEB_IPS: ${{ secrets.WEB_IPS }}" ssh-keyscan -H ${{ secrets.BASTION_IP }} >> ~/.ssh/known_hosts if [ $? -ne 0 ]; then echo "Failed to add BASTION_IP to known_hosts" exit 1 fi - IFS=',' read -r -a HOSTS <<< "${{ secrets.WEB_IPS }}" - for host in "${HOSTS[@]}"; do - echo "Adding host $host to known_hosts" - ssh-keyscan -H $host >> ~/.ssh/known_hosts - if [ $? -ne 0 ]; then - echo "Failed to add $host to known_hosts" - exit 1 - fi - done - name: Deploy to FE env: - BASTION_HOST: ${{ secrets.BASTION_IP }} + BASTION_HOST: ${{ secrets.BASTION_HOST }} USER: ${{ secrets.USER }} WEB_IPS: ${{ secrets.WEB_IPS }} ACCESS_KEY: ${{ secrets.ACCESS_KEY }} @@ -84,10 +74,10 @@ jobs: echo "$ACCESS_SECRET_KEY" | docker login $KCR_REGISTRY --username $ACCESS_KEY --password-stdin echo "Pulling new Docker image" - docker pull $KCR_REGISTRY/$KCR_REPOSITORY:${{ steps.get_version.outputs.version }} + docker pull $KCR_REGISTRY/$KCR_REPOSITORY:${{ steps.get_tag.outputs.tag }} echo "Running new Docker container" - docker run -d -p 80:3000 --name frontend $KCR_REGISTRY/$KCR_REPOSITORY:${{ steps.get_version.outputs.version }} + docker run -d -p 80:3000 --name frontend $KCR_REGISTRY/$KCR_REPOSITORY:${{ steps.get_tag.outputs.tag }} echo "Checking container health" max_retries=5