diff --git a/.gitea/workflows/deploy-all.yml b/.gitea/workflows/deploy-all.yml deleted file mode 100644 index db3b798..0000000 --- a/.gitea/workflows/deploy-all.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Deploy All Containers - -on: - workflow_dispatch: - -jobs: - deploy: - name: Prepare - runs-on: ansible - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Deploy - shell: sh - run: | - mkdir -p ~/.ssh - echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - eval $(ssh-agent -s) - ssh-add <(echo "${{ secrets.SSH_KEY }}") - echo "HOST *" > ~/.ssh/config - echo "${{ secrets.VAULT_PASS }}" > ~/.vault_pass.txt - chmod 600 ansible.cfg - /usr/bin/ansible-playbook main.yml -l jackson --vault-password-file ~/.vault_pass.txt diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 8375c44..74da330 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -9,6 +9,11 @@ on: - "roles/**" - "templates/**" workflow_dispatch: + inputs: + task: + description: Task to deploy + required: false + type: string jobs: deploy: @@ -21,6 +26,8 @@ jobs: fetch-depth: 0 - name: Deploy + env: + TASK: ${{ inputs.task }} shell: sh run: | mkdir -p ~/.ssh diff --git a/scripts/deploy_containers.py b/scripts/deploy_containers.py index 70db2ee..d5e0e9f 100644 --- a/scripts/deploy_containers.py +++ b/scripts/deploy_containers.py @@ -40,10 +40,15 @@ def get_normalized_task_name(container): return task_name - def main(): dir_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../') - diff = git_diff() + + print("Task environment variable: " + os.environ.get("TASK")) + if os.environ.get("TASK"): + diff = [os.environ.get("TASK")] + else: + diff = git_diff() + deployable_containers = [] removable_containers = []