add support for task environment var
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user