diff --git a/.gitea/workflows/deploy-bin.yml b/.gitea/workflows/deploy-bin.yml index fbd29d3..6f2a3f5 100644 --- a/.gitea/workflows/deploy-bin.yml +++ b/.gitea/workflows/deploy-bin.yml @@ -29,3 +29,5 @@ jobs: run: | mkdir -p ${DEST_DIR} cp -r ./* ${DEST_DIR} + + # TODO: maybe this is better: `rsync -av --delete ./ "${DEST_DIR}/"` # Sync everything perfectly, including hidden files, and delete old stale files \ No newline at end of file diff --git a/.gitea/workflows/deploy-build-restart-service.yml b/.gitea/workflows/deploy-build-restart-service.yml index fb3b6b7..6688520 100644 --- a/.gitea/workflows/deploy-build-restart-service.yml +++ b/.gitea/workflows/deploy-build-restart-service.yml @@ -19,7 +19,7 @@ # env: # # commit tagged ? yes->prod : no->dev # AGEBD_ENV: ${{ github.ref_type == 'tag' && 'prod' || 'dev' }} -# SVC_CURRRENT_DIR: /sls/bd/hla/${{ github.ref_type == 'tag' && 'prod' || 'dev' }}/services/master/current +# SVC_CURRRENT_DIR: /sls/bd/hla/${{ github.ref_type == 'tag' && 'prod' || 'dev' }}/services/000-master/current # steps: # - name: Checkout repository @@ -30,7 +30,7 @@ # - name: Copy files and replace {{ agebd_env }} with dev or prod # run: | # mkdir -p ${SVC_CURRRENT_DIR} - # cp -r master/* ${SVC_CURRRENT_DIR} + # cp -r 000-master/* ${SVC_CURRRENT_DIR} # sed -i 's/{{ agebd_env }}/${AGEBD_ENV}/g' ${SVC_CURRRENT_DIR}/systemd/AGEBD-SERVICE-MASTER.service # - name: Create Python venv @@ -55,7 +55,7 @@ # CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) # set -e - # # 1. Parse changed directory names into space-separated string (e.g. "master secondary") + # # 1. Parse changed directory names into space-separated string (e.g. "000-master 001-secondary") # CHANGED_SVC=$(echo "$CHANGED_FILES" | awk -F/ '$1=="services" {print $2}' | sort -u | xargs) # echo "Detected changed services: '$CHANGED_SVC'" diff --git a/.gitea/workflows/deploy-py-agebd.yml b/.gitea/workflows/deploy-py-agebd.yml index 58ee985..185479f 100644 --- a/.gitea/workflows/deploy-py-agebd.yml +++ b/.gitea/workflows/deploy-py-agebd.yml @@ -30,3 +30,5 @@ jobs: run: | mkdir -p ${DEST_DIR} cp -r ./* ${DEST_DIR} + + # TODO: maybe this is better: `rsync -av --delete ./ "${DEST_DIR}/"` # Sync everything perfectly, including hidden files, and delete old stale files diff --git a/ansible/plays/service/service-deploy-and-restart.yml b/ansible/plays/service/service-deploy-and-restart.yml index 9a49403..d596c8d 100644 --- a/ansible/plays/service/service-deploy-and-restart.yml +++ b/ansible/plays/service/service-deploy-and-restart.yml @@ -22,13 +22,13 @@ # ansible.builtin.shell: | # mkdir -p "{{ svc_current_dir }}" + # TODO: make sure this is what we want (essentially wipes existing dest dir) - name: "[{{ target_service_name_lower }}] Sync service deployment files" - ansible.builtin.copy: + ansible.posix.synchronize: src: "{{ playbook_dir }}/../../../services/{{ target_service_name_lower }}/current/" dest: "{{ svc_current_dir }}/" - mode: 'preserve' - # ansible.builtin.shell: | - # cp -r "{{ repo_root }}/services/{{ target_service_name_lower }}/current/" "{{ svc_current_dir }}" + delete: yes # This removes stale files on the target that no longer exist locally + recursive: yes - name: "[{{ target_service_name_lower }}] Substitute environment variable inline" ansible.builtin.replace: