refactor(infra): use secrets
This commit is contained in:
@@ -3,32 +3,6 @@ name: Upload Infrastructure
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
host:
|
|
||||||
description: "IP address or hostname of the remote destination server"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
user:
|
|
||||||
description: "SSH username for the remote destination server"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
port:
|
|
||||||
description: "SSH port for the remote destination server"
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "22"
|
|
||||||
jump_host:
|
|
||||||
description: "IP address or hostname of the SSH jump (bastion) server"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
jump_user:
|
|
||||||
description: "SSH username for the SSH jump (bastion) server"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
jump_port:
|
|
||||||
description: "SSH port for the SSH jump (bastion) server"
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "22"
|
|
||||||
infrastructure_path:
|
infrastructure_path:
|
||||||
description: "Target directory path to run deployment commands inside"
|
description: "Target directory path to run deployment commands inside"
|
||||||
required: false
|
required: false
|
||||||
@@ -41,6 +15,24 @@ on:
|
|||||||
jump_ssh_key:
|
jump_ssh_key:
|
||||||
description: "SSH private key for the SSH jump (bastion) server"
|
description: "SSH private key for the SSH jump (bastion) server"
|
||||||
required: true
|
required: true
|
||||||
|
host:
|
||||||
|
description: "IP address or hostname of the remote destination server"
|
||||||
|
required: true
|
||||||
|
user:
|
||||||
|
description: "SSH username for the remote destination server"
|
||||||
|
required: true
|
||||||
|
port:
|
||||||
|
description: "SSH port for the remote destination server"
|
||||||
|
required: false
|
||||||
|
jump_host:
|
||||||
|
description: "IP address or hostname of the SSH jump (bastion) server"
|
||||||
|
required: true
|
||||||
|
jump_user:
|
||||||
|
description: "SSH username for the SSH jump (bastion) server"
|
||||||
|
required: true
|
||||||
|
jump_port:
|
||||||
|
description: "SSH port for the SSH jump (bastion) server"
|
||||||
|
required: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -50,6 +42,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ secrets.ssh_key }}
|
SSH_KEY: ${{ secrets.ssh_key }}
|
||||||
JUMP_SSH_KEY: ${{ secrets.jump_ssh_key }}
|
JUMP_SSH_KEY: ${{ secrets.jump_ssh_key }}
|
||||||
|
TARGET_HOST: ${{ secrets.host }}
|
||||||
|
TARGET_USER: ${{ secrets.user }}
|
||||||
|
TARGET_PORT: ${{ secrets.port || '22' }}
|
||||||
|
JUMP_HOST: ${{ secrets.jump_host }}
|
||||||
|
JUMP_USER: ${{ secrets.jump_user }}
|
||||||
|
JUMP_PORT: ${{ secrets.jump_port || '22' }}
|
||||||
run: |
|
run: |
|
||||||
# Create ssh directory and restrict access
|
# Create ssh directory and restrict access
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@@ -63,17 +61,17 @@ jobs:
|
|||||||
# Create SSH config to handle jump routing, keys, and security bypasses
|
# Create SSH config to handle jump routing, keys, and security bypasses
|
||||||
cat << EOF > ~/.ssh/config
|
cat << EOF > ~/.ssh/config
|
||||||
Host jump
|
Host jump
|
||||||
HostName ${{ inputs.jump_host }}
|
HostName $JUMP_HOST
|
||||||
User ${{ inputs.jump_user }}
|
User $JUMP_USER
|
||||||
Port ${{ inputs.jump_port }}
|
Port $JUMP_PORT
|
||||||
IdentityFile ~/.ssh/id_jump
|
IdentityFile ~/.ssh/id_jump
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
UserKnownHostsFile /dev/null
|
UserKnownHostsFile /dev/null
|
||||||
|
|
||||||
Host target
|
Host target
|
||||||
HostName ${{ inputs.host }}
|
HostName $TARGET_HOST
|
||||||
User ${{ inputs.user }}
|
User $TARGET_USER
|
||||||
Port ${{ inputs.port }}
|
Port $TARGET_PORT
|
||||||
IdentityFile ~/.ssh/id_rsa
|
IdentityFile ~/.ssh/id_rsa
|
||||||
ProxyJump jump
|
ProxyJump jump
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
|
|||||||
Reference in New Issue
Block a user