Skip to content

Commit

Permalink
Merge pull request #178 from Kerosene-Labs/BIL-6-update-fixed
Browse files Browse the repository at this point in the history
BIL-6: Building Workflow
  • Loading branch information
hlafaille authored Jan 2, 2025
2 parents b5281bb + 3c7fa5e commit ed19c6e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
32 changes: 25 additions & 7 deletions .github/actions/remote-command/action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
name: Remote Command
description: Run a command on one of our servers.

inputs:
server:
description: Name of the server
# bastion
bastion_private_key:
description: The private SSH key of the bastion
required: true
bastion_ssh_user:
description: The user of the bastion
required: true
bastion_ssh_host:
description: The host of the bastion
required: true

# deployment server
deployment_private_key:
description: The private SSH key for the deployment server
required: true
user:
deployment_ssh_user:
description: Name of the user on the server
required: true
deployment_server:
description: Name of the server
required: true

# other
command:
description: Shell command to run for develop
description: Shell command to run
required: true
runs:
using: composite
steps:
- name: Write Keys
run: mkdir -p ~/.ssh && echo "${{secrets.BASTION_PRIVATE_KEY}}" >> ~/.ssh/bastion && echo "${{secrets.DEPLOYMENT_PRIVATE_KEY}}" >> ~/.ssh/deployment
run: mkdir -p ~/.ssh && echo "${{ inputs.bastion_private_key}}" >> ~/.ssh/bastion && echo "${{ inputs.deployment_private_key}}" >> ~/.ssh/deployment
shell: bash

- name: Set Key Permissions
Expand All @@ -31,9 +49,9 @@ runs:
shell: bash

- name: Acknowledge Host Key on Bastion
run: ssh -T -i ~/.ssh/bastion -o "StrictHostKeyChecking no" -p 2222 ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}
run: ssh -T -i ~/.ssh/bastion -o "StrictHostKeyChecking no" -p 2222 ${{ inputs.bastion_ssh_user}}@${{ inputs.bastion_ssh_host}}
shell: bash

- name: Run Command
run: ssh -o "StrictHostKeyChecking no" -A -J ${{secrets.BASTION_SSH_USER}}@${{secrets.BASTION_HOST}}:2222 ${{inputs.user}}@${{inputs.server}}.kerosenelabs.com "${{inputs.command}}"
run: ssh -o "StrictHostKeyChecking no" -A -J ${{ inputs.bastion_ssh_user }}@${{ inputs.bastion_ssh_host}}:2222 ${{ inputs.deployments_ssh_user }}@${{ inputs.deployment_server }}.kerosenelabs.com "${{ inputs.command }}"
shell: bash
8 changes: 6 additions & 2 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ jobs:
- name: Remote Command on Infrastructure
uses: ./.github/actions/remote-command
with:
server: mars1d
user: infra
bastion_private_key: ${{ secrets.BASTION_PRIVATE_KEY }}
bastion_ssh_user: ${{ secrets.BASTION_SSH_USER }}
bastion_ssh_host: ${{ secrets.BASTION_HOST }}
deployment_private_key: ${{secrets.DEPLOYMENT_PRIVATE_KEY}}
deployment_user: infra
deployment_server: mars1d
command: ls

0 comments on commit ed19c6e

Please sign in to comment.