Skip to content

Commit

Permalink
Set bastion ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic authored Dec 7, 2023
1 parent 52b3ac2 commit 7157066
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/actions/open-ssh-tunnel/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: deploy-helm
description: "Helm deploy"

inputs:
bastion_user:
description: username@host for the ssh tunnel
required: true
type: string
bastion_ssh_key:
description: private ssh key content
required: true
type: string

runs:
using: "composite"
steps:
- run: |
mkdir .ssh;
BASTION_USER=${{ inputs.bastion_user}};
echo ${{ inputs.bastion_ssh_key }} | base64 -d > .ssh/github_bastion;
chmod 600 .ssh/github_bastion;
ssh-keyscan ${BASTION_USER#*@} > .ssh/known_hosts 2> /dev/null;
chmod 644 .ssh/known_hosts;
ssh -i .ssh/github_bastion ${{ inputs.bastion_user }} -o UserKnownHostsFile=.ssh/known_hosts -D 1080 -f -q -N;
shell: bash
12 changes: 12 additions & 0 deletions .github/workflows/reusable.build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ on:
SSH_PRIVATE_KEY:
description: ssh key to private submodule
required: false
BASTION_USER:
description: ssh bastion user@server
required: true
BASTION_SSH_KEY:
description: bastion ssh key
required: true

jobs:

Expand Down Expand Up @@ -131,6 +137,12 @@ jobs:
with:
ref: ${{ inputs.commit }}

- name: Open ssh tunnel
uses: paulscherrerinstitute/scicat-ci/.github/actions/open-ssh-tunnel@bastion_ssh
with:
bastion_user: '${{ secrets.BASTION_USER }}'
bastion_ssh_key: '${{ secrets.BASTION_SSH_KEY }}'

- name: Deploy to k8s using helm
id: helm-deploy
uses: paulscherrerinstitute/scicat-ci/.github/actions/deploy-helm@main
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/scicat-search-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ jobs:
COMPONENT_CONFIG=helm/configs/search-api/component-config.json
secrets:
KUBECONFIG: ${{ secrets.KUBECONFIG }}
BASTION_USER: ${{ secrets.BASTION_USER }}
BASTION_SSH_KEY: ${{ secrets.BASTION_SSH_KEY }}

0 comments on commit 7157066

Please sign in to comment.